Commit c2f61e68 authored by Fabien Morin's avatar Fabien Morin

bring some corrections after the Mme Ba (dgid) 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

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24129 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ff3e9a53
<?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>
......@@ -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>
......
<?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>
......@@ -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>
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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>
......
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
......
379
\ No newline at end of file
384
\ 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