From 58dab10e9b05ee4cbd289bd846b58640d7ebe39d Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Fri, 15 Apr 2011 15:17:50 +0000 Subject: [PATCH] Add support for non-default listbox field id. Also, remove a few no-ops. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45524 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../ListBox_initializeFastInput.xml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ListBox_initializeFastInput.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ListBox_initializeFastInput.xml index ee268ad9ec..e1d5aea053 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ListBox_initializeFastInput.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ListBox_initializeFastInput.xml @@ -54,7 +54,8 @@ from Products.ERP5Type.Document import newTempBase\n from string import zfill\n -\n +if listbox_id is None:\n + listbox_id = \'listbox\'\n \n request = context.REQUEST\n \n @@ -96,17 +97,14 @@ def sort_fast_input_lines(x, y):\n else:\n return 0\n \n -if hasattr(request, \'listbox\'):\n +if hasattr(request, listbox_id):\n + listbox_key = "%s_key" % listbox_id\n # initialize the listbox \n - listbox=request[\'listbox\']\n -\n + listbox=request[listbox_id]\n keys_list = listbox.keys()\n -\n if keys_list != []:\n - #keys_list.sort(lambda x,y: cmp(int(x),int(y)))\n if context.getPortalType() in (\'Monetary Issue\',):\n keys_list.sort(sort_container)\n - pass\n else:\n keys_list.sort(sort_fast_input_lines)\n first_empty_line_id = int(keys_list[-1])+1\n @@ -120,7 +118,7 @@ if hasattr(request, \'listbox\'):\n for key in listbox[i]:\n value = listbox[i][key]\n # 0 was added because of checkbox field in some fast input\n - if (value not in [\'\',None,0]) and (key != \'listbox_key\'):\n + if (value not in [\'\',None,0]) and (key != listbox_key):\n is_empty = 0\n if (request.has_key(\'field_errors\')):\n is_empty = 0\n @@ -147,7 +145,7 @@ return l\n </item> <item> <key> <string>_params</string> </key> - <value> <string>empty_line_number=0, **kw</string> </value> + <value> <string>empty_line_number=0, listbox_id=None, **kw</string> </value> </item> <item> <key> <string>id</string> </key> -- 2.30.9