Author: ashish
Date: Mon Dec 14 08:55:48 2009
New Revision: 890229

URL: http://svn.apache.org/viewvc?rev=890229&view=rev
Log:
Applied patch from jira issue OFBIZ-3331 - Restrict Cancelled Financial Account 
operation on AP New Payment Screen.
Thanks Awdesh & Sumit for the contribution.

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
    
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
    ofbiz/trunk/applications/accounting/widget/PaymentForms.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml?rev=890229&r1=890228&r2=890229&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml 
(original)
+++ ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml Mon 
Dec 14 08:55:48 2009
@@ -19,6 +19,12 @@
     under the License.
 -->
 <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+    <property key="AccountingFinAccountInactiveStatusError">
+        <value xml:lang="en">FinAccount must be in active status</value>
+    </property>
+    <property key="AccountingFinAccountStatusNotValidError">
+        <value xml:lang="en">FinAccount not in valid status</value>
+    </property>
     <property key="AccountingPayPalCommunicationError">
         <value xml:lang="en">A problem occurred while communicating with 
PayPal, please try again or select a different checkout method</value>
         <value xml:lang="hi_IN">Paypal से संचार में 
समस्या, कृपया पुन: प्रयास करें 
या एक अलग Checkout पद्धति का चयन 
करें</value>

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=890229&r1=890228&r2=890229&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Mon Dec 
14 08:55:48 2009
@@ -3284,12 +3284,6 @@
         <value xml:lang="th">การอนุญาต</value>
         <value xml:lang="zh">授权</value>
     </property>
-    <property key="AccountingFinAccountInactiveStatusError">
-        <value xml:lang="en">FinAccount must be in active status</value>
-    </property>
-    <property key="AccountingFinAccountNotValidError">
-        <value xml:lang="en">FinAccount not in valid status</value>
-    </property>    
     <property key="AccountingFinAccountTransaction">
         <value xml:lang="en">Financial Account Transaction</value>
         <value xml:lang="hi_IN">वित्तीय खाता 
लेन-देन</value>

Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=890229&r1=890228&r2=890229&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Mon Dec 14 
08:55:48 2009
@@ -3952,4 +3952,15 @@
         <key-map field-name="finAccountTransId"/>
       </view-link>
     </view-entity>  
+    <view-entity entity-name="PaymentMethodAndFinAccount" 
package-name="org.ofbiz.accounting.finaccount" title="PaymentMethod and 
FinAccount view entity">
+        <member-entity entity-alias="PM" entity-name="PaymentMethod"/>
+        <member-entity entity-alias="FA" entity-name="FinAccount"/>
+        <alias-all entity-alias="FA"/>
+        <alias-all entity-alias="PM">
+            <exclude field="finAccountId"/>
+        </alias-all>
+        <view-link rel-entity-alias="PM" entity-alias="FA">
+            <key-map field-name="finAccountId"/>
+        </view-link>
+    </view-entity>
 </entitymodel>

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=890229&r1=890228&r2=890229&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
 Mon Dec 14 08:55:48 2009
@@ -120,10 +120,10 @@
             </then>
             <else>
                 <if-compare field="lookedUpValue.statusId" operator="equals" 
value="FNACT_MANFROZEN">
-                    <add-error><fail-property resource="AccountingUiLabels" 
property="AccountingFinAccountInactiveStatusError"/></add-error>
+                    <add-error><fail-property 
resource="AccountingErrorUiLabels" 
property="AccountingFinAccountInactiveStatusError"/></add-error>
                 </if-compare>
                 <if-compare field="lookedUpValue.statusId" operator="equals" 
value="FNACT_CANCELLED">
-                    <add-error><fail-property resource="AccountingUiLabels" 
property="AccountingFinAccountNotValidError"/></add-error>
+                    <add-error><fail-property 
resource="AccountingErrorUiLabels" 
property="AccountingFinAccountStatusNotValidError"/></add-error>
                 </if-compare>
                 <check-errors/>
             </else>
@@ -171,10 +171,10 @@
     <simple-method method-name="createFinAccountTrans" 
short-description="Create a Financial Account Transaction">
         <entity-one entity-name="FinAccount" value-field="finAccount"/>
         <if-compare field="finAccount.statusId" operator="equals" 
value="FNACT_MANFROZEN">
-            <add-error><fail-property resource="AccountingUiLabels" 
property="AccountingFinAccountInactiveStatusError"/></add-error>
+            <add-error><fail-property resource="AccountingErrorUiLabels" 
property="AccountingFinAccountInactiveStatusError"/></add-error>
         </if-compare>
         <if-compare field="finAccount.statusId" operator="equals" 
value="FNACT_CANCELLED">
-            <add-error><fail-property resource="AccountingUiLabels" 
property="AccountingFinAccountNotValidError"/></add-error>
+            <add-error><fail-property resource="AccountingErrorUiLabels" 
property="AccountingFinAccountStatusNotValidError"/></add-error>
         </if-compare>
         <check-errors/>
         <call-simple-method method-name="getArithmeticSettingsInline"/>
@@ -212,10 +212,10 @@
     <simple-method method-name="createFinAccountRole" 
short-description="Create a Financial Account Role">
         <entity-one entity-name="FinAccount" value-field="finAccount"/>
         <if-compare field="finAccount.statusId" operator="equals" 
value="FNACT_MANFROZEN">
-            <add-error><fail-property resource="AccountingUiLabels" 
property="AccountingFinAccountInactiveStatusError"/></add-error>
+            <add-error><fail-property resource="AccountingErrorUiLabels" 
property="AccountingFinAccountInactiveStatusError"/></add-error>
         </if-compare>
         <if-compare field="finAccount.statusId" operator="equals" 
value="FNACT_CANCELLED">
-            <add-error><fail-property resource="AccountingUiLabels" 
property="AccountingFinAccountNotValidError"/></add-error>
+            <add-error><fail-property resource="AccountingErrorUiLabels" 
property="AccountingFinAccountStatusNotValidError"/></add-error>
         </if-compare>
         <check-errors/>
         <make-value value-field="newEntity" entity-name="FinAccountRole"/>
@@ -924,6 +924,16 @@
             <result-to-field result-name="paymentId"/>
         </call-service>
         <if-not-empty field="paymentMethod.finAccountId">
+            <entity-one entity-name="FinAccount" value-field="finAccount">
+                <field-map field-name="finAccountId" 
from-field="paymentMethod.finAccountId"/>
+            </entity-one>
+            <if-compare field="finAccount.statusId" operator="equals" 
value="FNACT_MANFROZEN">
+                <add-error><fail-property resource="AccountingErrorUiLabels" 
property="AccountingFinAccountInactiveStatusError"/></add-error>
+            </if-compare>
+            <if-compare field="finAccount.statusId" operator="equals" 
value="FNACT_CANCELLED">
+                <add-error><fail-property resource="AccountingErrorUiLabels" 
property="AccountingFinAccountStatusNotValidError"/></add-error>
+            </if-compare>
+            <check-errors/>
             <if-compare field="parameters.isDepositWithDrawPayment" 
operator="equals" value="Y">
                 <set-service-fields service-name="createFinAccountTrans" 
map="parameters" to-map="createFinAccountTransMap"/>
                 <set field="createFinAccountTransMap.finAccountId" 
from-field="paymentMethod.finAccountId"/>

Modified: ofbiz/trunk/applications/accounting/widget/PaymentForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentForms.xml?rev=890229&r1=890228&r2=890229&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/PaymentForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/PaymentForms.xml Mon Dec 14 
08:55:48 2009
@@ -105,6 +105,13 @@
             </entity-one>
             <set field="partyGroupName" from-field="partyGroup.groupName"/>
             <set field="paymentPartyId" from-field="parameters.partyIdFrom" 
default-value="${defaultOrganizationPartyId}"/>
+            <entity-condition entity-name="PaymentMethodAndFinAccount" 
list="paymentMethodAndFinAccounts">
+                <condition-list>
+                    <condition-expr field-name="partyId" 
from-field="paymentPartyId"/>
+                    <condition-expr field-name="statusId" 
operator="not-equals" value="FNACT_MANFROZEN"/>
+                    <condition-expr field-name="statusId" 
operator="not-equals" value="FNACT_CANCELLED"/>
+                </condition-list>
+            </entity-condition>
         </actions>
         <field name="statusId"><hidden value="PMNT_NOT_PAID"/></field>
         <field name="currencyUomId"><hidden 
value="${defaultOrganizationPartyCurrencyUomId}"/></field>
@@ -118,9 +125,7 @@
         </field>
         <field name="paymentMethodId" id-name="paymentMethodId" position="2">
             <drop-down allow-empty="false">
-                <entity-options entity-name="PaymentMethod" 
description="${description}" filter-by-date="by-name">
-                     <entity-constraint name="partyId" operator="equals" 
value="${paymentPartyId}"/>
-                </entity-options>
+                <list-options list-name="paymentMethodAndFinAccounts" 
key-name="paymentMethodId" description="${description}"/>
             </drop-down>
         </field>
         <field name="partyIdTo" position="1"><lookup 
target-form-name="LookupPartyName"/></field>


Reply via email to