diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserAssignedRootSiteList.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserAssignedRootSiteList.xml index 4241da4d416eb19f3bbe06ba0c60089a6cc7f8af..3c0be193431ab8dc9cf34f1740d363d7b7a4c1ea 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserAssignedRootSiteList.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserAssignedRootSiteList.xml @@ -74,9 +74,13 @@ for a in valid_assignment_list:\n new_site = a.getSiteValue()\n while new_site.getVaultType()!=\'site\':\n new_site = new_site.getParentValue()\n - site_url = new_site.getRelativeUrl()\n - if site_url not in site_list:\n - site_list.append(site_url)\n + if object:\n + if new_site not in site_list:\n + site_list.append(new_site)\n + else:\n + site_url = new_site.getRelativeUrl()\n + if site_url not in site_list:\n + site_list.append(site_url)\n return site_list\n </string> </value> </item> @@ -100,7 +104,7 @@ return site_list\n </item> <item> <key> <string>_params</string> </key> - <value> <string>user_id=None, **kw</string> </value> + <value> <string>user_id=None, object=0, **kw</string> </value> </item> <item> <key> <string>_proxy_roles</string> </key> @@ -128,13 +132,14 @@ return site_list\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>1</int> </value> + <value> <int>2</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> <string>user_id</string> + <string>object</string> <string>kw</string> <string>_getattr_</string> <string>context</string> @@ -157,6 +162,7 @@ return site_list\n <value> <tuple> <none/> + <int>0</int> </tuple> </value> </item> diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserSiteUid.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserSiteUid.xml index a6f10b458e49f6e64391c26aac0725ed65955058..13c570fe8bf9867fec84929bd1980e077b488672 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserSiteUid.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserSiteUid.xml @@ -70,7 +70,7 @@ user_id = context.portal_membership.getAuthenticatedMember().getUserName()\n \n def getUserSiteUid(user_id):\n - return context.Baobab_getUserAssignmentList(user_id)[0].getSiteUid()\n + return context.Baobab_getUserAssignedRootSiteList(user_id=user_id, object=1)[0].getSiteUid()\n \n \n getUserSiteUid = CachingMethod(getUserSiteUid, id=\'Baobab_getUserUserSiteUid\', cache_factory=\'erp5_ui_medium\')\n diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getPreviousState.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getPreviousState.xml new file mode 100644 index 0000000000000000000000000000000000000000..9d093d5378928c3938cd0293a60bfddb636a195a --- /dev/null +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_getPreviousState.xml @@ -0,0 +1,169 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string># Get the id of the user which last passed given transition on given workflow.\n +workflow_item_list = context.Base_getWorkflowHistoryItemList(workflow_id, display=0)\n +workflow_item_list.reverse()\n +previous_state = None\n +found_given_state = 0\n +for workflow_item in workflow_item_list:\n + current_state = workflow_item.getProperty(\'state\')\n + context.log(\'current_state\',current_state)\n + if current_state == state:\n + found_given_state = 1\n + continue\n + if found_given_state and (current_state != state):\n + previous_state = current_state\n + break\n +return previous_state\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>workflow_id, state</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>2</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>workflow_id</string> + <string>state</string> + <string>_getattr_</string> +<string>context</string> + <string>workflow_item_list</string> + <string>None</string> + <string>previous_state</string> + <string>found_given_state</string> + <string>_getiter_</string> + <string>workflow_item</string> + <string>current_state</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Base_getPreviousState</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision index 73181427a2868edd79f087fb2c0ac0fce92314b6..05cf25896dd490bcd4fab7bf941de67c6b30edee 100644 --- a/bt5/erp5_banking_core/bt/revision +++ b/bt5/erp5_banking_core/bt/revision @@ -1 +1 @@ -199 \ No newline at end of file +201 \ No newline at end of file