Author: apatel
Date: Tue Aug 4 10:15:47 2009 New Revision: 800720 URL: http://svn.apache.org/viewvc?rev=800720&view=rev Log: Keep history of changes to Cost Center config. GlAccountCategoryMember record Update call expires old record and creates new when amount value is changed. Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=800720&r1=800719&r2=800720&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Tue Aug 4 10:15:47 2009 @@ -2431,7 +2431,7 @@ <set field="totalAmountPercentage" type="BigDecimal" value="0"/> - <entity-and entity-name="GlAccountCategoryMember" list="glAccountCategoryMembers"> + <entity-and entity-name="GlAccountCategoryMember" list="glAccountCategoryMembers" filter-by-date="true"> <field-map field-name="glAccountId" from-field="glAccountId"/> </entity-and> <if-not-empty field="glAccountCategoryMembers"> @@ -2441,22 +2441,19 @@ </if-compare-field> </iterate> </if-not-empty> - <if-not-empty field="amountPercentage"> <set field="totalAmountPercentage" value="${totalAmountPercentage + amountPercentage}" type="BigDecimal"/> <if-compare field="totalAmountPercentage" operator="less-equals" value="100" type="BigDecimal"> - <entity-and entity-name="GlAccountCategoryMember" list="glAccountCategoryMembers" use-cache="true"> + <entity-and entity-name="GlAccountCategoryMember" list="glAccountCategoryMemberList" filter-by-date="true"> <field-map field-name="glAccountId" from-field="glAccountId"/> <field-map field-name="glAccountCategoryId" from-field="glAccountCategoryId"/> </entity-and> - <first-from-list list="glAccountCategoryMembers" entry="glAccountCategoryMember"/> + <filter-list-by-date list="glAccountCategoryMemberList"/> + <first-from-list list="glAccountCategoryMemberList" entry="glAccountCategoryMember"/> <if-compare field="glAccountCategoryMember.amountPercentage" operator="not-equals" value="" type="BigDecimal"> - <if-compare-field field="glAccountCategoryMember.amountPercentage" operator="not-equals" to-field="amountPercentage" type="BigDecimal"> - <set-service-fields service-name="updateGlAccountCategoryMember" map="glAccountCategoryMember" to-map="updateGlAccountCategoryMemberMap"/> - <set field="updateGlAccountCategoryMemberMap.amountPercentage" from-field="amountPercentage" type="BigDecimal"/> - <call-service service-name="updateGlAccountCategoryMember" in-map-name="updateGlAccountCategoryMemberMap"/> - <log level="info" message="GlAccountCategoryMember updated for [${glAccountCategoryId}] and [${glAccountId}]"/> - </if-compare-field> + <set-service-fields service-name="updateGlAccountCategoryMember" to-map="updateGlAccountCategoryMemberMap" map="glAccountCategoryMember"/> + <set field="updateGlAccountCategoryMemberMap.amountPercentage" from-field="amountPercentage" type="BigDecimal"/> + <call-service service-name="updateGlAccountCategoryMember" in-map-name="updateGlAccountCategoryMemberMap"/> <else> <set field="createGlAccountCategoryMemberMap.amountPercentage" from-field="amountPercentage" type="BigDecimal"/> <set field="createGlAccountCategoryMemberMap.glAccountCategoryId" from-field="glAccountCategoryId"/> @@ -2466,6 +2463,8 @@ <log level="info" message="GlAccountCategoryMember created for [${glAccountCategoryId}] and [${glAccountId}]"/> </else> </if-compare> + <set field="amountPercentage" value="0" type="BigDecimal"/> + <set field="totalAmountPercentage" value="0" type="BigDecimal"/> <else> <add-error><fail-property resource="AccountingUiLabels" property="AccountingTotalAmountPercentageIsGreaterThenOneHundred"/></add-error> <check-errors/> @@ -2473,4 +2472,20 @@ </if-compare> </if-not-empty> </simple-method> + + <simple-method method-name="updateGlAccountCategoryMember" short-description="Update GL Account Category Member"> + <if-not-empty field="parameters.amountPercentage"> + <entity-one entity-name="GlAccountCategoryMember" value-field="lookedUpValue"/> + <if-compare-field field="lookedUpValue.amountPercentage" operator="not-equals" to-field="parameters.amountPercentage" type="BigDecimal"> + <clone-value value-field="lookedUpValue" new-value-field="newLookedUpValue"/> + <now-timestamp field="lookedUpValue.thruDate"/> + <store-value value-field="lookedUpValue"/> + + <set field="newLookedUpValue.amountPercentage" from-field="parameters.amountPercentage" type="BigDecimal"/> + <now-timestamp field="newLookedUpValue.fromDate"/> + <create-value value-field="newLookedUpValue"/> + <log level="info" message="GlAccountCategoryMember updated for [${glAccountCategoryId}] and [${glAccountId}]"/> + </if-compare-field> + </if-not-empty> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=800720&r1=800719&r2=800720&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Tue Aug 4 10:15:47 2009 @@ -630,7 +630,8 @@ <description>Delete GL Account Category Member</description> <auto-attributes include="pk" mode="IN" optional="false"/> </service> - <service name="updateGlAccountCategoryMember" engine="entity-auto" default-entity-name="GlAccountCategoryMember" invoke="update" auth="true"> + <service name="updateGlAccountCategoryMember" engine="simple" default-entity-name="GlAccountCategoryMember" + location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="updateGlAccountCategoryMember" auth="true"> <description>Update GL Account Category Member</description> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> Modified: ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl?rev=800720&r1=800719&r2=800720&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl Tue Aug 4 10:15:47 2009 @@ -45,14 +45,14 @@ <input type="hidden" id="glAccountId_${glAccountOrganization.glAccountId}" name="glAccountId_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${glAccountOrganization.glAccountId!}"/> <input type="hidden" id="glAccountCategoryId_${glAccountCategory.glAccountCategoryId}_${glAccountOrganization.glAccountId}" name="glAccountCategoryId_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${(glAccountCategory.glAccountCategoryId!)}"/> - <#assign glAccountCategoryMembers = delegator.findByAnd("GlAccountCategoryMember", {"glAccountId" : glAccountOrganization.glAccountId, "glAccountCategoryId" : glAccountCategory.glAccountCategoryId})/> + <#assign glAccountCategoryMembers = delegator.findByAnd("GlAccountCategoryMember", {"glAccountId" : glAccountOrganization.glAccountId, "glAccountCategoryId" : glAccountCategory.glAccountCategoryId, "thruDate" : null}, Static["org.ofbiz.base.util.UtilMisc"].toList("fromDate"))/> <#if glAccountCategoryMembers?has_content> <#assign glAccountCategoryMember = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(glAccountCategoryMembers)/> </#if> <#if glAccountCategoryMember != null> <input type="text" id="amountPercentage_${glAccountCategory.glAccountCategoryId}_${glAccountOrganization.glAccountId}" name="amountPercentage_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${(glAccountCategoryMember.amountPercentage!)}"/> <#else> - <input type="text" id="amountPercentage_${glAccountCategory.glAccountCategoryId}_${glAccountOrganization.glAccountId}" name="amountPercentage_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${(glAccountCategoryMember.amountPercentage!)}"/> + <input type="text" id="amountPercentage_${glAccountCategory.glAccountCategoryId}_${glAccountOrganization.glAccountId}" name="amountPercentage_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value=""/> </#if> <input name="_rowSubmit_o_${glAccountOrganizationIndex}${glAccountCategory_index}" type="hidden" value="Y"/> </td> Modified: ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml?rev=800720&r1=800719&r2=800720&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml Tue Aug 4 10:15:47 2009 @@ -1081,13 +1081,17 @@ </actions> <auto-fields-entity entity-name="GlAccountCategoryMember" default-field-type="edit"/> <field name="glAccountId"><display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${glAccountId}-${accountName}"/></field> - <field name="glAccountCategoryId"><display/></field> + <field name="glAccountCategoryId"><display-entity entity-name="GlAccountCategory"/></field> + <field name="fromDate"><display/></field> + <field name="thruDate"><date-time/></field> <field name="deleteLink" title="" widget-style="buttontext"> <hyperlink target="deleteGlAccountCategoryMember" description="${uiLabelMap.CommonDelete}" also-hidden="false"> <parameter param-name="glAccountId" from-field="glAccountId"/> <parameter param-name="glAccountCategoryId" from-field="glAccountCategoryId"/> + <parameter param-name="fromDate" from-field="fromDate"/> </hyperlink> </field> + <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field> </form> |
Free forum by Nabble | Edit this page |