diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/ERP5Site_getSecurityFromWorkflowAssignment.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/ERP5Site_getSecurityFromWorkflowAssignment.xml index 355e888f9226f3e5e001a3433c936538ae6fb4b9..4abdc11bd91edf39b6dd197e4f09f5403e8693d1 100644 --- a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/ERP5Site_getSecurityFromWorkflowAssignment.xml +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/ERP5Site_getSecurityFromWorkflowAssignment.xml @@ -79,23 +79,31 @@ The parameters are\n \n NOTE: for now, this script requires proxy manager\n """\n +from Products.CMFCore.WorkflowCore import WorkflowException\n \n portal_workflow = context.getPortalObject().portal_workflow\n \n -history_list = context.portal_workflow.getInfoFor(ob=context, \n - name=\'history\', wf_id=\'egov_universal_workflow\')\n -# reverse the list to get the first assign user\n -history_list = list(history_list)\n -history_list.reverse()\n -\n last_site, last_group, last_function, last_user = (None, None, None, None)\n -for history_line in history_list:\n - if history_line.has_key(\'assigned_group\') and history_line[\'assigned_group\']:\n - last_group = history_line[\'assigned_group\']\n - last_function = history_line[\'assigned_function\']\n - last_site = history_line[\'assigned_site\']\n - if history_line.has_key(\'assigned_user\') and history_line[\'assigned_user\']:\n - last_user = history_line[\'assigned_user\']\n +\n +wf_list = [x for x, y in context.getWorkflowStateItemList()]\n +for wf_id in wf_list: \n + try:\n + history_list = context.portal_workflow.getInfoFor(ob=context, \n + name=\'history\', wf_id=wf_id)\n + except WorkflowException:\n + continue\n +\n + # reverse the list to get the first assign user\n + history_list = list(history_list)\n + history_list.reverse()\n +\n + for history_line in history_list:\n + if history_line.has_key(\'assigned_group\') and history_line[\'assigned_group\']:\n + last_group = history_line[\'assigned_group\']\n + last_function = history_line[\'assigned_function\']\n + last_site = history_line[\'assigned_site\']\n + if history_line.has_key(\'assigned_user\') and history_line[\'assigned_user\']:\n + last_user = history_line[\'assigned_user\']\n \n if last_group:\n return [{\'function\': last_function,\n @@ -159,17 +167,25 @@ return []\n <string>user_name</string> <string>object</string> <string>portal_type</string> + <string>Products.CMFCore.WorkflowCore</string> + <string>WorkflowException</string> <string>_getattr_</string> <string>context</string> <string>portal_workflow</string> - <string>history_list</string> - <string>list</string> <string>None</string> <string>_getiter_</string> <string>last_site</string> <string>last_group</string> <string>last_function</string> <string>last_user</string> + <string>append</string> + <string>$append0</string> + <string>x</string> + <string>y</string> + <string>wf_list</string> + <string>wf_id</string> + <string>history_list</string> + <string>list</string> <string>history_line</string> <string>_getitem_</string> <string>user</string> diff --git a/bt5/erp5_egov/bt/change_log b/bt5/erp5_egov/bt/change_log index a1232bfde16ca97310f1bb53685beb7464cabc54..8c1374e988ae7f1963ae2c309b85204ae0d53d68 100644 --- a/bt5/erp5_egov/bt/change_log +++ b/bt5/erp5_egov/bt/change_log @@ -1,3 +1,6 @@ +2008-10-20 fabien +* update ERP5Site_getSecurityFromLatestWorkflowHistory to remove workflow hardcoded value + 2008-10-16 fabien * change css to have all the tabs of the forms (actions) on the right instead of have the first on right and the others in the middle diff --git a/bt5/erp5_egov/bt/revision b/bt5/erp5_egov/bt/revision index 50b04dff0ea766f7fa6d8487eec7ff0a9a3611b8..5587802b4e488e50d8c558c30f51fd77fa0708d8 100644 --- a/bt5/erp5_egov/bt/revision +++ b/bt5/erp5_egov/bt/revision @@ -1 +1 @@ -402 \ No newline at end of file +405 \ No newline at end of file