You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/11/28 17:01:50 UTC
svn commit: r599044 - in /ofbiz/trunk/applications/accounting: config/
script/org/ofbiz/accounting/ledger/ servicedef/ webapp/accounting/WEB-INF/
widget/
Author: jacopoc
Date: Wed Nov 28 08:01:48 2007
New Revision: 599044
URL: http://svn.apache.org/viewvc?rev=599044&view=rev
Log:
Refactored the createAcctgTransAndEntries and postAcctgTrans services to perform different tasks: data preparation is done in createAcctgTransAndEntries, data validation is done in postAcctgTrans.
Added new parameter to postAcctgTrans to perform a validation without posting.
New links to verify/post accounting transactions.
Modified:
ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml
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/WEB-INF/controller.xml
ofbiz/trunk/applications/accounting/widget/GlForms.xml
ofbiz/trunk/applications/accounting/widget/GlScreens.xml
Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties?rev=599044&r1=599043&r2=599044&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties Wed Nov 28 08:01:48 2007
@@ -422,6 +422,7 @@
AccountingUseGiftCardNotOnFile=Use Gift Card Not On File
AccountingUnitPrice=Unit Price
AccountingValidationPattern=Use regular expression validation pattern
+AccountingVerifyTransaction=Verify Transaction
AccountingViewPermissionError=You do not have permission to view this page. ("ACCOUNTING_VIEW" or "ACCOUNTING_ADMIN" needed)
AccountingVisaMastercardAmexDiscover=Credit Card: Visa/Mastercard/Amex/Discover
AccountingFX=Foreign Exchange Rates
Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml?rev=599044&r1=599043&r2=599044&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml Wed Nov 28 08:01:48 2007
@@ -157,7 +157,7 @@
<!-- make sure the AcctgTrans has not already been posted -->
<entity-one entity-name="AcctgTrans" value-name="acctgTrans" auto-field-map="true"/>
<if-compare field-name="acctgTrans.isPosted" operator="equals" value="Y">
- <add-error><fail-message message="AcctgTrans [${parameters.acctgTransId}] has already been posted. Not posting again"/></add-error>
+ <add-error><fail-message message="AcctgTrans [${parameters.acctgTransId}] has already been posted. Not posting again"/></add-error>
</if-compare>
<check-errors/>
@@ -172,7 +172,6 @@
<if-compare field-name="trialBalanceResultMap.debitCreditDifference" operator="less-equals" value="-0.01" type="Double">
<add-error><fail-message message="Not posting GL Accounting Transaction with ID [${parameters.acctgTransId}] because the trial balance failed: Debit Total=${trialBalanceResultMap.debitTotal} Credit Total=${trialBalanceResultMap.creditTotal} Debit/Credit Difference=${trialBalanceResultMap.debitCreditDifference}"/></add-error>
</if-compare>
- <check-errors/>
<entity-condition entity-name="AcctgTransEntry" list-name="acctgTransEntryList">
<condition-expr field-name="acctgTransId" env-name="parameters.acctgTransId"/>
@@ -196,6 +195,7 @@
<set value="FISCAL_BIWEEK" field="onlyIncludePeriodTypeIdList[]"/>
<!-- get current period(s) and check if closed -->
+ <!-- also check if the glAccountId, amount, currencyUomId fields are all set -->
<iterate entry-name="acctgTransEntry" list-name="acctgTransEntryList">
<!-- we want to do this for each organizationPartyId, so only do this if we haven't already found the list for the current org -->
<if-empty field-name="customTimePeriodListByOrganizationPartyIdMap.${acctgTransEntry.organizationPartyId}">
@@ -224,134 +224,151 @@
<!-- save this customTimePeriodList for the current entry for later use -->
<set from-field="customTimePeriodList" field="customTimePeriodListByOrganizationPartyIdMap.${acctgTransEntry.organizationPartyId}"/>
</if-empty>
+ <if-empty field-name="acctgTransEntry.glAccountId">
+ <add-error><fail-message message="Gl account id is not set for [${acctgTransEntry.acctgTransEntrySeqId}] or mapping not found for account type ${acctgTransEntry.glAccountTypeId}"/></add-error>
+ </if-empty>
+ <if-empty field-name="acctgTransEntry.amount">
+ <add-error><fail-message message="Amount not set for [${acctgTransEntry.acctgTransEntrySeqId}] or failed to convert the original amount ${acctgTransEntry.origAmount} with currency ${acctgTransEntry.origCurrencyUomId}"/></add-error>
+ </if-empty>
+ <!--
+ <if-empty field-name="acctgTransEntry.currencyUomId">
+ <add-error><fail-message message="Currency is not set for [${acctgTransEntry.acctgTransEntrySeqId}]"/></add-error>
+ </if-empty>
+ -->
</iterate>
-
+
<!-- DONE with initial tests/checks, see if we are good to go or not... -->
- <check-errors/>
- <!-- TODO: for each entry: lookup GlAccount, update posted balance -->
- <iterate entry-name="acctgTransEntry" list-name="acctgTransEntryList">
- <!-- Get all data to operate on: GlAccount, GlAccountOrganization, GlAccountHistory -->
- <clear-field field-name="glAccount"/>
- <clear-field field-name="glAccountOrganization"/>
- <clear-field field-name="glAccountHistoryList"/>
-
- <entity-one entity-name="GlAccount" value-name="glAccount">
- <field-map field-name="glAccountId" env-name="acctgTransEntry.glAccountId"/>
- </entity-one>
- <entity-one entity-name="GlAccountOrganization" value-name="glAccountOrganization">
- <field-map field-name="glAccountId" env-name="acctgTransEntry.glAccountId"/>
- <field-map field-name="organizationPartyId" env-name="acctgTransEntry.organizationPartyId"/>
- </entity-one>
-
- <!-- update the GlAccount's posted balance. This depends on whether the GlAccount is a debit or credit account and the
- debitCreditFlag of the acctgTransEntry. Debits add to debit accounts and subtract from credit accounts. Credits add to
- credit accounts and subtract from debit accounts -->
- <!-- we do this by first calculating a postingAmount (positive or negative) then adding to the postingBalance -->
- <clear-field field-name="postingAmount"/>
- <!-- use the parent of the GlAccountClass, which should either be DEBIT or CREDIT -->
- <get-related-one relation-name="GlAccountClass" value-name="glAccount" to-value-name="glAccountClass"/>
- <get-related-one relation-name="ParentGlAccountClass" value-name="glAccountClass" to-value-name="parentGlAccountClass"/>
- <!-- test if the account is a DEBIT account -->
- <set field="isDebit" value="${bsh:org.ofbiz.accounting.util.UtilAccounting.isDebitAccount(glAccount)}"/>
- <if-compare field-name="isDebit" operator="equals" value="true">
- <if-compare field-name="debitCreditFlag" map-name="acctgTransEntry" operator="equals" value="D">
- <set from-field="acctgTransEntry.amount" field="postingAmount"/>
- <else>
- <if-compare field-name="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
- <calculate field-name="postingAmount" type="BigDecimal">
- <calcop field-name="acctgTransEntry.amount" operator="negative"/>
- </calculate>
- </if-compare>
- </else>
- </if-compare>
- <else>
- <!-- otherwise, test if the account is credit -->
- <set field="isCredit" value="${bsh:org.ofbiz.accounting.util.UtilAccounting.isCreditAccount(glAccount)}"/>
- <if-compare field-name="isCredit" operator="equals" value="true">
- <if-compare field-name="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
+ <if-compare field-name="parameters.verifyOnly" operator="equals" value="Y">
+ <check-errors/>
+ <else>
+ <!-- TODO: if there are errors and we have an error journal assign to the journal and return -->
+ <check-errors/>
+ <!-- TODO: for each entry: lookup GlAccount, update posted balance -->
+ <iterate entry-name="acctgTransEntry" list-name="acctgTransEntryList">
+ <!-- Get all data to operate on: GlAccount, GlAccountOrganization, GlAccountHistory -->
+ <clear-field field-name="glAccount"/>
+ <clear-field field-name="glAccountOrganization"/>
+ <clear-field field-name="glAccountHistoryList"/>
+
+ <entity-one entity-name="GlAccount" value-name="glAccount">
+ <field-map field-name="glAccountId" env-name="acctgTransEntry.glAccountId"/>
+ </entity-one>
+ <entity-one entity-name="GlAccountOrganization" value-name="glAccountOrganization">
+ <field-map field-name="glAccountId" env-name="acctgTransEntry.glAccountId"/>
+ <field-map field-name="organizationPartyId" env-name="acctgTransEntry.organizationPartyId"/>
+ </entity-one>
+
+ <!-- update the GlAccount's posted balance. This depends on whether the GlAccount is a debit or credit account and the
+ debitCreditFlag of the acctgTransEntry. Debits add to debit accounts and subtract from credit accounts. Credits add to
+ credit accounts and subtract from debit accounts -->
+ <!-- we do this by first calculating a postingAmount (positive or negative) then adding to the postingBalance -->
+ <clear-field field-name="postingAmount"/>
+ <!-- use the parent of the GlAccountClass, which should either be DEBIT or CREDIT -->
+ <get-related-one relation-name="GlAccountClass" value-name="glAccount" to-value-name="glAccountClass"/>
+ <get-related-one relation-name="ParentGlAccountClass" value-name="glAccountClass" to-value-name="parentGlAccountClass"/>
+ <!-- test if the account is a DEBIT account -->
+ <set field="isDebit" value="${bsh:org.ofbiz.accounting.util.UtilAccounting.isDebitAccount(glAccount)}"/>
+ <if-compare field-name="isDebit" operator="equals" value="true">
+ <if-compare field-name="debitCreditFlag" map-name="acctgTransEntry" operator="equals" value="D">
<set from-field="acctgTransEntry.amount" field="postingAmount"/>
<else>
- <if-compare field-name="acctgTransEntry.debitCreditFlag" operator="equals" value="D">
+ <if-compare field-name="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
<calculate field-name="postingAmount" type="BigDecimal">
<calcop field-name="acctgTransEntry.amount" operator="negative"/>
</calculate>
</if-compare>
</else>
</if-compare>
- <else>
- <log level="warning" message="GL account ${glAccount.glAccountId} is of class ${glAccount.glAccountClassId} which is neither debit nor credit - cannot update posted balance"/>
- </else>
- </if-compare>
- </else>
- </if-compare>
- <log level="verbose" message="GL account: [${acctgTransEntry.glAccountId}] initial balance: [${glAccountOrganization.postedBalance}] ${acctgTransEntry.debitCreditFlag} [${acctgTransEntry.amount}]"/>
- <!-- calculate the new posted balance for this gl account -->
- <calculate field-name="postedBalance" type="BigDecimal">
- <calcop operator="get" field-name="glAccountOrganization.postedBalance"/>
- <calcop operator="get" field-name="postingAmount"/>
- </calculate>
- <log level="verbose" message="GL account: [${acctgTransEntry.glAccountId}] final balance: [${postedBalance}]"/>
-
- <!-- update the gl account's posted balance for this organization -->
- <set from-field="glAccount.glAccountId" field="updateGlAccountParams.glAccountId"/>
- <set from-field="postedBalance" field="updateGlAccountParams.postedBalance" type="Double"/>
- <set from-field="acctgTransEntry.organizationPartyId" field="updateGlAccountParams.organizationPartyId"/>
- <call-service service-name="updateGlAccountOrganization" in-map-name="updateGlAccountParams"/>
-
- <!-- assemble the glAccountHistoryList, we will update all of these -->
- <set from-field="customTimePeriodListByOrganizationPartyIdMap.${acctgTransEntry.organizationPartyId}" field="customTimePeriodList"/>
- <iterate entry-name="customTimePeriod" list-name="customTimePeriodList">
- <entity-one entity-name="GlAccountHistory" value-name="glAccountHistory">
- <field-map field-name="glAccountId" env-name="acctgTransEntry.glAccountId"/>
- <field-map field-name="organizationPartyId" env-name="acctgTransEntry.organizationPartyId"/>
- <field-map field-name="customTimePeriodId" env-name="customTimePeriod.customTimePeriodId"/>
- </entity-one>
- <!-- if no glAccountHistory create a new empty one -->
- <if-empty field-name="glAccountHistory">
- <make-value value-name="glAccountHistory" entity-name="GlAccountHistory"/>
- <set from-field="acctgTransEntry.glAccountId" field="glAccountHistory.glAccountId"/>
- <set from-field="acctgTransEntry.organizationPartyId" field="glAccountHistory.organizationPartyId"/>
- <set from-field="customTimePeriod.customTimePeriodId" field="glAccountHistory.customTimePeriodId"/>
- <set field="glAccountHistory.postedDebits" value="0.0" type="Double"/>
- <set field="glAccountHistory.postedCredits" value="0.0" type="Double"/>
- <create-value value-name="glAccountHistory"/>
- </if-empty>
-
- <!-- update GlAccountHistory's debit and credit totals -->
- <if-compare field-name="debitCreditFlag" map-name="acctgTransEntry" operator="equals" value="D">
- <calculate field-name="postedDebits" map-name="glAccountHistory" type="BigDecimal">
- <calcop operator="add">
- <calcop operator="get" field-name="amount" map-name="acctgTransEntry"/>
- <calcop operator="get" field-name="postedDebits" map-name="glAccountHistory"/>
- </calcop>
- </calculate>
- <else>
- <if-compare field-name="debitCreditFlag" map-name="acctgTransEntry" operator="equals" value="C">
- <calculate field-name="postedCredits" map-name="glAccountHistory" type="BigDecimal">
+ <else>
+ <!-- otherwise, test if the account is credit -->
+ <set field="isCredit" value="${bsh:org.ofbiz.accounting.util.UtilAccounting.isCreditAccount(glAccount)}"/>
+ <if-compare field-name="isCredit" operator="equals" value="true">
+ <if-compare field-name="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
+ <set from-field="acctgTransEntry.amount" field="postingAmount"/>
+ <else>
+ <if-compare field-name="acctgTransEntry.debitCreditFlag" operator="equals" value="D">
+ <calculate field-name="postingAmount" type="BigDecimal">
+ <calcop field-name="acctgTransEntry.amount" operator="negative"/>
+ </calculate>
+ </if-compare>
+ </else>
+ </if-compare>
+ <else>
+ <log level="warning" message="GL account ${glAccount.glAccountId} is of class ${glAccount.glAccountClassId} which is neither debit nor credit - cannot update posted balance"/>
+ </else>
+ </if-compare>
+ </else>
+ </if-compare>
+ <log level="verbose" message="GL account: [${acctgTransEntry.glAccountId}] initial balance: [${glAccountOrganization.postedBalance}] ${acctgTransEntry.debitCreditFlag} [${acctgTransEntry.amount}]"/>
+ <!-- calculate the new posted balance for this gl account -->
+ <calculate field-name="postedBalance" type="BigDecimal">
+ <calcop operator="get" field-name="glAccountOrganization.postedBalance"/>
+ <calcop operator="get" field-name="postingAmount"/>
+ </calculate>
+ <log level="verbose" message="GL account: [${acctgTransEntry.glAccountId}] final balance: [${postedBalance}]"/>
+
+ <!-- update the gl account's posted balance for this organization -->
+ <set from-field="glAccount.glAccountId" field="updateGlAccountParams.glAccountId"/>
+ <set from-field="postedBalance" field="updateGlAccountParams.postedBalance" type="Double"/>
+ <set from-field="acctgTransEntry.organizationPartyId" field="updateGlAccountParams.organizationPartyId"/>
+ <call-service service-name="updateGlAccountOrganization" in-map-name="updateGlAccountParams"/>
+
+ <!-- assemble the glAccountHistoryList, we will update all of these -->
+ <set from-field="customTimePeriodListByOrganizationPartyIdMap.${acctgTransEntry.organizationPartyId}" field="customTimePeriodList"/>
+ <iterate entry-name="customTimePeriod" list-name="customTimePeriodList">
+ <entity-one entity-name="GlAccountHistory" value-name="glAccountHistory">
+ <field-map field-name="glAccountId" env-name="acctgTransEntry.glAccountId"/>
+ <field-map field-name="organizationPartyId" env-name="acctgTransEntry.organizationPartyId"/>
+ <field-map field-name="customTimePeriodId" env-name="customTimePeriod.customTimePeriodId"/>
+ </entity-one>
+ <!-- if no glAccountHistory create a new empty one -->
+ <if-empty field-name="glAccountHistory">
+ <make-value value-name="glAccountHistory" entity-name="GlAccountHistory"/>
+ <set from-field="acctgTransEntry.glAccountId" field="glAccountHistory.glAccountId"/>
+ <set from-field="acctgTransEntry.organizationPartyId" field="glAccountHistory.organizationPartyId"/>
+ <set from-field="customTimePeriod.customTimePeriodId" field="glAccountHistory.customTimePeriodId"/>
+ <set field="glAccountHistory.postedDebits" value="0.0" type="Double"/>
+ <set field="glAccountHistory.postedCredits" value="0.0" type="Double"/>
+ <create-value value-name="glAccountHistory"/>
+ </if-empty>
+
+ <!-- update GlAccountHistory's debit and credit totals -->
+ <if-compare field-name="debitCreditFlag" map-name="acctgTransEntry" operator="equals" value="D">
+ <calculate field-name="postedDebits" map-name="glAccountHistory" type="BigDecimal">
<calcop operator="add">
<calcop operator="get" field-name="amount" map-name="acctgTransEntry"/>
- <calcop operator="get" field-name="postedCredits" map-name="glAccountHistory"/>
+ <calcop operator="get" field-name="postedDebits" map-name="glAccountHistory"/>
</calcop>
</calculate>
- <else>
- <add-error><fail-message message="Bad debitCreditFlag [${acctgTransEntry.debitCreditFlag}] (was not D or C) in Accounting Transaction Entry with acctgTransId=[${acctgTransEntry.acctgTransId}] and acctgTransEntrySeqId=[${acctgTransEntry.acctgTransEntrySeqId}]"/></add-error>
- </else>
- </if-compare>
- </else>
- </if-compare>
- <store-value value-name="glAccountHistory"/>
+ <else>
+ <if-compare field-name="debitCreditFlag" map-name="acctgTransEntry" operator="equals" value="C">
+ <calculate field-name="postedCredits" map-name="glAccountHistory" type="BigDecimal">
+ <calcop operator="add">
+ <calcop operator="get" field-name="amount" map-name="acctgTransEntry"/>
+ <calcop operator="get" field-name="postedCredits" map-name="glAccountHistory"/>
+ </calcop>
+ </calculate>
+ <else>
+ <add-error><fail-message message="Bad debitCreditFlag [${acctgTransEntry.debitCreditFlag}] (was not D or C) in Accounting Transaction Entry with acctgTransId=[${acctgTransEntry.acctgTransId}] and acctgTransEntrySeqId=[${acctgTransEntry.acctgTransEntrySeqId}]"/></add-error>
+ </else>
+ </if-compare>
+ </else>
+ </if-compare>
+ <store-value value-name="glAccountHistory"/>
+ </iterate>
</iterate>
- </iterate>
-
- <!-- check-errors just in case we had some bad debitCreditFlags -->
- <check-errors/>
- <!-- for AcctgTrans: set isPosted to Y, postedDate to now -->
- <set from-field="acctgTrans.acctgTransId" field="updateAcctgTransParams.acctgTransId"/>
- <now-timestamp-to-env env-name="updateAcctgTransParams.postedDate"/>
- <set value="Y" field="updateAcctgTransParams.isPosted"/>
+ <!-- check-errors just in case we had some bad debitCreditFlags -->
+ <check-errors/>
- <call-service service-name="updateAcctgTrans" in-map-name="updateAcctgTransParams" include-user-login="true"/>
+ <!-- for AcctgTrans: set isPosted to Y, postedDate to now -->
+ <set from-field="acctgTrans.acctgTransId" field="updateAcctgTransParams.acctgTransId"/>
+ <now-timestamp-to-env env-name="updateAcctgTransParams.postedDate"/>
+ <set value="Y" field="updateAcctgTransParams.isPosted"/>
+
+ <call-service service-name="updateAcctgTrans" in-map-name="updateAcctgTransParams" include-user-login="true"/>
+ </else>
+ </if-compare>
</simple-method>
</simple-methods>
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=599044&r1=599043&r2=599044&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 Wed Nov 28 08:01:48 2007
@@ -357,41 +357,11 @@
</if-not-empty>
</if-not-empty>
</if-empty>
- <if-empty field-name="acctgTransEntry.amount">
- <add-error><fail-message message="Cannot process accounting transaction entries with null amount: ${acctgTransEntry}"/></add-error>
+ <if-empty field-name="acctgTransEntry.origAmount">
+ <set field="acctgTransEntry.origAmount" from-field="acctgTransEntry.amount"/>
</if-empty>
- <if-empty field-name="acctgTransEntry.glAccountId">
- <add-error><fail-message message="Mapping not configured for the account type ${acctgTransEntry.glAccountTypeId}; cannot process accounting transaction entries with a null glAccountId."/></add-error>
- </if-empty>
- <check-errors/>
- <!-- add up debits and credits -->
- <if-compare field-name="acctgTransEntry.debitCreditFlag" operator="equals" value="D">
- <calculate field-name="debitTotal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
- <calcop operator="get" field-name="acctgTransEntry.amount"/>
- <calcop operator="get" field-name="debitTotal"/>
- </calculate>
- </if-compare>
- <if-compare field-name="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
- <calculate field-name="creditTotal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
- <calcop operator="get" field-name="acctgTransEntry.amount"/>
- <calcop operator="get" field-name="creditTotal"/>
- </calculate>
- </if-compare>
</iterate>
- <calculate field-name="debitCreditDifference" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
- <calcop operator="get" field-name="debitTotal"/>
- <calcop operator="negative" field-name="creditTotal"/>
- </calculate>
- <!-- <log level="info" message="In createAcctgTransAndEntries: debitTotal = [${debitTotal}] creditTotal=[${creditTotal}] debitCreditDifference=[${debitCreditDifference}]"/> -->
- <!-- if the debit and credit totals do not balance, return an error -->
- <if-compare field-name="debitCreditDifference" operator="greater-equals" value="0.000001" type="Double">
- <add-error><fail-property resource="AccountingUiLabels" property="AccountingDebitCreditMustEqual"/></add-error>
- </if-compare>
- <if-compare field-name="debitCreditDifference" operator="less-equals" value="-0.000001" type="Double">
- <add-error><fail-property resource="AccountingUiLabels" property="AccountingDebitCreditMustEqual"/></add-error>
- </if-compare>
- <check-errors/>
-
+
<!-- now do the posting. First, create the AcctgTrans entity -->
<set-service-fields service-name="createAcctgTrans" map-name="parameters" to-map-name="createAcctgTransParams"/>
<if-empty field-name="createAcctgTransParams.transactionDate">
@@ -404,8 +374,11 @@
<!-- Next, create the AcctgTransEntry entities one by one -->
<iterate list-name="parameters.acctgTransEntries" entry-name="acctgTransEntry">
<!-- if any amount is negative, then get the absolute (positive) value of that amount, and flip the Debit/Credit flag -->
- <if-compare field-name="amount" map-name="acctgTransEntry" operator="less" value="0">
+ <if-compare field-name="acctgTransEntry.origAmount" operator="less" value="0">
<log level="verbose" message="${acctgTransEntry} is going to get inverted"/>
+ <calculate field-name="acctgTransEntry.origAmount">
+ <calcop field-name="acctgTransEntry.origAmount" operator="negative"/>
+ </calculate>
<calculate field-name="acctgTransEntry.amount">
<calcop field-name="acctgTransEntry.amount" operator="negative"/>
</calculate>
@@ -418,7 +391,7 @@
</else>
</if-compare>
</if-compare>
-
+
<!-- now create the AcctgTransEntry using the acctgTransId we already have from above -->
<clear-field field-name="createAcctgTransEntryParams"/>
<set-service-fields service-name="createAcctgTransEntry" map-name="acctgTransEntry" to-map-name="createAcctgTransEntryParams"/>
Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=599044&r1=599043&r2=599044&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Wed Nov 28 08:01:48 2007
@@ -207,10 +207,12 @@
<auto-attributes include="nonpk" mode="IN" optional="true">
<exclude field-name="reconcileStatusId"/>
</auto-attributes>
- <override name="glAccountId" optional="false"/>
<override name="organizationPartyId" optional="false"/>
- <override name="amount" optional="false"/>
<override name="debitCreditFlag" optional="false"/>
+ <!--
+ <override name="glAccountId" optional="false"/>
+ <override name="amount" optional="false"/>
+ -->
</service>
<service name="createAcctgTransEntry" default-entity-name="AcctgTransEntry" engine="simple"
location="org/ofbiz/accounting/ledger/AcctgTransServices.xml" invoke="createAcctgTransEntry" auth="true">
@@ -276,6 +278,7 @@
<check-permission permission="ACCOUNTING" action="_ATX_POST"/>
</required-permissions>
<auto-attributes include="pk" mode="IN" optional="false"/>
+ <attribute name="verifyOnly" type="String" mode="IN" optional="true"/>
</service>
<!-- Miscellaneous Ledger-related services -->
Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=599044&r1=599043&r2=599044&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Wed Nov 28 08:01:48 2007
@@ -420,8 +420,8 @@
<request-map uri="postAcctgTrans">
<security https="true" auth="true"/>
<event type="service" invoke="postAcctgTrans"/>
- <response name="success" type="view" value="ListUnpostedAcctgTrans"/>
- <response name="error" type="view" value="ListUnpostedAcctgTrans"/>
+ <response name="success" type="view" value="EditAcctgTrans"/>
+ <response name="error" type="view" value="EditAcctgTrans"/>
</request-map>
<request-map uri="updateAcctgTrans">
<security https="true" auth="true"/>
Modified: ofbiz/trunk/applications/accounting/widget/GlForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlForms.xml?rev=599044&r1=599043&r2=599044&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/GlForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/GlForms.xml Wed Nov 28 08:01:48 2007
@@ -137,10 +137,13 @@
<hyperlink also-hidden="false" description="${paymentId}" target="editPayment?paymentId=${paymentId}"/>
</field>
<field name="paymentId" use-when="paymentId==null"><display/></field>
- <field name="partyId"><display/></field>
- <field name="post" title="${uiLabelMap.AccountingPostTransaction}" widget-style="buttontext">
- <hyperlink description="${uiLabelMap.AccountingPostTransaction}" target="postAcctgTrans?acctgTransId=${acctgTransId}&organizationPartyId=${organizationPartyId}" also-hidden="false"/>
- </field>
+ <field name="partyId"><display/></field>
+ <field name="verify" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext">
+ <hyperlink description="${uiLabelMap.AccountingVerifyTransaction}" target="postAcctgTrans?acctgTransId=${acctgTransId}&organizationPartyId=${organizationPartyId}&verifyOnly=Y" also-hidden="false"/>
+ </field>
+ <field name="post" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext">
+ <hyperlink description="${uiLabelMap.AccountingPostTransaction}" target="postAcctgTrans?acctgTransId=${acctgTransId}&organizationPartyId=${organizationPartyId}" also-hidden="false"/>
+ </field>
</form>
<form name="FindAcctgTransEntries" target="FindAcctgTransEntries" type="single" title="">
Modified: ofbiz/trunk/applications/accounting/widget/GlScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlScreens.xml?rev=599044&r1=599043&r2=599044&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/GlScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/GlScreens.xml Wed Nov 28 08:01:48 2007
@@ -183,6 +183,10 @@
</condition>
<widgets>
<container>
+ <link text="${uiLabelMap.AccountingVerifyTransaction}" style="buttontext" target="postAcctgTrans?acctgTransId=${acctgTransId}&organizationPartyId=${organizationPartyId}&verifyOnly=Y"/>
+ <link text="${uiLabelMap.AccountingPostTransaction}" style="buttontext" target="postAcctgTrans?acctgTransId=${acctgTransId}&organizationPartyId=${organizationPartyId}"/>
+ </container>
+ <container>
<include-form name="EditAcctgTransEntry" location="component://accounting/widget/GlForms.xml"/>
</container>
</widgets>