[ 
https://issues.apache.org/jira/browse/OFBIZ-5996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pierre Smits updated OFBIZ-5996:
--------------------------------
    Description: 
The roles screen on an agreement enable the user to add any party into any role 
on the agreement. 

An example, user bizadmin can select party DemoEmployee for role PACKER and try 
to persist this agreement role. This leads to an error, like below:
{code:java}
The Following Errors Occurred:Error doing entity-auto operation for entity 
AgreementRole in service createAgreementRole: 
org.apache.ofbiz.entity.GenericEntityException: 
org.apache.ofbiz.entity.GenericEntityException: Error while inserting: 
[GenericEntity:AgreementRole][agreementId,AGR_SALES(java.lang.String)][createdStamp,2021-11-04
 11:14:26.779(java.sql.Timestamp)][createdTxStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][lastUpdatedStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][lastUpdatedTxStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][partyId,DemoEmployee(java.lang.String)][roleTypeId,PACKER(java.lang.String)]
 (SQL Exception while executing the following:INSERT INTO OFBIZ.AGREEMENT_ROLE 
(AGREEMENT_ID, PARTY_ID, ROLE_TYPE_ID, LAST_UPDATED_STAMP, 
LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, 
?, ?) (INSERT on table 'AGREEMENT_ROLE' caused a violation of foreign key 
constraint 'AGRMNT_ROLE_PRLE' for key (DemoEmployee,PACKER). The statement has 
been rolled back.)) (Error while inserting: 
[GenericEntity:AgreementRole][agreementId,AGR_SALES(java.lang.String)][createdStamp,2021-11-04
 11:14:26.779(java.sql.Timestamp)][createdTxStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][lastUpdatedStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][lastUpdatedTxStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][partyId,DemoEmployee(java.lang.String)][roleTypeId,PACKER(java.lang.String)]
 (SQL Exception while executing the following:INSERT INTO OFBIZ.AGREEMENT_ROLE 
(AGREEMENT_ID, PARTY_ID, ROLE_TYPE_ID, LAST_UPDATED_STAMP, 
LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, 
?, ?) (INSERT on table 'AGREEMENT_ROLE' caused a violation of foreign key 
constraint 'AGRMNT_ROLE_PRLE' for key (DemoEmployee,PACKER). The statement has 
been rolled back.)))
{code}
The error message is valid, as the selected party doesn't have the selected 
role assigned to him. But undesirable.

Even though it is questionable whether a party should be assigned to the role 
of PACKER on an agreement (and lets for the sake of the argument accept that it 
is a valid choice), the user then needs to ensure that the party gets the role 
before the agreement role can be established.

In order to mitigate this, the user should be only capable to:

1. 

  was:
The roles screen on an agreement enable the user to add any party into any role 
on the agreement. 

An example, user bizadmin can select party DemoEmployee for role PACKER and try 
to persist this agreement role. This leads to an error, like below:
{code:java}
The Following Errors Occurred:Error doing entity-auto operation for entity 
AgreementRole in service createAgreementRole: 
org.apache.ofbiz.entity.GenericEntityException: 
org.apache.ofbiz.entity.GenericEntityException: Error while inserting: 
[GenericEntity:AgreementRole][agreementId,AGR_SALES(java.lang.String)][createdStamp,2021-11-04
 11:14:26.779(java.sql.Timestamp)][createdTxStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][lastUpdatedStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][lastUpdatedTxStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][partyId,DemoEmployee(java.lang.String)][roleTypeId,PACKER(java.lang.String)]
 (SQL Exception while executing the following:INSERT INTO OFBIZ.AGREEMENT_ROLE 
(AGREEMENT_ID, PARTY_ID, ROLE_TYPE_ID, LAST_UPDATED_STAMP, 
LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, 
?, ?) (INSERT on table 'AGREEMENT_ROLE' caused a violation of foreign key 
constraint 'AGRMNT_ROLE_PRLE' for key (DemoEmployee,PACKER). The statement has 
been rolled back.)) (Error while inserting: 
[GenericEntity:AgreementRole][agreementId,AGR_SALES(java.lang.String)][createdStamp,2021-11-04
 11:14:26.779(java.sql.Timestamp)][createdTxStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][lastUpdatedStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][lastUpdatedTxStamp,2021-11-04 
11:14:26.779(java.sql.Timestamp)][partyId,DemoEmployee(java.lang.String)][roleTypeId,PACKER(java.lang.String)]
 (SQL Exception while executing the following:INSERT INTO OFBIZ.AGREEMENT_ROLE 
(AGREEMENT_ID, PARTY_ID, ROLE_TYPE_ID, LAST_UPDATED_STAMP, 
LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, 
?, ?) (INSERT on table 'AGREEMENT_ROLE' caused a violation of foreign key 
constraint 'AGRMNT_ROLE_PRLE' for key (DemoEmployee,PACKER). The statement has 
been rolled back.)))
{code}
The error message is valid, as the selected party doesn't have the selected 
role assigned to him. 

Even though it is questionable whether a party should be assigned to the role 
of PACKER on an agreement (and lets for the sake of the argument accept that it 
is a valid choice), the user then needs to ensure that the party gets the role 
before the agreement role can be established.




 


> Handling of Agreement Role(s)
> -----------------------------
>
>                 Key: OFBIZ-5996
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5996
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: accounting
>    Affects Versions: Trunk
>            Reporter: Pierre Smits
>            Assignee: Pierre Smits
>            Priority: Major
>              Labels: agreement(s), role, roles
>
> The roles screen on an agreement enable the user to add any party into any 
> role on the agreement. 
> An example, user bizadmin can select party DemoEmployee for role PACKER and 
> try to persist this agreement role. This leads to an error, like below:
> {code:java}
> The Following Errors Occurred:Error doing entity-auto operation for entity 
> AgreementRole in service createAgreementRole: 
> org.apache.ofbiz.entity.GenericEntityException: 
> org.apache.ofbiz.entity.GenericEntityException: Error while inserting: 
> [GenericEntity:AgreementRole][agreementId,AGR_SALES(java.lang.String)][createdStamp,2021-11-04
>  11:14:26.779(java.sql.Timestamp)][createdTxStamp,2021-11-04 
> 11:14:26.779(java.sql.Timestamp)][lastUpdatedStamp,2021-11-04 
> 11:14:26.779(java.sql.Timestamp)][lastUpdatedTxStamp,2021-11-04 
> 11:14:26.779(java.sql.Timestamp)][partyId,DemoEmployee(java.lang.String)][roleTypeId,PACKER(java.lang.String)]
>  (SQL Exception while executing the following:INSERT INTO 
> OFBIZ.AGREEMENT_ROLE (AGREEMENT_ID, PARTY_ID, ROLE_TYPE_ID, 
> LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) 
> VALUES (?, ?, ?, ?, ?, ?, ?) (INSERT on table 'AGREEMENT_ROLE' caused a 
> violation of foreign key constraint 'AGRMNT_ROLE_PRLE' for key 
> (DemoEmployee,PACKER). The statement has been rolled back.)) (Error while 
> inserting: 
> [GenericEntity:AgreementRole][agreementId,AGR_SALES(java.lang.String)][createdStamp,2021-11-04
>  11:14:26.779(java.sql.Timestamp)][createdTxStamp,2021-11-04 
> 11:14:26.779(java.sql.Timestamp)][lastUpdatedStamp,2021-11-04 
> 11:14:26.779(java.sql.Timestamp)][lastUpdatedTxStamp,2021-11-04 
> 11:14:26.779(java.sql.Timestamp)][partyId,DemoEmployee(java.lang.String)][roleTypeId,PACKER(java.lang.String)]
>  (SQL Exception while executing the following:INSERT INTO 
> OFBIZ.AGREEMENT_ROLE (AGREEMENT_ID, PARTY_ID, ROLE_TYPE_ID, 
> LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) 
> VALUES (?, ?, ?, ?, ?, ?, ?) (INSERT on table 'AGREEMENT_ROLE' caused a 
> violation of foreign key constraint 'AGRMNT_ROLE_PRLE' for key 
> (DemoEmployee,PACKER). The statement has been rolled back.)))
> {code}
> The error message is valid, as the selected party doesn't have the selected 
> role assigned to him. But undesirable.
> Even though it is questionable whether a party should be assigned to the role 
> of PACKER on an agreement (and lets for the sake of the argument accept that 
> it is a valid choice), the user then needs to ensure that the party gets the 
> role before the agreement role can be established.
> In order to mitigate this, the user should be only capable to:
> 1. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to