From 03cdc0eedca10e0bdd1488e61b88fca0eb657ef9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Tue, 16 Oct 2007 11:54:15 +0000
Subject: [PATCH] fix way to check resource defined on line

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17019 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../scripts/validateVaultBalance.xml                 |  2 +-
 .../scripts/validateVaultBalance.xml                 | 12 +++++++++++-
 bt5/erp5_banking_cash/bt/revision                    |  2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_purchase_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_purchase_workflow/scripts/validateVaultBalance.xml
index e8b8393444..9b72a24af7 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_purchase_workflow/scripts/validateVaultBalance.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_purchase_workflow/scripts/validateVaultBalance.xml
@@ -109,7 +109,7 @@ pourcentage = transaction.getDiscountRatio()\n
 # check resource on incoming line\n
 doc_resource = transaction.getResource()\n
 for line in transaction.contentValues(portal_type="Incoming Cash To Currency Purchase Line"):\n
-  if line.getResource() != doc_resource:\n
+  if line.getResourceValue().getPriceCurrency() != doc_resource:\n
     msg = Message(domain="ui", message="Resource defined on document is different from input cash.")\n
     raise ValidationFailed, (msg,)\n
 \n
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_sale_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_sale_workflow/scripts/validateVaultBalance.xml
index c991883b6a..d289af6763 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_sale_workflow/scripts/validateVaultBalance.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_sale_workflow/scripts/validateVaultBalance.xml
@@ -80,6 +80,13 @@ encaisse_devise = "/encaisse_des_devises/%s/sortante" %(var_ressource_title)\n
 encaisse_billets_et_monnaies = "/encaisse_des_billets_et_monnaies/entrante"\n
 \n
 \n
+# check resource on incoming line\n
+doc_resource = transaction.getResource()\n
+for line in transaction.contentValues(portal_type="Outgoing Cash To Currency Sale Line"):\n
+  if line.getResourceValue().getPriceCurrency() != doc_resource:\n
+    msg = Message(domain="ui", message="Resource defined on document is different from input cash.")\n
+    raise ValidationFailed, (msg,)\n
+\n
 counter_site = transaction.getSource()\n
 \n
 # check we don\'t change of user\n
@@ -187,6 +194,10 @@ elif resource_one != 0 :\n
                             <string>var_ressource_title</string>
                             <string>encaisse_devise</string>
                             <string>encaisse_billets_et_monnaies</string>
+                            <string>doc_resource</string>
+                            <string>_getiter_</string>
+                            <string>line</string>
+                            <string>msg</string>
                             <string>counter_site</string>
                             <string>outgoing_source</string>
                             <string>context</string>
@@ -195,7 +206,6 @@ elif resource_one != 0 :\n
                             <string>billetage_sorti</string>
                             <string>base_price</string>
                             <string>quantity</string>
-                            <string>msg</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_banking_cash/bt/revision b/bt5/erp5_banking_cash/bt/revision
index 8db1e5f188..a9d3bc092c 100644
--- a/bt5/erp5_banking_cash/bt/revision
+++ b/bt5/erp5_banking_cash/bt/revision
@@ -1 +1 @@
-522
\ No newline at end of file
+523
\ No newline at end of file
-- 
2.30.9