You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Montalbano Florian (JIRA)" <ji...@apache.org> on 2016/05/27 09:57:12 UTC

[jira] [Created] (OFBIZ-7135) Adding role for a party show error on the second add

Montalbano Florian created OFBIZ-7135:
-----------------------------------------

             Summary: Adding role for a party show error on the second add
                 Key: OFBIZ-7135
                 URL: https://issues.apache.org/jira/browse/OFBIZ-7135
             Project: OFBiz
          Issue Type: Bug
          Components: party
    Affects Versions: Trunk
            Reporter: Montalbano Florian
            Priority: Minor


Hi all,

How to reproduce :
1) Go to the profile of a party and then to the "Role" tab : https://localhost:8443/partymgr/control/viewroles?partyId=admin
2) Add any role
3) Wait for the page to reload
4) Try to add another role
5) Notice the error showing up and the redirection to the "profile" page

Problem : The problem comes from a bad request send. When you select a "main role" (without clicking on the add button), a request is send to get the form for the "secondary role". On the first time, there is no problem, the request is something such as : 
https://localhost:8443/partymgr/control/addsecondaryroles

On the second time, it becomes something like this : 
https://localhost:8443/partymgr/control/addrole/addsecondaryroles

When the controller receives this second request, it does both the "addrole" and the "addsecondaryroles" request. So when you chose a role in the first select, it actually sends a request to add the role before you even click on the "add" button.

Root of the problem :
First, the target of the forms (PartyForms#AddPartyRole, PartyForms#AddPartyMainRole and PartyForms#AddPartySecondaryRole) adding the "main" and "secondary" roles is "addrole/viewroles" (it seems to be the only place in the code where a target is done this way). To clear up the request, I tried to remove the "/viewroles" to match what is done in another case : when a task is added to a project.
It seems to work but I want to know what is your point of view on this.

Then, in the controller, there is a weird redirection to "viewprofile" instead of allowing the user to stay on "viewroles". All of this seems related to an update of the coding way in the project that didn't affect this part yet.

I'll provide a patch that seems to work.

Thanks,
Florian



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)