OFBiz
  1. OFBiz
  2. OFBIZ-2813

ProductStore did not allow the default timezone to be set

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Implemented
    • Affects Version/s: Trunk
    • Fix Version/s: Upcoming Branch
    • Component/s: product
    • Labels:
      None
    • Sprint:
      Bug Crush Event - 21/2/2015

      Description

      The ProductStore has the defaultLocaleString and the defaultCurrencyUomId but does not have a defaultTimeZoneString. What happens when a store is selected (from e-commerce or the pos) is that it will look to the user for a lastTimeZone and if that is not set, it would simply revert to the TimeZone.getDefault() (so the timezone based on the server).

      The trouble we had was that you may have an application server that is running in a completely different timezone than what is desired for the store.

      I will be attaching a patch to this ticket with changes related to this improvement.

      1. OFBIZ-2813.patch
        14 kB
        Jacques Le Roux
      2. OFBIZ-2813.patch
        16 kB
        Jacques Le Roux
      3. OFBIZ-2813.patch
        12 kB
        Jacques Le Roux
      4. OFBIZ-2813.patch
        12 kB
        Jacques Le Roux
      5. OFBIZ-2813.patch
        12 kB
        Jacques Le Roux
      6. OFBIZ-2813.patch
        12 kB
        Bob Morley

        Activity

        Hide
        Bob Morley added a comment -

        OFBIZ-2813 contains the improvements. In brief, the entity has the new attribute, the form was updated to put it in the proper group (add/edit), various utility methods that get timezone were enhanced to try to get it from the product store (instead of going right to the system default)

        Show
        Bob Morley added a comment - OFBIZ-2813 contains the improvements. In brief, the entity has the new attribute, the form was updated to put it in the proper group (add/edit), various utility methods that get timezone were enhanced to try to get it from the product store (instead of going right to the system default)
        Hide
        Adrian Crum added a comment -

        Bob,

        There is a setting available to set the default time zone - look for start.properties. If you need a single OFBiz instance to pretend to be in different time zones based on the product store, then your proposal might be worth looking into.

        Show
        Adrian Crum added a comment - Bob, There is a setting available to set the default time zone - look for start.properties. If you need a single OFBiz instance to pretend to be in different time zones based on the product store, then your proposal might be worth looking into.
        Hide
        Bob Morley added a comment -

        Adrian,

        Thank you very much for your quick comment – I appreciate it! In this JIRA I am trying to expand the functionality in Ofbiz which is driven from our system requirements – specifically, we have implemented multi-tenancy so we absolutely have multiple customers using the same application server (and definition in different timezones). Now interestingly enough, our requirement would actually be more at the "Company" level – but in doing some research I noticed what I thought was a shortcoming in the ProductStore setup. To be honest I did not know about this setting, but did know it was installation based.

        So, I think in a multi-tenant situation you would definitely want to expose this value somewhere on an entity that was not the userLogin. But even before that, I think it is reasonable to suggest that you may have a Company that has multiple stores and spans more than one timezone where you would want this type of configuration. Would you buy that? In this fix I have tried to follow the #1 premise (do no harm) so I have elected not to seed this attribute and allow it to pass through as it does now (userLogin -> productStore -> System Default).

        Thoughts?

        Show
        Bob Morley added a comment - Adrian, Thank you very much for your quick comment – I appreciate it! In this JIRA I am trying to expand the functionality in Ofbiz which is driven from our system requirements – specifically, we have implemented multi-tenancy so we absolutely have multiple customers using the same application server (and definition in different timezones). Now interestingly enough, our requirement would actually be more at the "Company" level – but in doing some research I noticed what I thought was a shortcoming in the ProductStore setup. To be honest I did not know about this setting, but did know it was installation based. So, I think in a multi-tenant situation you would definitely want to expose this value somewhere on an entity that was not the userLogin. But even before that, I think it is reasonable to suggest that you may have a Company that has multiple stores and spans more than one timezone where you would want this type of configuration. Would you buy that? In this fix I have tried to follow the #1 premise (do no harm) so I have elected not to seed this attribute and allow it to pass through as it does now (userLogin -> productStore -> System Default). Thoughts?
        Hide
        David E. Jones added a comment -

        As a side bonus, it is also much more consistent with the other settings...

        Show
        David E. Jones added a comment - As a side bonus, it is also much more consistent with the other settings...
        Hide
        Jacques Le Roux added a comment -

        Is this issue still relevant with the OOTB multi-tenancy?

        Show
        Jacques Le Roux added a comment - Is this issue still relevant with the OOTB multi-tenancy?
        Hide
        Bob Morley added a comment -

        Yes, I believe it is more relevant because in a multi-tenant deployment you are more likely to have product stores (across your tenants) that have different time zones.

        Show
        Bob Morley added a comment - Yes, I believe it is more relevant because in a multi-tenant deployment you are more likely to have product stores (across your tenants) that have different time zones.
        Hide
        Jacques Le Roux added a comment -

        Here is attachec an updated and amended version of the patch.

        I have removed the
        <sort-field name="X"/>
        line in applications/product/webapp/catalog/store/ProductStoreForms.xml which I have renamed applications/product/widget/catalog/ProductStoreForms.xml (it has certainly moved did not check anyway it works then)

        I think we should take into account Adrian's remark in getTimeZone (at the end use ofbiz.timeZone.default if it exist)

        Show
        Jacques Le Roux added a comment - Here is attachec an updated and amended version of the patch. I have removed the <sort-field name="X"/> line in applications/product/webapp/catalog/store/ProductStoreForms.xml which I have renamed applications/product/widget/catalog/ProductStoreForms.xml (it has certainly moved did not check anyway it works then) I think we should take into account Adrian's remark in getTimeZone (at the end use ofbiz.timeZone.default if it exist)
        Hide
        Jacques Le Roux added a comment -

        Hi David, I want to commit Bob's work.
        But it's unclear to me: what is

        much more consistent with the other settings...

        ?

        It seems to me that the property in start.properties

        # -- The default time zone for this OFBiz instance.
        #ofbiz.timeZone.default=GMT
        

        Can only set 1 time zone and, as Bob explained above, an instance may need more than 1 time zone

        Show
        Jacques Le Roux added a comment - Hi David, I want to commit Bob's work. But it's unclear to me: what is much more consistent with the other settings... ? It seems to me that the property in start.properties # -- The default time zone for this OFBiz instance. #ofbiz.timeZone. default =GMT Can only set 1 time zone and, as Bob explained above, an instance may need more than 1 time zone
        Hide
        Jacques Le Roux added a comment -

        Patch updated against trunk HEAD

        Show
        Jacques Le Roux added a comment - Patch updated against trunk HEAD
        Hide
        Jacques Le Roux added a comment -

        New patch again, Iin previous forgot to remove the <sort-field name="X"/> as I wrote in one of my last comments

        Show
        Jacques Le Roux added a comment - New patch again, Iin previous forgot to remove the <sort-field name="X"/> as I wrote in one of my last comments
        Hide
        Jacques Le Roux added a comment -

        About
        >I think we should take into account Adrian's remark in getTimeZone (at the end use ofbiz.timeZone.default if it exist)

        That's not necessary since it's anyway done in Config.java during startup.

        Show
        Jacques Le Roux added a comment - About >I think we should take into account Adrian's remark in getTimeZone (at the end use ofbiz.timeZone.default if it exist) That's not necessary since it's anyway done in Config.java during startup.
        Hide
        Jacques Le Roux added a comment -

        OK w/o comments I will commit this soon...

        Show
        Jacques Le Roux added a comment - OK w/o comments I will commit this soon...
        Hide
        Jacques Le Roux added a comment - - edited

        I will add labels but no data, so the default will be the local timezone as it's now.

        Show
        Jacques Le Roux added a comment - - edited I will add labels but no data, so the default will be the local timezone as it's now.
        Hide
        Jacques Le Roux added a comment -

        New patch w/ labels

        Show
        Jacques Le Roux added a comment - New patch w/ labels
        Hide
        Jacques Le Roux added a comment -

        Fixes labels typos

        Show
        Jacques Le Roux added a comment - Fixes labels typos
        Hide
        Jacques Le Roux added a comment -

        Thanks Bob,

        Your patch is commited at revision: 1712347

        Show
        Jacques Le Roux added a comment - Thanks Bob, Your patch is commited at revision: 1712347

          People

          • Assignee:
            Jacques Le Roux
            Reporter:
            Bob Morley
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development

                Agile