Commit ca04376d authored by Jérome Perrin's avatar Jérome Perrin

Also skip categories on which the user doesn't have View permission in matrix cell range scripts

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18843 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a2c78cdc
......@@ -78,7 +78,9 @@ def framing(cell, name):\n
e.g. : \'2682.0 <= Tranche B < 10728\'\n
\'\'\'\n
if cell is None:\n
raise "PaySheetModelLine_asCellRange Error", "cell is None"\n
# This error happens when the cell is not found in the parent model or any\n
# inherited model.\n
raise "PaySheetModelLine_asCellRange Error", "cell is None for %s" % name\n
return \'%s <= %s < %s\' % (str(cell.getQuantityRangeMin()), name,\n
str(cell.getQuantityRangeMax()))\n
\n
......@@ -93,7 +95,8 @@ if matrixbox :\n
base_category_list = resource.getVariationBaseCategoryList()\n
for base_category in base_category_list:\n
category_cell_range = []\n
category_item_list = context.getVariationCategoryItemList(base_category_list = (base_category,))\n
category_item_list = context.getVariationCategoryItemList(base_category_list = (base_category,),\n
checked_permission=\'View\')\n
for category_item in category_item_list:\n
if base_category == \'salary_range\':\n
category_cell_range.append((category_item[1],\\\n
......
......@@ -77,13 +77,14 @@ for category in context.getVariationSettingsCategoryList():\n
category_name = category.replace(\'salary_range/\',\'\',1)\n
if context.portal_categories.getCategoryValue(category) is None:\n
context.log(\'Category %s not found.\' % category)\n
raise ValueError, \'no category %s\' % category\n
else:\n
if matrixbox:\n
category_list.extend(context.portal_categories.getCategoryValue(category).getCategoryChildLogicalPathItemList(is_right_display=1, base=1)[1:])\n
category_list.extend(context.portal_categories.getCategoryValue(category).getCategoryChildLogicalPathItemList(checked_permission=\'View\', is_right_display=1, base=1)[1:])\n
#category_list.extend(context.portal_categories.getCategoryValue(category).getCategoryChildItemList(base=1, is_right_display=1)[1:])\n
else:\n
cat_list = [cat[0] for cat in\n
context.portal_categories.salary_range[category_name].getCategoryChildItemList(base=1)[1:]]\n
context.portal_categories.salary_range[category_name].getCategoryChildItemList(checked_permission=\'View\', base=1)[1:]]\n
category_list.append(cat_list)\n
\n
return category_list\n
......@@ -139,6 +140,7 @@ return category_list\n
<string>category</string>
<string>category_name</string>
<string>None</string>
<string>ValueError</string>
<string>_getitem_</string>
<string>append</string>
<string>$append0</string>
......
201
\ No newline at end of file
202
\ No newline at end of file
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