svn commit: r799265 - in /ofbiz/trunk/applications/accounting: config/AccountingUiLabels.xml script/org/ofbiz/accounting/payment/PaymentMethodServices.xml servicedef/services_paymentmethod.xml widget/PaymentGroupForms.xml

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

svn commit: r799265 - in /ofbiz/trunk/applications/accounting: config/AccountingUiLabels.xml script/org/ofbiz/accounting/payment/PaymentMethodServices.xml servicedef/services_paymentmethod.xml widget/PaymentGroupForms.xml

apatel-2
Author: apatel
Date: Thu Jul 30 13:50:31 2009
New Revision: 799265

URL: http://svn.apache.org/viewvc?rev=799265&view=rev
Log:
Improvements to force contraints associated with Payment Group types. Rishi, Parimal Thanks for patch. Patch from OFBIZ-2774

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
    ofbiz/trunk/applications/accounting/widget/PaymentGroupForms.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=799265&r1=799264&r2=799265&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Thu Jul 30 13:50:31 2009
@@ -1540,6 +1540,12 @@
     <property key="AccountingCancelTransactionStatus">
         <value xml:lang="en">Cancel Transaction Status</value>
     </property>
+    <property key="AccountingCannotCreateIncomingPaymentError">
+        <value xml:lang="en">Cannot add incoming payment to paymentGroup type Check Run</value>
+    </property>
+    <property key="AccountingCannotCreateOutgoingPaymentError">
+        <value xml:lang="en">Cannot add outgoing payment to paymentGroup type Batch Of Payments</value>
+    </property>
     <property key="AccountingCannotGetPaymentForApplication">
         <value xml:lang="ar">لا يمكن الحصول على التسديد للتطبيق  [${payAppl}] من أجل ${msg}</value>
         <value xml:lang="en">Cannot get payment for application [${payAppl}] due to ${msg}</value>

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml?rev=799265&r1=799264&r2=799265&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml Thu Jul 30 13:50:31 2009
@@ -156,4 +156,36 @@
         <store-value value-field="payPalPaymentMethod"/>
         <field-to-result result-name="paymentMethodId" field="payPalPaymentMethod.paymentMethodId"/>
     </simple-method>
+
+    <simple-method method-name="createPaymentGroupMember" short-description="Check For Outgoing/Incoming Payment And Create Payment Group Member">
+        <make-value entity-name="PaymentGroupMember" value-field="newPaymentGroupMember"/>
+        <set-pk-fields map="parameters" value-field="newPaymentGroupMember"/>
+        <set-nonpk-fields map="parameters" value-field="newPaymentGroupMember"/>
+        <if-empty field="parameters.fromDate">
+            <now-timestamp field="newPaymentGroupMember.fromDate"/>
+        </if-empty>
+        <entity-one entity-name="PaymentGroup" value-field="paymentGroup"/>
+        <entity-one entity-name="Payment" value-field="payment"/>
+        <if-compare field="paymentGroup.paymentGroupTypeId" operator="equals" value="CHECK_RUN">
+            <set field="isDisbursement" value="${groovy:org.ofbiz.accounting.util.UtilAccounting.isDisbursement(payment)}" type="Boolean"/>
+            <if-compare field="isDisbursement" operator="equals" value="true" type="Boolean">
+                <create-value value-field="newPaymentGroupMember"/>
+            <else>
+                <add-error><fail-property resource="AccountingUiLabels" property="AccountingCannotCreateIncomingPaymentError"/></add-error>
+            </else>
+            </if-compare>
+        <else>
+            <if-compare field="paymentGroup.paymentGroupTypeId" operator="equals" value="BATCH_PAYMENT" type="Boolean">
+                <set field="isReceipt" value="${groovy:org.ofbiz.accounting.util.UtilAccounting.isReceipt(payment)}" type="Boolean"/>
+                <if-compare field="isReceipt" operator="equals" value="true">
+                    <create-value value-field="newPaymentGroupMember"/>
+                <else>
+                    <add-error><fail-property resource="AccountingUiLabels" property="AccountingCannotCreateOutgoingPaymentError"/></add-error>
+                </else>
+                </if-compare>
+            </if-compare>
+        </else>
+        </if-compare>
+        <check-errors/>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=799265&r1=799264&r2=799265&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Jul 30 13:50:31 2009
@@ -816,10 +816,12 @@
     </service>
     
     <!-- Payment Group Member -->
-    <service name="createPaymentGroupMember" default-entity-name="PaymentGroupMember" engine="entity-auto" invoke="create" auth="true">
-        <description>Create a Payment Group Member</description>
+    <service name="createPaymentGroupMember" default-entity-name="PaymentGroupMember" engine="simple"
+            location="component://accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml" invoke="createPaymentGroupMember" auth="true">
+        <description>Check For Outgoing/Incoming Payment And Create Payment Group Member</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <override name="fromDate" optional="true"/>
     </service>
     <service name="updatePaymentGroupMember" default-entity-name="PaymentGroupMember" engine="entity-auto" invoke="update" auth="true">
         <description>Update a Payment Group Member</description>
@@ -835,4 +837,4 @@
         <description>expire a Payment Group Member</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
-</services>
\ No newline at end of file
+</services>

Modified: ofbiz/trunk/applications/accounting/widget/PaymentGroupForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentGroupForms.xml?rev=799265&r1=799264&r2=799265&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/PaymentGroupForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/PaymentGroupForms.xml Thu Jul 30 13:50:31 2009
@@ -69,18 +69,18 @@
         <field use-when="paymentGroup==null @and paymentGroupId!=null" name="paymentGroupId"><display description="${uiLabelMap.CommonCannotBeFound}: [${paymentGroupId}]" also-hidden="false"/></field>
         <field name="paymentGroupId" use-when="display==true"><display/></field>
         <field name="paymentGroupTypeId" title="${uiLabelMap.CommonType}">
+            <display-entity entity-name="PaymentGroupType" description="${description}"/>
+        </field>
+        <field name="paymentGroupTypeId" use-when="paymentGroup==null" title="${uiLabelMap.CommonType}">
             <drop-down allow-empty="false">
                 <entity-options entity-name="PaymentGroupType" description="${description}">
                     <entity-order-by field-name="description"/>
                 </entity-options>
             </drop-down>
         </field>
-        <field name="paymentGroupTypeId" title="${uiLabelMap.CommonType}" use-when="display==true">
-            <display-entity entity-name="PaymentGroupType" description="${description}"/>
-        </field>
         <field name="paymentGroupName" use-when="display==true"><display/></field>
-        <field name="submitButton" use-when="paymentMethod==null" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
-        <field name="submitButton" use-when="paymentMethod!=null" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
+        <field name="submitButton" use-when="paymentGroup==null" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
+        <field name="submitButton" use-when="paymentGroup!=null" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
         <field name="submitButton" use-when="display==true"><hidden/></field>
     </form>