Upgrading from opentaps 1.0 to opentaps 1.4

From Opentaps Wiki
Revision as of 23:33, 15 September 2009 by Spark (talk | contribs)
Jump to navigationJump to search

Data Changes

  • Run the service opentaps.setSupplementalDataForAllParties to populate primary contact data for all parties.
  • Configuration of GL accounts for invoice writeoffs have been changed. Instead of using GlAccountTypeDefault, they are now configured with InvoiceAdjustmentGlAccount with the adjustment type "WRITEOFF"
  • If you have custom UI labels, they may be loaded by adding them to LabelConfiguration.properties in opentaps-common/config/
    • If previously you were using UtilMessage.registerLabelMap() to load custom labels, you may now remove all calls to this function as it is no longer needed.
  • Run the upgrade SQL script in hot-deploy/opentaps-common/scripts/sql for the following:
    • ProductAverageCost has been re-factored to use a single productAverageCostId as its primary key. The script will alter the table and automatically fill in its values and update SequenceValueItem so that opentaps will generate correct future keys.
  • Add the following to your custom component's build.xml:
  <fileset dir="${ofbiz.dir}/hot-deploy/opentaps-common/lib" includes="*.jar"/>
  <fileset dir="${ofbiz.dir}/hot-deploy/opentaps-common/lib/hibernate" includes="*.jar"/>
  • Set SupplierProduct.supplierPrefOrderId to 10_MAIN_SUPPL where it is null.

Coding Changes

Changes in the ofbiz framework would require the following changes to your code:

URL Parameter Security

You can no longer pass parameters to a service request directly in the URL. These requests must be part of a POST form. To make buttons work as before, you need to change them to forms and then activate them with javascript. For example, in earlier versions, you could have a button to delete a lead like this:

 <#assign update_options = update_options + "<a class='subMenuButtonDangerous' 
          href='deleteLead?leadPartyId=" + partySummary.partyId + "'>" + uiLabelMap.CommonDelete + "</a>"  />

In opentaps 1.4, you must do it this way:

  <form name="deleteLeadForm" method="post" action="<@ofbizUrl>deleteLead</@ofbizUrl>"/>
     <@inputHidden name="leadPartyId" value="${partySummary.partyId}"/>
  </form>
  <#assign update_options = update_options + "<a class='subMenuButtonDangerous' 
           href='javascript:document.deleteLeadForm.submit()'>" + uiLabelMap.CommonDelete + "</a>"  />

Controller redirects

Redirects have been changed, now request-redirect will only copy the parameters that were in the URL string by default. To forward posted or service output parameter, use the redirect-parameter elements (one per parameter).

  <response name="success" type="request-redirect" value="viewAccount">
      <redirect-parameter name="partyId"/>
  </response>

Also request-redirect-filter-param is now considered deprecated.

Js dateTime format

Js dataTime format in ftl have been changed, now the format will return html encode string which will cause the parse exception, you should use StringUtil.wrapString to avoid this issue. For example, in earlier versions, you could have define a js dataTime format variable like this:

  <#assign dateFormat = Static["org.opentaps.common.util.UtilDate"].getJsDateTimeFormat(Static["org.opentaps.common.util.UtilDate"].getDateFormat(locale))/>

In opentaps 1.4, you must do it this way: <#assign dateFormat = StringUtil.wrapString(Static["org.opentaps.common.util.UtilDate"].getJsDateTimeFormat(Static["org.opentaps.common.util.UtilDate"].getDateFormat(locale)))/>