Hans,

It has been discussed a bit recently, but I know it's easy to miss so I'm 
writing to remind you...

Whenever changing a primary key for an entity we need to follow the Deprecation 
Pattern described in this document:

http://docs.ofbiz.org/display/OFBTECH/General+Entity+Overview

The upgrade path needs to be something more than a manual upgrade like this.

What's more, this should have been explicitly discussed on the mailing list so that others could more easily share their thoughts and opinions.

For example, why not just have different RateTypes for the different currencies, why do we need it explicitly on the entity? And even if we need or want it on the entity, why does it have to be part of the primary key?

-David


[EMAIL PROTECTED] wrote:
Author: hansbak
Date: Mon Aug 25 07:54:27 2008
New Revision: 688741

URL: http://svn.apache.org/viewvc?rev=688741&view=rev
Log:
OFBIZ-1927: add currency to partyRate entity. because this is relatively small 
entity, export the content add the currency to the exported file, drop the 
table, restart the system,  and import the export file

Modified:
    ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml
    ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml
    
ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml

Modified: ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml?rev=688741&r1=688740&r2=688741&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml 
(original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml Mon Aug 
25 07:54:27 2008
@@ -291,6 +291,9 @@
     <!-- PartyRate -->
     <form name="AddPartyRate" type="single" target="createPartyRate"
         focus-field-name="rateTypeId" header-row-style="header-row" 
default-table-style="basic-table">
+        <actions>
+            <property-to-field field="defaultCurrencyUomId" resource="general" 
property="currency.uom.id.default" default="USD"/>
+        </actions>
         <auto-fields-service service-name="createPartyRate"/>
         <field name="partyId"><hidden/></field>
         <field name="rateTypeId" title="${uiLabelMap.TimesheetRateType}">
@@ -306,6 +309,14 @@
                 <option key="Y"/>
             </drop-down>
         </field>
+        <field name="currencyUomId" title="${uiLabelMap.ProductCurrencyUomId}">
+            <drop-down allow-empty="false" 
no-current-selected-key="${defaultCurrencyUomId}">
+                <entity-options key-field-name="uomId" description="${abbreviation} - 
${description}" entity-name="Uom">
+                    <entity-constraint name="uomTypeId" operator="equals" 
value="CURRENCY_MEASURE"/>
+                    <entity-order-by field-name="abbreviation"/>
+                </entity-options>
+            </drop-down>
+        </field>
         <field name="submitButton" title="${uiLabelMap.CommonCreate}"><submit 
button-type="button"/></field>
     </form>
@@ -322,9 +333,10 @@
         <field name="partyId"><hidden/></field>
         <field name="rateTypeId" title="${uiLabelMap.TimesheetRateType}"><display-entity 
entity-name="RateType" also-hidden="true"/></field>
         <field name="fromDate" 
title="${uiLabelMap.CommonFromDateTime}"><display/></field>
+        <field name="currencyUomId"><display-entity entity-name="Uom" key-field-name="uomId" 
description="${description}"/></field>
         <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit 
button-type="button"/></field>
         <field name="deleteLink" title="${uiLabelMap.CommonEmptyHeader}" 
widget-style="smallSubmit">
-            <hyperlink 
target="deletePartyRate?partyId=${partyId}&amp;rateTypeId=${rateTypeId}&amp;fromDate=${fromDate}"
+            <hyperlink 
target="deletePartyRate?partyId=${partyId}&amp;rateTypeId=${rateTypeId}&amp;currencyUomId=${currencyUomId}&amp;fromDate=${fromDate}"
                 description="${uiLabelMap.CommonDelete}" also-hidden="false"/>
         </field>
     </form>

Modified: ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml?rev=688741&r1=688740&r2=688741&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml Mon Aug 25 
07:54:27 2008
@@ -46,12 +46,14 @@
             title="Party Rate Entity">
       <field name="partyId" type="id-ne"></field>
       <field name="rateTypeId" type="id-ne"></field>
+      <field name="currencyUomId" type="id-ne"/>
       <field name="defaultRate" type="indicator"></field>
       <field name="fromDate" type="date-time"></field>
       <field name="thruDate" type="date-time"></field>
       <field name="rate" type="currency-amount"></field>
       <prim-key field="partyId"/>
       <prim-key field="rateTypeId"/>
+      <prim-key field="currencyUomId"/>
       <prim-key field="fromDate"/>
       <relation type="one" fk-name="PRTY_RTE_PRTY" rel-entity-name="Party">
         <key-map field-name="partyId"/>
@@ -59,6 +61,9 @@
       <relation type="one" fk-name="PRTY_RTE_RTTP" rel-entity-name="RateType">
         <key-map field-name="rateTypeId"/>
       </relation>
+      <relation type="one" fk-name="PARTY_RATE_CUOM" title="Currency" 
rel-entity-name="Uom">
+        <key-map field-name="currencyUomId" rel-field-name="uomId"/>
+      </relation>
     </entity>
     <entity entity-name="RateType"
             package-name="org.ofbiz.workeffort.timesheet"

Modified: 
ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml?rev=688741&r1=688740&r2=688741&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml
 (original)
+++ 
ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml
 Mon Aug 25 07:54:27 2008
@@ -244,10 +244,12 @@
<!-- no rateAmount yet, try PartyRate -->
         <if-empty field="rateAmount">
+            <property-to-field field-name="defaultCurrencyUomId" resource="general" 
property="currency.uom.id.default" default="USD"/>
             <entity-condition entity-name="PartyRate" 
list-name="partyRateList">
                 <condition-list combine="and">
                     <condition-expr field-name="partyId" 
env-name="timeEntry.partyId"/>
                     <condition-expr field-name="rateTypeId" 
env-name="timeEntry.rateTypeId"/>
+                    <condition-expr field-name="currencyUomId" 
env-name="timeEntry.defaultCurrencyUomId"/>
                 </condition-list>
                 <order-by field-name="-fromDate"/>
             </entity-condition>


Reply via email to