From fc2e7f50bc395be75209188d05dfae16a09b603e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Wed, 5 Nov 2008 13:00:58 +0000
Subject: [PATCH] add missing variables and missing verification in workflow
 transition and fast input

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24492 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...otEmitted_viewCashContainerInputDialog.xml |  4 ++--
 ...aryDestruction_viewLineFastInputDialog.xml | 21 ++++++++-----------
 .../scripts/validateVaultBalance.xml          |  7 ++++++-
 bt5/erp5_banking_cash/bt/revision             |  2 +-
 4 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashMovementNewNotEmitted_viewCashContainerInputDialog.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashMovementNewNotEmitted_viewCashContainerInputDialog.xml
index c8d4a0e5f6..2d5736d26c 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashMovementNewNotEmitted_viewCashContainerInputDialog.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashMovementNewNotEmitted_viewCashContainerInputDialog.xml
@@ -69,6 +69,7 @@
 \n
 \n
 container_portal_type_list = ["Monetary Reception",]\n
+resource_translated_title_dict = {}\n
 base_price_dict = {}\n
 \n
 if listbox is None:\n
@@ -101,7 +102,6 @@ if listbox is None:\n
       container_dict = {}\n
       container_lines = cash_container.searchFolder(portal_type=\'Container Line\')\n
       if len(container_lines) == 0:\n
-        context.log("CashMovementNewNotEmitted_generateCashContainerInputDialog", "No container line finf for cash container %s" %(cash_container.getRelativeUrl(),))\n
         continue\n
       container_line = container_lines[0].getObject()\n
       container_dict[\'reference\'] = cash_container.getReference()\n
@@ -202,6 +202,7 @@ if listbox is None:\n
                             <string>kw</string>
                             <string>DateTime</string>
                             <string>container_portal_type_list</string>
+                            <string>resource_translated_title_dict</string>
                             <string>base_price_dict</string>
                             <string>None</string>
                             <string>_getattr_</string>
@@ -222,7 +223,6 @@ if listbox is None:\n
                             <string>_write_</string>
                             <string>resource</string>
                             <string>base_price</string>
-                            <string>resource_translated_title_dict</string>
                             <string>resource_translated_title</string>
                             <string>quantity</string>
                             <string>total_price_dict</string>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryDestruction_viewLineFastInputDialog.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryDestruction_viewLineFastInputDialog.xml
index ca0d3fe604..114a0d07ba 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryDestruction_viewLineFastInputDialog.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetaryDestruction_viewLineFastInputDialog.xml
@@ -71,19 +71,15 @@ source = context.getSource()\n
 currency = context.Baobab_getPortalReferenceCurrencyID()\n
 source_section = context.getSourceSection()\n
 \n
+if source is None:\n
+  redirect_url = \'%s/%s?%s\' % ( context.absolute_url()\n
+                                , \'view\'\n
+                                , \'portal_status_message=Please+select+a+source.\'\n
+                                )\n
+  return request.RESPONSE.redirect( redirect_url )\n
 \n
-# We must not force another site, it is optionnal\n
-# So I (Seb) remove this\n
-#if source_section is None :\n
-#  redirect_url = \'%s/%s?%s\' % ( context.absolute_url()\n
-#                              , \'view\'\n
-#                              , \'portal_status_message=Please+select+a+site.\'\n
-#                              )\n
-#  return request.RESPONSE.redirect( redirect_url )\n
 \n
-\n
-\n
-if \'serre\' in context.getSource():\n
+if \'serre\' in source:\n
   cash_status = [\'retired\',\'error\']\n
 else:\n
   cash_status = [\'cancelled\',\'mutilated\', \'maculated\',\'error\']\n
@@ -166,8 +162,9 @@ return context.CashDelivery_generateCashDetailInputDialog(listbox = None\n
                             <string>source</string>
                             <string>currency</string>
                             <string>source_section</string>
-                            <string>cash_status</string>
                             <string>None</string>
+                            <string>redirect_url</string>
+                            <string>cash_status</string>
                             <string>emission_letter</string>
                             <string>list</string>
                             <string>_getitem_</string>
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml
index d3fb744d0f..ccac3fe6b6 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml
@@ -75,6 +75,10 @@ date = transaction.getStartDate()\n
 vault = transaction.getSource()\n
 vaultDestination = transaction.getDestination()\n
 \n
+if vault is None or vaultDestination is None:\n
+  msg = Message(domain="ui", message="You must define vaults.")\n
+  raise ValidationFailed, (msg,)\n
+\n
 # use of the constraint : Test source and destination\n
 vliste = transaction.checkConsistency()\n
 transaction.log(\'vliste\', vliste)\n
@@ -161,9 +165,10 @@ elif resource <> 0 :\n
                             <string>date</string>
                             <string>vault</string>
                             <string>vaultDestination</string>
+                            <string>None</string>
+                            <string>msg</string>
                             <string>vliste</string>
                             <string>len</string>
-                            <string>msg</string>
                             <string>resource</string>
                             <string>amount</string>
                             <string>total_price</string>
diff --git a/bt5/erp5_banking_cash/bt/revision b/bt5/erp5_banking_cash/bt/revision
index a557316495..0905ea78ab 100644
--- a/bt5/erp5_banking_cash/bt/revision
+++ b/bt5/erp5_banking_cash/bt/revision
@@ -1 +1 @@
-641
\ No newline at end of file
+642
\ No newline at end of file
-- 
2.30.9