Add statusId field to the FinAccountTrans entity and verify that existing functionality is not broken. Patch from Jira issue #OFBIZ-2720

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@793969 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anil Patel
2009-07-14 16:39:25 +00:00
parent 3f2d963f91
commit 2cf53b438e
6 changed files with 37 additions and 1 deletions
@@ -113,6 +113,9 @@ under the License.
<StatusValidChange condition="" statusId="FNACT_NEGPENDREPL" statusIdTo="FNACT_CANCELLED" transitionName="Cancel"/>
<StatusValidChange condition="" statusId="FNACT_MANFROZEN" statusIdTo="FNACT_ACTIVE" transitionName="Re-activate"/>
<StatusValidChange condition="" statusId="FNACT_MANFROZEN" statusIdTo="FNACT_CANCELLED" transitionName="Cancel"/>
<StatusType statusTypeId="FINACT_TRNS_STATUS" description="Financial Account Trans Status" hasTable="N" parentTypeId=""/>
<StatusItem statusId="FINACT_TRNS_APPROVED" statusTypeId="FINACT_TRNS_STATUS" statusCode="APPROVED" sequenceId="11" description="Approved"/>
<StatusItem statusId="FINACT_TRNS_CREATED" statusTypeId="FINACT_TRNS_STATUS" statusCode="CREATED" sequenceId="12" description="Created"/>
<!-- FinAccount Reasons for Purchase & Replenish -->
<EnumerationType description="Service Debit Reasons" enumTypeId="FINACCT_TRANS_REASON" parentTypeId="" hasTable="N"/>
@@ -462,6 +462,7 @@ under the License.
<field name="performedByPartyId" type="id"></field>
<field name="reasonEnumId" type="id"></field>
<field name="comments" type="comment"></field>
<field name="statusId" type="id"></field>
<prim-key field="finAccountTransId"/>
<relation type="one" fk-name="FINACCT_TX_TYPE" rel-entity-name="FinAccountTransType">
<key-map field-name="finAccountTransTypeId"/>
@@ -488,6 +489,9 @@ under the License.
<relation type="one" fk-name="FIN_ACT_REAS_ENUM" title="Reason" rel-entity-name="Enumeration">
<key-map field-name="reasonEnumId" rel-field-name="enumId"/>
</relation>
<relation type="one" fk-name="FIN_ACT_TX_STI" rel-entity-name="StatusItem">
<key-map field-name="statusId"/>
</relation>
</entity>
<entity entity-name="FinAccountTransAttribute" package-name="org.ofbiz.accounting.finaccount" title="Financial Account Transaction Attribute Entity">
<field name="finAccountTransId" type="id-ne"></field>
@@ -173,7 +173,9 @@ under the License.
<if-empty field="newEntity.entryDate">
<set from-field="nowTimestamp" field="newEntity.entryDate"/>
</if-empty>
<if-empty field="newEntity.statusId">
<set field="newEntity.statusId" value="FINACT_TRNS_APPROVED"/>
</if-empty>
<set field="newEntity.performedByPartyId" from-field="userLogin.partyId"/>
<!-- make sure the amount is a sane number -->
@@ -362,4 +364,14 @@ under the License.
<entity-one entity-name="VarianceReasonGlAccount" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="migrateStatusToFinAccountTrans" short-description="Migrate statusId to FinAccountTrans entity">
<entity-condition entity-name="FinAccountTrans" list="finAccountTransList"/>
<iterate list="finAccountTransList" entry="finAccountTrans">
<if-empty field="finAccountTrans.statusId">
<set field="finAccountTrans.statusId" value="FINACT_TRNS_APPROVED"/>
<store-value value-field="finAccountTrans"/>
</if-empty>
</iterate>
</simple-method>
</simple-methods>
@@ -136,6 +136,7 @@ under the License.
<!--
<eca service="createFinAccountTrans" event="commit">
<condition-field field-name="statusId" operator="equals" value="FINACT_TRNS_APPROVED"/>
<action service="postFinAccountTransToGl" mode="sync"/>
</eca>
-->
@@ -376,4 +376,13 @@ under the License.
<implements service="permissionInterface"/>
</service>
<service name="migrateStatusToFinAccountTrans" engine="simple"
location="component://accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="migrateStatusToFinAccountTrans">
<description>
Migrate statusId to FinAccountTrans entity,
this service can be used to upgrade existing data i.e it sets the statusId(new field in entity) to "Approved" if found empty.
Before running this service, load the seed data for StatusType and StatusItem from the file :
accounting/data/AccountingTypeData.xml
</description>
</service>
</services>
@@ -188,6 +188,13 @@ under the License.
<field name="entryDate"><date-time/></field>
<field name="paymentId"><lookup target-form-name="LookupPayment"/></field>
<field name="orderId"><lookup target-form-name="LookupOrderHeader"/></field>
<field name="statusId" title="${uiLabelMap.CommonStatus}">
<drop-down allow-empty="true">
<entity-options entity-name="StatusItem" description="${description}">
<entity-constraint name="statusTypeId" value="FINACT_TRNS_STATUS"/>
</entity-options>
</drop-down>
</field>
<field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>