Commit ee9adc59 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor ERP5Site_newCredentialRequest to get categories from...

refactor ERP5Site_newCredentialRequest to get categories from portal_preferences. Add condition to check if the alarm will be called to approve credential requests or one mail will be sent to user to approve it.
parent 8ac9c40f
...@@ -56,6 +56,9 @@ reference -- User login is mandatory (String)\n ...@@ -56,6 +56,9 @@ reference -- User login is mandatory (String)\n
default_email_text -- Email is mandatory (String)"""\n default_email_text -- Email is mandatory (String)"""\n
# create the credential request\n # create the credential request\n
module = context.getDefaultModule(portal_type=\'Credential Request\')\n module = context.getDefaultModule(portal_type=\'Credential Request\')\n
portal_preferences = context.portal_preferences\n
category_list = portal_preferences.getPreferredSubscriptionAssignmentCategoryList()\n
\n
credential_request = module.newContent(\n credential_request = module.newContent(\n
\t\tportal_type="Credential Request",\n \t\tportal_type="Credential Request",\n
first_name=first_name,\n first_name=first_name,\n
...@@ -81,6 +84,8 @@ credential_request = module.newContent(\n ...@@ -81,6 +84,8 @@ credential_request = module.newContent(\n
birthday=birthday,\n birthday=birthday,\n
date_of_birth=date_of_birth)\n date_of_birth=date_of_birth)\n
\n \n
credential_request.setCategoryList(category_list)\n
\n
#We attach the current user to the credential request if not anonymous\n #We attach the current user to the credential request if not anonymous\n
if not context.portal_membership.isAnonymousUser():\n if not context.portal_membership.isAnonymousUser():\n
person = context.ERP5Site_getAuthenticatedMemberPersonValue()\n person = context.ERP5Site_getAuthenticatedMemberPersonValue()\n
...@@ -92,9 +97,18 @@ if not context.portal_membership.isAnonymousUser():\n ...@@ -92,9 +97,18 @@ if not context.portal_membership.isAnonymousUser():\n
if destination_decision:\n if destination_decision:\n
credential_request.setDestinationDecision(destination_decision)\n credential_request.setDestinationDecision(destination_decision)\n
\n \n
credential_request.submit("Automatic submit")\n if portal_preferences.getPreferredCredentialAlarmAutomaticCall():\n
portal_status_message = context.Base_translateString("Credential Request Created.")\n credential_request.submit("Automatic submit")\n
return context.Base_redirect(dialog_id, keep_items = dict(portal_status_message=portal_status_message ))\n message_str = "Credential Request Created."\n
else:\n
# Send email to subscriber in activities.\n
credential_request.activate(activity=\'SQLQueue\').CredentialRequest_sendSubmittedNotification(\n
context_url=context.absolute_url(),\n
notification_reference=\'erp5-subscription.notification\')\n
message_str = "Thanks for your registration. You will be receive an email to activate your account."\n
\n
return context.Base_redirect(dialog_id,\n
keep_items = dict(portal_status_message=context.Base_translateString(message_str)))\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</item> </item>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>ERP5Site_registerCredentialRequest</string> </value> <value> <string>ERP5Site_newCredentialRequest</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
......
351 352
\ No newline at end of file \ 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