From 213a10313b49a0a847547b827f3ebb2ecd6cdee0 Mon Sep 17 00:00:00 2001
From: Mohamadou Mbengue <mmbengue@gmail.com>
Date: Mon, 21 Jun 2010 22:33:58 +0000
Subject: [PATCH] 2010-06-21 mohamadou * update generatePortalType to use good
 role category for role information definition * add publication_section
 category if procedure needs subscription

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36490 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../scripts/EGov_generatePortalType.xml       | 40 ++++++++++++-------
 bt5/erp5_egov/bt/change_log                   |  5 +++
 bt5/erp5_egov/bt/revision                     |  2 +-
 3 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/bt5/erp5_egov/WorkflowTemplateItem/portal_workflow/portal_type_interaction_workflow/scripts/EGov_generatePortalType.xml b/bt5/erp5_egov/WorkflowTemplateItem/portal_workflow/portal_type_interaction_workflow/scripts/EGov_generatePortalType.xml
index 277202925c..dad40dc14d 100644
--- a/bt5/erp5_egov/WorkflowTemplateItem/portal_workflow/portal_type_interaction_workflow/scripts/EGov_generatePortalType.xml
+++ b/bt5/erp5_egov/WorkflowTemplateItem/portal_workflow/portal_type_interaction_workflow/scripts/EGov_generatePortalType.xml
@@ -138,36 +138,44 @@ if len(result) == 0:\n
 \n
   procedure_target = procedure_request.getProcedureTarget()\n
   procedure_organisation_direction = procedure_request.getOrganisationDirectionService()\n
-\n
-  if procedure_target is not None:\n
+  procedure_publication_section =  procedure_request.getProcedurePublicationSection()\n
+  procedure_step_subscription = procedure_request.getStepSubscription()\n
+  \n
+  citizen_category_list = [\'role/citoyen\', \'role/citoyen/national\', \'role/citoyen/etranger\']\n
+  company_category_list = [\'role/entreprise\', \'role/entreprise/agence\', \'role/entreprise/siege\', \'role/entreprise/succursale\']\n
+  madatary_category_list = [\'function/entreprise/mandataire\', \'role/entreprise\']\n
+  procedure_publication_section_category = \'publication_section/%s\' % procedure_publication_section\n
+  \n
+  # If procedure needs subcription add the publication_section in role_category_list\n
+  if procedure_step_subscription:\n
+    citizen_category_list.append(procedure_publication_section_category)\n
+    company_category_list.append(procedure_publication_section_category)\n
+    madatary_category_list.append(procedure_publication_section_category)\n
+\n
+  if procedure_target :\n
     if procedure_target == "tous":\n
       portal_type_module.newContent(portal_type=\'Role Information\',\n
 \t\t      title=\'Citizens Role Information\',\n
 \t\t      role_name=\'Agent\',\n
-\t\t      #role_base_category_script_list=\'group function site\',\n
-\t\t      role_category_list=\'role/citoyen*\')\n
+\t\t      role_category_list=citizen_category_list)\n
       portal_type_module.newContent(portal_type=\'Role Information\',\n
 \t\t      title=\'Companies Role Information\',\n
 \t\t      role_name=\'Agent\',\n
-\t\t      #role_base_category_script_list=\'group function\',\n
-\t\t      role_category_list=\'role/entreprise*\')\n
+\t\t      role_category_list=company_category_list)\n
       portal_type_module.newContent(portal_type=\'Role Information\',\n
 \t\t      title=\'Mandataries Role Information\',\n
 \t\t      role_name=\'Agent\',\n
-\t\t      #role_base_category_script_list=\'group function\',\n
-\t\t      role_category_list=[\'function/entreprise/mandataire\', \'role/entreprise*\'])\n
+\t\t      role_category_list=madatary_category_list)\n
     if procedure_target=="citoyen":\n
       portal_type_module.newContent(portal_type=\'Role Information\',\n
 \t\t      title=\'Citizens Role Information\',\n
 \t\t      role_name=\'Agent\',\n
-\t\t      #role_base_category_script_list=\'group function site\',\n
-\t\t      role_category_list=\'role/citoyen*\')\n
+\t\t      role_category_list=citizen_category_list)\n
     if procedure_target == "entreprise":\n
       portal_type_module.newContent(portal_type=\'Role Information\',\n
 \t\t      title=\'Companies Role Information\',\n
 \t\t      role_name=\'Agent\',\n
-\t\t      #role_base_category_script_list=\'group function\',\n
-\t\t      role_category_list=\'role/entreprise*\')\n
+\t\t      role_category_list=company_category_list)\n
       \n
   if procedure_organisation_direction is not None:\n
     portal_type_module.newContent(portal_type=\'Role Information\',\n
@@ -176,8 +184,6 @@ if len(result) == 0:\n
 \t\t      role_category_list=\'group/%s*\' % procedure_organisation_direction)\n
 \n
 \n
-\n
-\n
 portal_type_module_id = \'_\'.join(portal_type_module_name.lower().split(\' \'))\n
 \n
 ## create folder containing objects\n
@@ -256,6 +262,12 @@ module_object.EGov_setPermissionsOnEGovModule(procedure_request)\n
                             <string>portal_type_module</string>
                             <string>procedure_target</string>
                             <string>procedure_organisation_direction</string>
+                            <string>procedure_publication_section</string>
+                            <string>procedure_step_subscription</string>
+                            <string>citizen_category_list</string>
+                            <string>company_category_list</string>
+                            <string>madatary_category_list</string>
+                            <string>procedure_publication_section_category</string>
                             <string>None</string>
                             <string>portal_type_module_id</string>
                             <string>getattr</string>
diff --git a/bt5/erp5_egov/bt/change_log b/bt5/erp5_egov/bt/change_log
index 1fc0c6fbc2..369186e8f6 100644
--- a/bt5/erp5_egov/bt/change_log
+++ b/bt5/erp5_egov/bt/change_log
@@ -1,3 +1,8 @@
+2010-06-21 mohamadou
+* update generatePortalType to use good role category for role information definition
+* add publication_section category if procedure needs subscription
+
+
 2010-06-20 mayoro
 * Add complete transition from accepted state
 *Add the title of the transition Complete, it should not be configured in the hosting form
diff --git a/bt5/erp5_egov/bt/revision b/bt5/erp5_egov/bt/revision
index 8853508e8a..1683d1104a 100644
--- a/bt5/erp5_egov/bt/revision
+++ b/bt5/erp5_egov/bt/revision
@@ -1 +1 @@
-555
\ No newline at end of file
+563
\ No newline at end of file
-- 
2.30.9