Commit 58dab10e authored by Vincent Pelletier's avatar Vincent Pelletier

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
parent 14027244
......@@ -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>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment