From 3a34f946bb78f3cf7cdb14e1ec13a80c86da05fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Tue, 18 Mar 2008 16:18:43 +0000
Subject: [PATCH] user must defined payment type on internal money payment
 operation

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19996 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../base_category_list.xml                    |   3 +
 .../Internal%20Money%20Payment.xml            |   4 +
 .../InternalMoneyPayment_view.xml             |   1 +
 .../my_payment_type.xml                       | 289 ++++++++++++++++++
 .../scripts/validateCounter.xml               |   5 +-
 bt5/erp5_banking_cash/bt/revision             |   2 +-
 .../template_portal_type_base_category_list   |   1 +
 7 files changed, 303 insertions(+), 2 deletions(-)
 create mode 100644 bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyPayment_view/my_payment_type.xml

diff --git a/bt5/erp5_banking_cash/PortalTypeBaseCategoryTemplateItem/base_category_list.xml b/bt5/erp5_banking_cash/PortalTypeBaseCategoryTemplateItem/base_category_list.xml
index 00285cc69b..66b504b453 100644
--- a/bt5/erp5_banking_cash/PortalTypeBaseCategoryTemplateItem/base_category_list.xml
+++ b/bt5/erp5_banking_cash/PortalTypeBaseCategoryTemplateItem/base_category_list.xml
@@ -24,6 +24,9 @@
  <portal_type id="Foreign Cash Reception">
   <item>currency_exchange_type</item>
  </portal_type>
+ <portal_type id="Internal Money Payment">
+  <item>payment_type</item>
+ </portal_type>
  <portal_type id="Monetary Destruction Cell">
   <item>variation</item>
  </portal_type>
diff --git a/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Internal%20Money%20Payment.xml b/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Internal%20Money%20Payment.xml
index 62e79398b4..eb2918c01d 100644
--- a/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Internal%20Money%20Payment.xml
+++ b/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Internal%20Money%20Payment.xml
@@ -106,6 +106,10 @@
             <key> <string>init_script</string> </key>
             <value> <string>InternalMoneyPayment_init</string> </value>
         </item>
+        <item>
+            <key> <string>permission</string> </key>
+            <value> <string></string> </value>
+        </item>
         <item>
             <key> <string>property_sheet_list</string> </key>
             <value>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyPayment_view.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyPayment_view.xml
index 22088457e7..c508edca6e 100644
--- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyPayment_view.xml
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyPayment_view.xml
@@ -108,6 +108,7 @@
                         <string>my_source_reference</string>
                         <string>my_source_total_asset_price</string>
                         <string>my_grouping_reference</string>
+                        <string>my_payment_type</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyPayment_view/my_payment_type.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyPayment_view/my_payment_type.xml
new file mode 100644
index 0000000000..139618188b
--- /dev/null
+++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/InternalMoneyPayment_view/my_payment_type.xml
@@ -0,0 +1,289 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ListField" module="Products.Formulator.StandardFields"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_payment_type</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+                <item>
+                    <key> <string>required_not_found</string> </key>
+                    <value> <string>Input is required but no input given.</string> </value>
+                </item>
+                <item>
+                    <key> <string>unknown_selection</string> </key>
+                    <value> <string>You selected an item that was not in the list.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra_item</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>first_item</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>items</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>size</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra_item</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>first_item</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>items</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>size</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra_item</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>first_item</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>items</string> </key>
+                    <value>
+                      <list/>
+                    </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>size</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Payment Type</string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <tuple>
+        <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python: here.portal_categories.payment_type.getCategoryChildTitleItemList()</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/internal_money_payment_workflow/scripts/validateCounter.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/internal_money_payment_workflow/scripts/validateCounter.xml
index 0b18c35873..8034eef676 100644
--- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/internal_money_payment_workflow/scripts/validateCounter.xml
+++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/internal_money_payment_workflow/scripts/validateCounter.xml
@@ -81,6 +81,9 @@ transaction.Baobab_checkCounterDateOpen(site=source, date=transaction.getStartDa
 \n
 context.Baobab_checkCounterOpened(source)\n
 \n
+if transaction.getPaymentType() in (None, ""):\n
+  msg = Message(domain="ui", message="No payment type defined.")\n
+  raise ValidationFailed, (msg,)\n
 \n
 \n
 #test if the source or the destination is correct\n
@@ -180,9 +183,9 @@ if resource == 2:\n
                             <string>None</string>
                             <string>source</string>
                             <string>context</string>
+                            <string>msg</string>
                             <string>amount</string>
                             <string>total_price</string>
-                            <string>msg</string>
                             <string>site</string>
                             <string>vault</string>
                             <string>resource</string>
diff --git a/bt5/erp5_banking_cash/bt/revision b/bt5/erp5_banking_cash/bt/revision
index b6fdfc3c05..d4fa8df000 100644
--- a/bt5/erp5_banking_cash/bt/revision
+++ b/bt5/erp5_banking_cash/bt/revision
@@ -1 +1 @@
-609
\ No newline at end of file
+612
\ No newline at end of file
diff --git a/bt5/erp5_banking_cash/bt/template_portal_type_base_category_list b/bt5/erp5_banking_cash/bt/template_portal_type_base_category_list
index 040da6f383..0ce7a64195 100644
--- a/bt5/erp5_banking_cash/bt/template_portal_type_base_category_list
+++ b/bt5/erp5_banking_cash/bt/template_portal_type_base_category_list
@@ -9,6 +9,7 @@ Container Line | cash_status
 Container Line | emission_letter
 Container Line | variation
 Foreign Cash Reception | currency_exchange_type
+Internal Money Payment | payment_type
 Monetary Destruction Cell | variation
 Monetary Recall Cell | variation
 Money Deposit | source_trade
-- 
2.30.9