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

ofbizsetup cannot create first customer. problem with state/province dropdown

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Trunk
    • Fix Version/s: 16.11.04
    • Component/s: commonext
    • Labels:
      None
    • Sprint:
      Bug Crush Event - 21/2/2015

      Description

      -use empty database.
      -go to url. https://localhost:8443/ofbizsetup/control/firstcustomer

      notice that when entering the postal address, the state/province dropdown is empty and remains empty regardless of selection of the country dropdown.

        Activity

        Hide
        pfm.smits Pierre Smits added a comment -

        That is what you get when working with an empty database. In order to have certain functions to work properly at least some setup data (seed, init, ext) is required.

        Show
        pfm.smits Pierre Smits added a comment - That is what you get when working with an empty database. In order to have certain functions to work properly at least some setup data (seed, init, ext) is required.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Should we not close as invalid?

        Show
        jacques.le.roux Jacques Le Roux added a comment - Should we not close as invalid?
        Hide
        wt Wai added a comment -

        I should have been more clear about the reported issue.
        The database had been loaded with seed ,and seed-initial data.
        in https://localhost:8443/ofbizsetup
        I had already created the following:
        party for the enterprise
        associated facility
        associated product store
        associated website

        The issue surfaces when I'm trying to create the 1st customer.
        In this form, the province/state dropdown was not auto-filled when the country dropdown is used.

        On further investigation, the origin of the issue comes from the initial data for configuring the javascript, in common/webcommon/includes/setDependentDropdownValuesJs.ftl, to be used with the forms NewCustomer and NewUser. Where NewCustomer subclasses NewUser.

        Since the dropdowns in question are defined in NewUser (which uses a difference prefix label for its controls then NewCustomer), the configured data for the javascript code failed to identify the appropriate dropdown controls in NewUser.

        Show
        wt Wai added a comment - I should have been more clear about the reported issue. The database had been loaded with seed ,and seed-initial data. in https://localhost:8443/ofbizsetup I had already created the following: party for the enterprise associated facility associated product store associated website The issue surfaces when I'm trying to create the 1st customer. In this form, the province/state dropdown was not auto-filled when the country dropdown is used. On further investigation, the origin of the issue comes from the initial data for configuring the javascript, in common/webcommon/includes/setDependentDropdownValuesJs.ftl, to be used with the forms NewCustomer and NewUser. Where NewCustomer subclasses NewUser. Since the dropdowns in question are defined in NewUser (which uses a difference prefix label for its controls then NewCustomer), the configured data for the javascript code failed to identify the appropriate dropdown controls in NewUser.
        Hide
        redcat Oleg Andreyev added a comment - - edited

        I have attached the solution for this problem. As the author correctly mention this form inherit country/state fields from NewUser. As result the form has id="NewCustomer" but fields has ids based on NewUser_.

        The script generated by setDependentDropdownValuesJs.ftl can work if both fields and form ids based on the same name. But it seems jQuery('#${dependentForm}').length in the script way redundant and it works nicely without it. See the patch.

        16.11 is affected too.

        Show
        redcat Oleg Andreyev added a comment - - edited I have attached the solution for this problem. As the author correctly mention this form inherit country/state fields from NewUser. As result the form has id="NewCustomer" but fields has ids based on NewUser_. The script generated by setDependentDropdownValuesJs.ftl can work if both fields and form ids based on the same name. But it seems jQuery('#${dependentForm}').length in the script way redundant and it works nicely without it. See the patch. 16.11 is affected too.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        The script generated by setDependentDropdownValuesJs.ftl can work if both fields and form ids based on the same name. But it seems jQuery('#${dependentForm}').length in the script way redundant and it works nicely without it. See the patch.

        Please Oleg, check OFBIZ-7130 before we get this way, thanks

        Show
        jacques.le.roux Jacques Le Roux added a comment - The script generated by setDependentDropdownValuesJs.ftl can work if both fields and form ids based on the same name. But it seems jQuery('#${dependentForm}').length in the script way redundant and it works nicely without it. See the patch. Please Oleg, check OFBIZ-7130 before we get this way, thanks
        Hide
        redcat Oleg Andreyev added a comment -

        Hi Jacques,

        I saw this code and my change does not in a conflict with it. Initially, it was like "if the form exists" then OFBIZ-7130 add a clause and it becomes "if form and the field of this form both exist". My change simplifies it to "if a field of the form exists". As I understand the code and how jquery works it does not break anything but fix the issue.

        I did quick tests in party profile (including creating an email - OFBIZ-7130 situation) and in quick checkout from. The change doesn't break them. So, I think the fix is quite safe.

        Personally, I think it would better to make changes in the framework to settle this problem with ids. I mean if we create new form A by inheritance from form B then fields inherited from B must have ids based on A. It looks justified. But such a solution would be overkill for this particular issue. Which I don't like just because it spoils the first impression when a newbie tries to explore a new system following the documentation.

        Show
        redcat Oleg Andreyev added a comment - Hi Jacques, I saw this code and my change does not in a conflict with it. Initially, it was like "if the form exists" then OFBIZ-7130 add a clause and it becomes "if form and the field of this form both exist". My change simplifies it to "if a field of the form exists". As I understand the code and how jquery works it does not break anything but fix the issue. I did quick tests in party profile (including creating an email - OFBIZ-7130 situation) and in quick checkout from. The change doesn't break them. So, I think the fix is quite safe. Personally, I think it would better to make changes in the framework to settle this problem with ids. I mean if we create new form A by inheritance from form B then fields inherited from B must have ids based on A. It looks justified. But such a solution would be overkill for this particular issue. Which I don't like just because it spoils the first impression when a newbie tries to explore a new system following the documentation.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Thanks Oleg,

        I did not check/test myself but what you say makes sense. I'll have a deeper look ASAP.

        Show
        jacques.le.roux Jacques Le Roux added a comment - Thanks Oleg, I did not check/test myself but what you say makes sense. I'll have a deeper look ASAP.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Thanks Wai, Oleg,

        Oleg your patch is in
        Trunk r1813833
        R16.11 r1813834

        Because of conflict, In R16.11 I only appled the fix not the SetDependentDropdownValuesJs.ftl improvement

        Show
        jacques.le.roux Jacques Le Roux added a comment - Thanks Wai, Oleg, Oleg your patch is in Trunk r1813833 R16.11 r1813834 Because of conflict, In R16.11 I only appled the fix not the SetDependentDropdownValuesJs.ftl improvement

          People

          • Assignee:
            jacques.le.roux Jacques Le Roux
            Reporter:
            wt Wai
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development

                Agile