Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-7135

Adding role for a party show error on the second add

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Trunk
    • Fix Version/s: 16.11.01
    • Component/s: party
    • Labels:

      Description

      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

      1. OFBIZ-7135.patch
        3 kB
        Montalbano Florian

        Issue Links

          Activity

          Hide
          soledad Nicolas Malin added a comment -

          Thanks Florian your patch is present on trunk at revision 1761323

          Show
          soledad Nicolas Malin added a comment - Thanks Florian your patch is present on trunk at revision 1761323
          Hide
          Florian M Montalbano Florian added a comment -

          Hi,
          I checked the issue OFBIZ-6746. It is the same root problem but in this current issue, the target used in the forms were some kind of "hack" that doesn't seem necessary here. In the other issue, the need is at another level.

          I'm going over this issue with now a little more experience, and the patch provided seems to work well for resolving the add role problem.

          Any review is welcomed !
          Thanks.

          Show
          Florian M Montalbano Florian added a comment - Hi, I checked the issue OFBIZ-6746 . It is the same root problem but in this current issue, the target used in the forms were some kind of "hack" that doesn't seem necessary here. In the other issue, the need is at another level. I'm going over this issue with now a little more experience, and the patch provided seems to work well for resolving the add role problem. Any review is welcomed ! Thanks.
          Hide
          deepak.dixit Deepak Dixit added a comment -

          I think its related to OFBIZ-6746

          Show
          deepak.dixit Deepak Dixit added a comment - I think its related to OFBIZ-6746
          Hide
          Florian M Montalbano Florian added a comment -

          A first try for a patch solution

          Show
          Florian M Montalbano Florian added a comment - A first try for a patch solution

            People

            • Assignee:
              soledad Nicolas Malin
              Reporter:
              Florian M Montalbano Florian
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development