diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_Base_editAndRedirect.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_Base_editAndRedirect.xml new file mode 100644 index 0000000000000000000000000000000000000000..9770224bbcf4bc87e0a29a51032e0b8c0f515bdc --- /dev/null +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_Base_editAndRedirect.xml @@ -0,0 +1,207 @@ +<?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>Script_magic</string> </key> + <value> <int>3</int> </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># Retrieve the edit action\n +"""\n + Special edit method which returns to next_url view.\n + The next_url is used to define the URL to return to\n + after editing the document.\n +"""\n +\n +from Products.DCWorkflow.DCWorkflow import ValidationFailed\n +request=context.REQUEST\n +\n +message = \'\'\n +\n +# add the attachments :\n +translateString = context.Base_translateString\n +result, mode = context.Base_edit(\'PDFDocument_viewAttachmentReportSection\', silent_mode=1, field_prefix=\'your_\')\n +attachment_count = 0\n +\n +if mode == \'edit\':\n + (kw, encapsulated_editor_list) = result\n + if kw.has_key(\'attachment\') and kw.has_key(\'attachment_title\'):\n + attachment_list = zip(kw[\'attachment\'], kw[\'attachment_title\'])\n + message = translateString("No attachment was added. Please select a file to add an attachment.")\n + # XXX make sure it is a list\n + for attachment, title in attachment_list:\n + if attachment:\n + attachment_count += 1\n + file = context.newContent(portal_type=\'File\', file=attachment, title=title)\n +\n +if attachment_count:\n + message = translateString("Added ${attachment_count} attachment(s) to the current form.",\n + mapping = dict(attachment_count=attachment_count))\n +\n +# edit the document with the entered data before to change of state\n +base_edit_result = context.Base_edit(form_id=form_id, \n + selection_index=selection_index, \n + selection_name=selection_name, \n + dialog_id=dialog_id, \n + ignore_layout=ignore_layout, \n + editable_mode=editable_mode, \n + silent_mode=silent_mode, \n + field_prefix=field_prefix)\n +\n +# if there is somme errors (like required field not filled),\n +# return to the same page, and display Base_edit error message\n +if request.get(\'field_errors\', \'\'):\n + return base_edit_result\n +\n +return context.Base_redirect(next_url, keep_items = dict(portal_status_message=message), **kw)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>form_id, next_url, selection_index=0, selection_name=\'\', dialog_id=\'\', ignore_layout=0, editable_mode=1, silent_mode=0, field_prefix=\'my_\', **kw</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>9</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>form_id</string> + <string>next_url</string> + <string>selection_index</string> + <string>selection_name</string> + <string>dialog_id</string> + <string>ignore_layout</string> + <string>editable_mode</string> + <string>silent_mode</string> + <string>field_prefix</string> + <string>kw</string> + <string>Products.DCWorkflow.DCWorkflow</string> + <string>ValidationFailed</string> + <string>_getattr_</string> + <string>context</string> + <string>request</string> + <string>message</string> + <string>translateString</string> + <string>_getiter_</string> + <string>result</string> + <string>mode</string> + <string>attachment_count</string> + <string>encapsulated_editor_list</string> + <string>zip</string> + <string>_getitem_</string> + <string>attachment_list</string> + <string>attachment</string> + <string>title</string> + <string>_inplacevar_</string> + <string>file</string> + <string>dict</string> + <string>base_edit_result</string> + <string>_apply_</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <int>0</int> + <string></string> + <string></string> + <int>0</int> + <int>1</int> + <int>0</int> + <string>my_</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>EGov_Base_editAndRedirect</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_getAllowedFormTypeList.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_getAllowedFormTypeList.xml index f12a6c3593c5009c88d5a503134974657d6421a7..ddaf7bdd0e981c3d040e8edffb0c6b74f1267f65 100644 --- a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_getAllowedFormTypeList.xml +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_getAllowedFormTypeList.xml @@ -55,7 +55,7 @@ <key> <string>_body</string> </key> <value> <string>if context.portal_membership.isAnonymousUser():\n return (\'Subscription Form\',)\n -return (\'Declaration TVA\', \'Mandate Form\', \'Subscription Form\')\n +return (\'Declaration TVA\', \'Subscription Form\') #\'Mandate Form\' is not implemented yet\n </string> </value> </item> <item> diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_getUserDocumentRelativeUrl.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_getUserDocumentRelativeUrl.xml new file mode 100644 index 0000000000000000000000000000000000000000..f06c3c735e70feda37951c9603c136d311f798d9 --- /dev/null +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_getUserDocumentRelativeUrl.xml @@ -0,0 +1,150 @@ +<?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>Script_magic</string> </key> + <value> <int>3</int> </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>\'\'\'\n + In case of the user is a document, return the url of the this document\n +\'\'\'\n +\n +document_type_list = context.EGov_getAllowedFormTypeList()\n +portal = context.getPortalObject()\n +\n +user_name = context.portal_membership.getAuthenticatedMember().getUserName()\n +\n +form_list = portal.portal_catalog(\\\n + portal_type=document_type_list, \n + reference=user_name)\n +\n +if len(form_list) == 0:\n + return None\n +return form_list[0].getRelativeUrl()\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <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>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>_getattr_</string> + <string>context</string> + <string>document_type_list</string> + <string>portal</string> + <string>user_name</string> + <string>form_list</string> + <string>len</string> + <string>None</string> + <string>_getitem_</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_getUserDocumentRelativeUrl</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_goToDocument.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_goToDocument.xml index 286f42ba5f685c85974765309f9218c1870da912..940dc51e49b31e9fc4a2a79429c2971a1ff1f780 100644 --- a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_goToDocument.xml +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/EGov_goToDocument.xml @@ -60,17 +60,21 @@ if not application_number and id:\n application_number = id\n \n keep_items = {}\n +state = document.getValidationState()\n +\n +# default view is history view\n +form_id=\'PDFDocument_viewHistory\'\n \n if application_number:\n document = context.portal_catalog.getResultValue(id=application_number)\n if document is not None:\n - if document.getValidationState() == \'draft\':\n + if state == \'draft\':\n form_id=\'view\'\n - form_id=\'PDFDocument_viewHistory\'\n - if document.getPortalType() == \'Subscription Form\':\n - if document.getValidationState() != \'draft\':\n + elif document.getPortalType() == \'Subscription Form\':\n + if state != \'draft\':\n form_id=\'PDFDocument_viewAnonymousHistory\'\n return document.Base_redirect(form_id=form_id, keep_items=keep_items)\n +\n # Prepare message\n msg = N_(\'Sorry, this document is not available\')\n return context.Base_redirect(form_id=\'view\', keep_items = {\'portal_status_message\' : msg})\n @@ -125,8 +129,9 @@ return context.Base_redirect(form_id=\'view\', keep_items = {\'portal_status_mes <string>N_</string> <string>keep_items</string> <string>document</string> - <string>None</string> + <string>state</string> <string>form_id</string> + <string>None</string> <string>msg</string> </tuple> </value> diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/WebSite_login.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/WebSite_login.xml index 26d6a18c10495c671b6d468d23bb38051e3157bf..5746ac75a61781e9f911650de182d6a733d2317f 100644 --- a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/WebSite_login.xml +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/WebSite_login.xml @@ -54,9 +54,15 @@ dummy python: response.redirect(url);" />\n </tal:block>\n <tal:block tal:condition="not: isAnon">\n - <tal:block tal:condition="python: here.EGov_checkUserIsAPersonOrOrganisation()==False and here.EGov_getUserDocumentUrl() !=None">\n - <tal:block tal:define="came_from python: \'%s/PDFDocument_viewAnonymousHistory\' % here.EGov_getUserDocumentUrl();\n - dummy python: response.redirect(came_from);" />\n + <tal:block tal:condition="python: here.EGov_checkUserIsAPersonOrOrganisation() == False and here.EGov_getUserDocumentUrl() != None">\n + <tal:block tal:condition="python: here.restrictedTraverse(here.EGov_getUserDocumentRelativeUrl()).getValidationState() == \'draft\'">\n + <tal:block tal:define="came_from python: \'%s/view\' % here.EGov_getUserDocumentUrl();\n + dummy python: response.redirect(came_from);" />\n + </tal:block>\n + <tal:block tal:condition="python: here.restrictedTraverse(here.EGov_getUserDocumentRelativeUrl()).getValidationState() != \'draft\'">\n + <tal:block tal:define="came_from python: \'%s/PDFDocument_viewAnonymousHistory\' % here.EGov_getUserDocumentUrl();\n + dummy python: response.redirect(came_from);" />\n + </tal:block>\n </tal:block>\n <tal:block tal:condition="python: here.EGov_checkUserIsAPersonOrOrganisation()==True or here.EGov_getUserDocumentUrl()==None">\n <tal:block tal:define="came_from python: request.get(\'came_from\') or request.get(\'field_came_from\') or request.get(\'field_came_from\') or here.absolute_url() + \'/view\';\n diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewNextStepRenderer.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewNextStepRenderer.xml index 67ad682dceaa918c154d1916dbac349948ea8858..e753c4cbda6ce6140d08d9a24e559a4666e14a72 100644 --- a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewNextStepRenderer.xml +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewNextStepRenderer.xml @@ -59,7 +59,8 @@ <input type="hidden" name="current_action" value=""\n tal:attributes="value request/current_action" />-->\n <span class="onleft">\n - <button type="submit" class="save" title="Save" name="Base_edit:method" \n + <input type="hidden" name="next_url" value="PDFDocument_viewLoginInformation" />\n + <button type="submit" class="save" title="Save" name="EGov_Base_editAndRedirect:method" \n i18n:attributes="title" i18n:domain="ui">\n <span class="image"></span>\n <span class="description" i18n:translate="" i18n:domain="ui">Save draft and continue later</span>\n diff --git a/bt5/erp5_egov/TestTemplateItem/testEGovMixin.py b/bt5/erp5_egov/TestTemplateItem/testEGovMixin.py index 7f8dd66153796adafb00306565069178e0d6c094..7467ee6bdaf1ac17e6bb09c6267cefba87962b63 100644 --- a/bt5/erp5_egov/TestTemplateItem/testEGovMixin.py +++ b/bt5/erp5_egov/TestTemplateItem/testEGovMixin.py @@ -120,7 +120,7 @@ class TestEGovMixin(SecurityTestCase): # add a dummy mailhost not to send real messages if 'MailHost' in self.portal.objectIds(): self.portal.manage_delObjects(['MailHost']) - self.portal._setObject('MailHost', DummyMailHost('MailHost')) + self.portal._setObject('MailHost', DummyMailHost('MailHost')) # remove all message in the message_table because # the previous test might have failed diff --git a/bt5/erp5_egov/WorkflowTemplateItem/portal_workflow/egov_interaction_workflow/scripts/checkAccountInexistance.xml b/bt5/erp5_egov/WorkflowTemplateItem/portal_workflow/egov_interaction_workflow/scripts/checkAccountInexistance.xml index a5d77b9ca2f04b3a215b7a930d15b842a9e42a77..ffecb84349dae814cf8a7c603e8bd4cc45d623ef 100644 --- a/bt5/erp5_egov/WorkflowTemplateItem/portal_workflow/egov_interaction_workflow/scripts/checkAccountInexistance.xml +++ b/bt5/erp5_egov/WorkflowTemplateItem/portal_workflow/egov_interaction_workflow/scripts/checkAccountInexistance.xml @@ -57,19 +57,22 @@ changed_object = state_change[\'object\']\n login = changed_object.getCompanyName().lower()\n +portal_catalog = changed_object.portal_catalog\n +ninea = changed_object.getNinea()\n \n -# check that no existing organisation have the same RCCM number or login\n +# check that no existing organisation have the same NINEA number or login\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n \n -result = changed_object.portal_catalog(portal_type=\'Organisation\',\n - corporate_registration_code=changed_object.getRccm())\n +result = portal_catalog( portal_type=\'Organisation\',\n + vat_code=changed_object.getNinea())\n +\n if len(result) > 1:\n raise ValidationFailed, "Error : There is more than one company with the "\\\n - " registration code \'%s\'" % changed_object.getRccm()\n + " NINEA code \'%s\'" % ninea \n \n if len(result) == 1 and result[0].getObject().getReference():\n - raise ValidationFailed, "Error : A company with the registration code \'%s\'"\\\n - " already exists and have already an account" % changed_object.getRccm()\n + raise ValidationFailed, "Error : A company with the NINEA code \'%s\'"\\\n + " already exists and have already an account" % ninea\n \n if len((changed_object.portal_catalog(portal_type=\'Organisation\',\n reference=login))):\n @@ -126,6 +129,8 @@ if len((changed_object.portal_catalog(portal_type=\'Organisation\',\n <string>changed_object</string> <string>_getattr_</string> <string>login</string> + <string>portal_catalog</string> + <string>ninea</string> <string>Products.DCWorkflow.DCWorkflow</string> <string>ValidationFailed</string> <string>result</string> diff --git a/bt5/erp5_egov/bt/change_log b/bt5/erp5_egov/bt/change_log index c1e89882e453c2e61c15d0d17fa27b87181ba4bc..59986c7b0ec04442c659dcc07780813b19563608 100644 --- a/bt5/erp5_egov/bt/change_log +++ b/bt5/erp5_egov/bt/change_log @@ -1,3 +1,12 @@ +2008-10-10 fabien +bring some corrections after the Mme Ba review : +* remove Mandate form from the allowed form list because it's not implemented yet +* improve EGov_goToDocument script +* update WebSite_login page template to redirect form user on view if the state of the document is draft (to be able to continue the subscription) +* modify checkAccountInexistance workflow script to use ninea number instead of rccm one to check that the company don't exists +* modify "Save draft and continue later" button behavior. Now when you click on, data are saved and a page is displayed with your credentials (if it's an anonymous application) +* add EGov_Base_editAndRedirect script that save the data of the current form and redirect to + 2008-09-25 fabien * modify some selection_name on listbox to be unique and avoid conflic diff --git a/bt5/erp5_egov/bt/revision b/bt5/erp5_egov/bt/revision index eb8f2fa1aeb162439e4756fc55642cad6c193cff..e41567feb87fd40d6e88e91674e66a77a5074304 100644 --- a/bt5/erp5_egov/bt/revision +++ b/bt5/erp5_egov/bt/revision @@ -1 +1 @@ -379 \ No newline at end of file +384 \ No newline at end of file