svn commit: r606519 - in /ofbiz/trunk/applications/accounting: config/AccountingUiLabels.properties script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml servicedef/services_ledger.xml webapp/accounting/WEB-INF/controller.xml widget/GlScreens.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r606519 - in /ofbiz/trunk/applications/accounting: config/AccountingUiLabels.properties script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml servicedef/services_ledger.xml webapp/accounting/WEB-INF/controller.xml widget/GlScreens.xml

ashish-18
Author: ashish
Date: Sat Dec 22 15:52:24 2007
New Revision: 606519

URL: http://svn.apache.org/viewvc?rev=606519&view=rev
Log:
Applied recent patch from the JIRA Issue # OFBIZ-1487
Thanks to Sachin,Rishi and others to help in the implementation.

Special thanks to Pranay Pandey for working on Jacopo's comments.

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
    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/GlScreens.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties?rev=606519&r1=606518&r2=606519&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties Sat Dec 22 15:52:24 2007
@@ -160,6 +160,7 @@
 AccountingDescription=Description
 AccountingDescr=Descr
 AccountingDueDate=Due Date
+AccountingDuplicateAccountingTransaction=Duplicate Accounting Transaction
 AccountingEditPayment=Edit Payment
 AccountingEffective=Effective
 AccountingEffectiveDate=Effective Date
@@ -392,6 +393,7 @@
 AccountingReceivePayment=Receive Payment
 AccountingReferenceNumber=Reference Number
 AccountingReports=Reports
+AccountingRevertAccountingTransaction=Revert Accounting Transaction
 AccountingRoleType=Role Type
 AccountingRoleTypeIdFrom=Role Type Id From
 AccountingRoleTypeIdTo=Role Type Id To

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=606519&r1=606518&r2=606519&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 Sat Dec 22 15:52:24 2007
@@ -1795,4 +1795,43 @@
         </if-compare>
     </simple-method>
     
+    <!--service to clone an existing accounting transaction and its entries-->
+    <simple-method method-name="copyAcctgTransAndEntries" short-description="copy AcctgTransAndEntries">
+        <entity-one entity-name="AcctgTrans" value-name="acctgTrans">
+            <field-map field-name="acctgTransId" env-name="parameters.fromAcctgTransId"/>
+        </entity-one>
+        <!--Cloning AcctgTrans-->
+        <clone-value value-name="acctgTrans" new-value-name="newAcctgTrans"/>
+        <set-service-fields to-map-name="createAcctgTransInMap" service-name="createAcctgTrans" map-name="newAcctgTrans"/>
+        <now-timestamp-to-env env-name="nowTimestamp"/>
+        <set field="createAcctgTransInMap.transactionDate" from-field="nowTimestamp"/>
+        <set field="createAcctgTransInMap.isPosted" value="N"/>
+        <set field="originalAcctgTransId" from-field="parameters.fromAcctgTransId"/>
+        <field-to-result field-name="originalAcctgTransId" result-name="acctgTransId"/>        
+        
+        <clear-field field-name="acctgTransId" map-name="newAcctgTrans"/>
+        <call-service service-name="createAcctgTrans" in-map-name="createAcctgTransInMap">
+            <result-to-field result-name="acctgTransId" map-name="newAcctgTrans"/>
+        </call-service>
+        <get-related list-name="acctgTransEntries" relation-name="AcctgTransEntry" value-name="acctgTrans"/>
+        <iterate list-name="acctgTransEntries" entry-name="acctgTransEntry">
+            <!--Cloning AcctgTransEntry-->
+            <clone-value value-name="acctgTransEntry" new-value-name="newAcctgTransEntry"/>
+            <set-service-fields to-map-name="createAcctgTransAndEntryInMap" service-name="createAcctgTransEntry" map-name="newAcctgTransEntry"/>
+            <set field="createAcctgTransAndEntryInMap.acctgTransId" from-field="newAcctgTrans.acctgTransId"/>
+            <if-compare field-name="parameters.revert" operator="equals" value="Y">
+                <if-compare field-name="newAcctgTransEntry.debitCreditFlag" operator="equals" value="D">
+                    <set field="createAcctgTransAndEntryInMap.debitCreditFlag" value="C"/>
+                </if-compare>
+                <if-compare field-name="newAcctgTransEntry.debitCreditFlag" operator="equals" value="C">
+                    <set field="createAcctgTransAndEntryInMap.debitCreditFlag" value="D"/>
+                </if-compare>
+            <else>
+                <set field="createAcctgTransAndEntryInMap.debitCreditFlag" from-field="newAcctgTransEntry.debitCreditFlag"/>
+            </else>
+            </if-compare>
+            <call-service service-name="createAcctgTransEntry" in-map-name="createAcctgTransAndEntryInMap"/>
+        </iterate>
+    </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=606519&r1=606518&r2=606519&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Sat Dec 22 15:52:24 2007
@@ -470,4 +470,13 @@
         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
     </service>
     
+    <!--A service to clone an existing accounting transaction and its entries (AcctgTrans and AcctgTransEntry) -->
+    <service name="copyAcctgTransAndEntries" engine="simple"  auth="true"
+        location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="copyAcctgTransAndEntries">
+        <description>Create an Acctg Trans And Entry(Duplicate or revert)</description>
+        <attribute name="fromAcctgTransId" type="String" mode="IN" optional="false"/>
+        <attribute name="revert" type="String" mode="IN" optional="true"/>
+        <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
+    </service>
+    
 </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=606519&r1=606518&r2=606519&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Sat Dec 22 15:52:24 2007
@@ -500,6 +500,13 @@
         <response name="success" type="view" value="EditAcctgTrans"/>
         <response name="error" type="view" value="NewAcctgTrans"/>
     </request-map>
+    
+    <request-map uri="copyAcctgTransAndEntries">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="copyAcctgTransAndEntries"/>
+        <response name="success" type="view" value="EditAcctgTrans"/>
+        <response name="error" type="view" value="EditAcctgTrans"/>
+    </request-map>
 
     <!-- GlAccount requests -->
     <request-map uri="AssignGlAccount">

Modified: ofbiz/trunk/applications/accounting/widget/GlScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlScreens.xml?rev=606519&r1=606518&r2=606519&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/GlScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/GlScreens.xml Sat Dec 22 15:52:24 2007
@@ -187,6 +187,8 @@
                             </condition>
                             <widgets>
                                 <container>
+                                    <link text="${uiLabelMap.AccountingDuplicateAccountingTransaction}" style="buttontext" target="copyAcctgTransAndEntries?revert=N&amp;fromAcctgTransId=${acctgTransId}&amp;organizationPartyId=${organizationPartyId}"/>
+                                    <link text="${uiLabelMap.AccountingRevertAccountingTransaction}" style="buttontext" target="copyAcctgTransAndEntries?revert=Y&amp;fromAcctgTransId=${acctgTransId}&amp;organizationPartyId=${organizationPartyId}"/>
                                     <include-form name="EditAcctgTrans" location="component://accounting/widget/GlForms.xml"/>
                                     <include-form name="ListAcctgTransEntries" location="component://accounting/widget/GlForms.xml"/>
                                 </container>