From fcc99b62bac0241a2476198abddb43a4241bfe13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com> Date: Mon, 6 Jul 2009 07:49:58 +0000 Subject: [PATCH] add a validator for "bank account reference" field in fast input git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27939 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../Baobab_referenceValidator.xml | 162 ++++++++++++++++++ .../your_reference.xml | 24 ++- bt5/erp5_banking_check/bt/revision | 2 +- 3 files changed, 184 insertions(+), 4 deletions(-) create mode 100644 bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Baobab_referenceValidator.xml diff --git a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Baobab_referenceValidator.xml b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Baobab_referenceValidator.xml new file mode 100644 index 0000000000..0ed667055e --- /dev/null +++ b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Baobab_referenceValidator.xml @@ -0,0 +1,162 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>if editor in (None, \'\'): \n + return 1\n +\n +reference = editor\n +\n +bank_account_list = context.portal_catalog(portal_type="Bank Account", string_index=reference)\n +\n +if len(bank_account_list) != 1:\n + return 0\n +\n +return 1\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>editor, request</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>2</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>editor</string> + <string>request</string> + <string>None</string> + <string>reference</string> + <string>_getattr_</string> + <string>context</string> + <string>bank_account_list</string> + <string>len</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Baobab_referenceValidator</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckbookDelivery_fastInputForm/your_reference.xml b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckbookDelivery_fastInputForm/your_reference.xml index 1835c2dc9b..22b9cd05a1 100644 --- a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckbookDelivery_fastInputForm/your_reference.xml +++ b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckbookDelivery_fastInputForm/your_reference.xml @@ -25,7 +25,7 @@ <dictionary> <item> <key> <string>external_validator_failed</string> </key> - <value> <string>The input failed the external validator.</string> </value> + <value> <string>None or many bank account found for the given reference</string> </value> </item> <item> <key> <string>required_not_found</string> </key> @@ -214,7 +214,7 @@ </item> <item> <key> <string>display_width</string> </key> - <value> <int>20</int> </value> + <value> <int>10</int> </value> </item> <item> <key> <string>editable</string> </key> @@ -226,7 +226,9 @@ </item> <item> <key> <string>external_validator</string> </key> - <value> <string></string> </value> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> </item> <item> <key> <string>extra</string> </key> @@ -266,4 +268,20 @@ </dictionary> </pickle> </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="Method" module="Products.Formulator.MethodField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>method_name</string> </key> + <value> <string>Baobab_referenceValidator</string> </value> + </item> + </dictionary> + </pickle> + </record> </ZopeData> diff --git a/bt5/erp5_banking_check/bt/revision b/bt5/erp5_banking_check/bt/revision index 3cf63f91e6..82a1667ba9 100644 --- a/bt5/erp5_banking_check/bt/revision +++ b/bt5/erp5_banking_check/bt/revision @@ -1 +1 @@ -425 \ No newline at end of file +426 \ No newline at end of file -- 2.30.9