Author: apatel
Date: Tue Jul 14 16:39:25 2009 New Revision: 793969 URL: http://svn.apache.org/viewvc?rev=793969&view=rev Log: Add statusId field to the FinAccountTrans entity and verify that existing functionality is not broken. Patch from Jira issue #OFBIZ-2720 Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml ofbiz/trunk/applications/accounting/servicedef/secas.xml ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?rev=793969&r1=793968&r2=793969&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original) +++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Tue Jul 14 16:39:25 2009 @@ -113,6 +113,9 @@ <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"/> Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=793969&r1=793968&r2=793969&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Tue Jul 14 16:39:25 2009 @@ -462,6 +462,7 @@ <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 @@ <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> Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml?rev=793969&r1=793968&r2=793969&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml Tue Jul 14 16:39:25 2009 @@ -173,7 +173,9 @@ <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 @@ <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> Modified: ofbiz/trunk/applications/accounting/servicedef/secas.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas.xml?rev=793969&r1=793968&r2=793969&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/secas.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/secas.xml Tue Jul 14 16:39:25 2009 @@ -136,6 +136,7 @@ <!-- <eca service="createFinAccountTrans" event="commit"> + <condition-field field-name="statusId" operator="equals" value="FINACT_TRNS_APPROVED"/> <action service="postFinAccountTransToGl" mode="sync"/> </eca> --> Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?rev=793969&r1=793968&r2=793969&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Tue Jul 14 16:39:25 2009 @@ -376,4 +376,13 @@ <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> Modified: ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml?rev=793969&r1=793968&r2=793969&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml Tue Jul 14 16:39:25 2009 @@ -188,6 +188,13 @@ <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> |
Free forum by Nabble | Edit this page |