Commit 737aa320 authored by Łukasz Nowak's avatar Łukasz Nowak

- test each category object before expiration

In 32760 isTransitionPossible was used to test if portal type is associated
with a workflow providing such transition. It was wrong oversimplification.

It is required to test each object if expiration can be made, so it will solve
both issues - object is not related with workflow providing such action and
object is in state, from which expiration is not possible.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32764 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b9de5272
...@@ -274,7 +274,6 @@ for base_category_id in base_category_id_list:\n ...@@ -274,7 +274,6 @@ for base_category_id in base_category_id_list:\n
category_to_delete_list.append(category.getRelativeUrl())\n category_to_delete_list.append(category.getRelativeUrl())\n
\n \n
if not simulation_mode:\n if not simulation_mode:\n
\n
# Delete unused categories\n # Delete unused categories\n
if existing_category_list == \'delete\':\n if existing_category_list == \'delete\':\n
for category in category_to_delete_list:\n for category in category_to_delete_list:\n
...@@ -290,14 +289,12 @@ if not simulation_mode:\n ...@@ -290,14 +289,12 @@ if not simulation_mode:\n
if category is not None:\n if category is not None:\n
category.edit(**{\'expiration_date\':expiration_date})\n category.edit(**{\'expiration_date\':expiration_date})\n
else:\n else:\n
for category in category_to_delete_list:\n isTransitionPossible = context.getPortalObject().portal_workflow \\\n
expiration_possible = context.getPortalObject().portal_workflow \\\n .isTransitionPossible\n
.isTransitionPossible(category, \'expire\')\n
break\n
if expiration_possible:\n
for category in category_to_delete_list:\n for category in category_to_delete_list:\n
category = context.portal_categories.resolveCategory(category)\n category = context.portal_categories.resolveCategory(category)\n
if category is not None:\n if category is not None \\\n
and isTransitionPossible(category, \'expire\'):\n
category.expire()\n category.expire()\n
\n \n
\n \n
...@@ -433,7 +430,7 @@ return context.REQUEST.RESPONSE.redirect(\n ...@@ -433,7 +430,7 @@ return context.REQUEST.RESPONSE.redirect(\n
<string>category_to_delete_list</string> <string>category_to_delete_list</string>
<string>base_category_id</string> <string>base_category_id</string>
<string>parent</string> <string>parent</string>
<string>expiration_possible</string> <string>isTransitionPossible</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
1477 1478
\ No newline at end of file \ 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