Commit 20e0580a authored by Fabien Morin's avatar Fabien Morin

* translate attachement title from french to english

* update PDFDocument_validateFormDataBeforeSubmission from
egov_anonymous_workflow
* update SubscriptionForm_createAccount script to not have proxyrole and add
EGov_setPasswordAsManager script with manager proxyrole
* add roles on organisation_module

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21341 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 509dbcf5
<local_roles_item>
<local_roles>
<role id='CSC_DGID-DI-CGE'>
<item>Author</item>
</role>
<role id='DGID-DI-CGE'>
<item>Auditor</item>
</role>
<role id='admin'>
<item>Owner</item>
</role>
</local_roles>
<group_local_roles>
</group_local_roles>
</local_roles_item>
\ No newline at end of file
......@@ -67,28 +67,41 @@
<key> <string>_body</string> </key>
<value> <string>\'\'\'This script check that all required files have been uploaded\'\'\'\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
portal = state_change.getPortalObject()\n
document = state_change[\'object\']\n
portal = document.getPortalObject()\n
N_ = portal.Base_translateString\n
\n
document = state_change[\'object\']\n
portal_type = document.getPortalType()\n
\n
# dict of required documents\n
attachement_type_dict = {\'Carte ID\':\'Required\',\n
\'Tableau des d\xc3\xa9penses\':\'Optional\',\n
\'D\xc3\xa9tail des \xc3\xa9xon\xc3\xa9ratations\':\'Required\',\n
\'Application Certificate\':\'Optional\',\n
attachement_type_dict = { \'Declaration TVA\':\n
{\n
\'ID Card\':\'Required\',\n
\'Expenditure Table\':\'Optional\',\n
\'Exemptions Details\':\'Required\',\n
\'Application Certificate\':\'Optional\',\n
},\n
\'Subscription Form\':\n
{\n
\'ID Card\':\'Required\',\n
\'M0 Form\':\'Required\',\n
}\n
}\n
\n
# if the portal type is not mapped, no attached files are required\n
if not attachement_type_dict.has_key(portal_type):\n
return\n
\n
document_title_list = [x.getTitle() for x in document.contentValues(portal_type=\'File\')]\n
\n
required_title_list = [x for x,y in attachement_type_dict.items() if y == \'Required\']\n
# get only required documents\n
required_title_list = [x for x,y in attachement_type_dict[portal_type].items() if y == \'Required\']\n
\n
message = \'The following documents are missing to submit the request :\'\n
missing_document_list = []\n
for required_title in required_title_list:\n
if required_title not in document_title_list:\n
missing_document_list.append(\'%s\' % required_title)\n
missing_document_list.append(N_(required_title))\n
\n
if len(missing_document_list):\n
message = N_(message)\n
......@@ -138,11 +151,11 @@ if len(missing_document_list):\n
<string>state_change</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>_getitem_</string>
<string>document</string>
<string>_getattr_</string>
<string>portal</string>
<string>N_</string>
<string>_getitem_</string>
<string>document</string>
<string>portal_type</string>
<string>attachement_type_dict</string>
<string>append</string>
......
<?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>organisation.setPassword(password)\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>_params</string> </key>
<value> <string>organisation, password</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>organisation</string>
<string>password</string>
<string>_getattr_</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>EGov_setPasswordAsManager</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -76,9 +76,9 @@ portal_type = document.getPortalType()\n
# dict of required documents\n
attachement_type_dict = { \'Declaration TVA\':\n
{\n
\'Carte ID\':\'Required\',\n
\'Tableau des d\xc3\xa9penses\':\'Optional\',\n
\'D\xc3\xa9tail des \xc3\xa9xon\xc3\xa9ratations\':\'Required\',\n
\'ID Card\':\'Required\',\n
\'Expenditure Table\':\'Optional\',\n
\'Exemptions Details\':\'Required\',\n
\'Application Certificate\':\'Optional\',\n
},\n
\'Subscription Form\':\n
......
......@@ -65,28 +65,34 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = state_change.getPortalObject()\n
<value> <string>changed_object = state_change[\'object\']\n
\n
portal = changed_object.getPortalObject()\n
organisation_module = portal.getDefaultModule(portal_type=\'Organisation\')\n
new_organisation = organisation_module.newContent(portal_type=\'Organisation\')\n
\n
changed_object = state_change[\'object\']\n
new_organisation.setTitle(changed_object.getCompanyName())\n
new_organisation.setCorporateName(changed_object.getCompanyName())\n
new_organisation.setAddressStreetAddress(changed_object.getAddressStreetAddress())\n
new_organisation.setAddressZipCode(changed_object.getAddressZipCode())\n
new_organisation.setAddressCity(changed_object.getAddressCity())\n
new_organisation.setAddressRegion(changed_object.getAddressRegion())\n
new_organisation.setCorporateRegistrationCode(changed_object.getNinea())\n
login = changed_object.getCompanyName().lower()\n
\n
# XXX this should not be hardcoded\n
new_organisation.setRole(\'registry/entreprise\')\n
new_organisation = organisation_module.newContent(\\\n
portal_type=\'Organisation\',\n
title=changed_object.getCompanyName(),\n
corporate_name=changed_object.getCompanyName(),\n
address_street_address=changed_object.getAddressStreetAddress(),\n
address_zip_code=changed_object.getAddressZipCode(),\n
address_city=changed_object.getAddressCity(),\n
address_region=changed_object.getAddressRegion(),\n
corporate_registration_code=changed_object.getNinea(),\n
role=\'registry/entreprise\', #XXX this should not be hardcoded\n
reference=login)\n
\n
login = changed_object.getCompanyName().lower()\n
new_organisation.setReference(login)\n
\n
# set the password required a manager role, so a script with a proxy role is\n
# used\n
password = changed_object.Person_generatePassword()\n
new_organisation.setPassword(password)\n
context.EGov_setPasswordAsManager(new_organisation, password)\n
\n
#here, call a method to send credentials by mail\n
# here, call a method to send credentials by email\n
# XXX in the future, it should be possible to chose the mean to receive\n
# credentials (email, sms, postal mail)\n
user_email = changed_object.getEmail()\n
changed_object.sendCrendentialsByEMail(login, password, user_email)\n
</string> </value>
......@@ -110,9 +116,7 @@ changed_object.sendCrendentialsByEMail(login, password, user_email)\n
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -140,14 +144,15 @@ changed_object.sendCrendentialsByEMail(login, password, user_email)\n
<value>
<tuple>
<string>state_change</string>
<string>_getitem_</string>
<string>changed_object</string>
<string>_getattr_</string>
<string>portal</string>
<string>organisation_module</string>
<string>new_organisation</string>
<string>_getitem_</string>
<string>changed_object</string>
<string>login</string>
<string>new_organisation</string>
<string>password</string>
<string>context</string>
<string>user_email</string>
</tuple>
</value>
......
125
\ No newline at end of file
127
\ No newline at end of file
organisation_module
\ 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