Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0004072Openbravo ERP01. General setuppublic2008-06-19 12:452008-12-08 18:26
plujan 
Hennadzi 
normalminorhave not tried
closedfixed 
10XPsp2
2.40alpha-r3 
 
Core
No
0004072: I get an error message trying to delete a Role selected as default by an user
I get an error message trying to delete a Role selected as default by an user. See steps.
1. Go General Setup || Security || Role || Role
2. Create a new Role. Organization * and User level Client.
3. Assign it to a user
4. Log in with the user assigned and choose this role. Select it as default. An error message appears because there is no Org access for the role.
5. Logout and try to login with the same user. You can not.
6. Log in with previous user and go delete everything related to the role. When trying to delete the Role, although Linked Items shows nothing, you can not delete the role. The message is not correct, both in style (is a warning and should be an error) and message is "zero". See attach.
If you check the log, you will see:

ERROR org.openbravo.erpCommon.utility.ExecuteQuery - SQLException:org.postgresql.util.PSQLException: ERROR: update or delete on table "ad_role" violates foreign key constraint "adrole_aduserdefault" on table "ad_user"
  Detail: Key (ad_role_id)=(1000008) is still referenced from table "ad_user".

So the solution would be capturing the failing constraint and showing a proper message. Please note that this solution should be applied to all constraints, not just the reported one.
No tags attached.
jpg r240r3_BUG_DeletingARole.JPG (91,880) 2008-06-19 12:45
https://issues.openbravo.com/file_download.php?file_id=106&type=bug
jpg
Issue History
2008-06-19 12:45plujanNew Issue
2008-06-19 12:45plujanAssigned To => cromero
2008-06-19 12:45plujansf_bug_id0 => 1997688
2008-06-19 12:45plujanFile Added: r240r3_BUG_DeletingARole.JPG
2008-06-23 18:09cromeroStatusnew => scheduled
2008-06-23 18:09cromeroNote Added: 0007962
2008-06-23 18:09cromeroAssigned Tocromero => Hennadzi
2008-07-09 15:23svnbotCheckin
2008-07-09 15:23svnbotNote Added: 0008249
2008-07-09 15:23svnbotStatusscheduled => resolved
2008-07-09 15:23svnbotResolutionopen => fixed
2008-07-09 15:23svnbotsvn_revision => 5740
2008-12-08 18:26psarobeRegression testing => No
2008-12-08 18:26psarobeStatusresolved => closed

Notes
(0007962)
cromero   
2008-06-23 18:09   
The message for each constraint should be


adclient_aduserdefault:"This record cannot be deleted because a user has associated this client"
adlanguage_aduserdefault:This record cannot be deleted because a user has associated this language"
adorg_aduserdefault:This record cannot be deleted because a user has associated this organization"
adrole_aduserdefault:This record cannot be deleted because a user has associated this role"
mwarehouse_aduserdefault: This record cannot be deleted because a user has associated this warehouse"

These constraints must be in the ad_message table
(0008249)
svnbot   
2008-07-09 15:23   
Repository: openbravo
Revision: 5740
Author: hennadzi
Date: 2008-07-09 15:23:28 +0200 (Wed, 09 Jul 2008)

Fixed bug 0004072: I get an error message trying to delete a Role selected as default by an user

---
U trunk/src-db/database/sourcedata/AD_MESSAGE.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=5740&sc=1 [^]