Commit e675f4cd authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Save language on the Subscription Request

The user language will be stored on Subscription Request and on Person, defining the language used to notify the customer.
parent 5fa88f9b
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<portal_type id="Subscription Request"> <portal_type id="Subscription Request">
<item>Amount</item> <item>Amount</item>
<item>CredentialRequest</item> <item>CredentialRequest</item>
<item>DublinCore</item>
<item>HostingSubscription</item> <item>HostingSubscription</item>
<item>Person</item> <item>Person</item>
<item>Price</item> <item>Price</item>
......
...@@ -19,15 +19,17 @@ if confirmation_required and not person_is_new: ...@@ -19,15 +19,17 @@ if confirmation_required and not person_is_new:
user_input_dict["amount"], user_input_dict["amount"],
subscription_reference)) subscription_reference))
target_language = context.getPortalObject().Localizer.get_selected_language()
subscription_request = context.subscription_request_module.newContent( subscription_request = context.subscription_request_module.newContent(
portal_type="Subscription Request", portal_type="Subscription Request",
destination_section_value=person, destination_section_value=person,
quantity=user_input_dict["amount"] quantity=user_input_dict["amount"],
language=target_language
) )
subscription_request.setDefaultEmailText(email) subscription_request.setDefaultEmailText(email)
target_language = context.getPortalObject().Localizer.get_selected_language()
def wrapWithShadow(subscription_request, amount, subscription_reference): def wrapWithShadow(subscription_request, amount, subscription_reference):
subscription_request.activate(tag="subscription_condition_%s" % subscription_request.getId() subscription_request.activate(tag="subscription_condition_%s" % subscription_request.getId()
......
# Update update user information, by creating
# - creating one cloud contract
# Send an email for the user with a URL, so he can set the password. # Send an email for the user with a URL, so he can set the password.
# Create conpensation payment for future payment, and attach to the subscription request
# Person_findPartition must check if Subscription Request is on confirmed state to allocate.
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
portal = context.getPortalObject() portal = context.getPortalObject()
portal_preferences = context.portal_preferences portal_preferences = portal.portal_preferences
reference = None reference = None
password = None password = None
...@@ -18,6 +13,9 @@ person = context.getDestinationSectionValue(portal_type="Person") ...@@ -18,6 +13,9 @@ person = context.getDestinationSectionValue(portal_type="Person")
if person.getDefaultEmailText() is None: if person.getDefaultEmailText() is None:
person.setDefaultEmailText(context.getDefaultEmailText()) person.setDefaultEmailText(context.getDefaultEmailText())
if person.getLanguage() in [None, ""]:
person.setLanguage(context.getLanguage())
# Should come from subscription condition probably or preference # Should come from subscription condition probably or preference
role_list = ['member', 'subscriber'] role_list = ['member', 'subscriber']
...@@ -25,7 +23,7 @@ open_assignment_list = person.searchFolder(portal_type="Assignment", ...@@ -25,7 +23,7 @@ open_assignment_list = person.searchFolder(portal_type="Assignment",
validation_state="open") validation_state="open")
# Initialisation # Initialisation
assignment_duration = context.portal_preferences.getPreferredCredentialAssignmentDuration() assignment_duration = portal_preferences.getPreferredCredentialAssignmentDuration()
today = DateTime() today = DateTime()
delay = today+assignment_duration delay = today+assignment_duration
......
...@@ -6,6 +6,7 @@ Subscription Condition | TextDocument ...@@ -6,6 +6,7 @@ Subscription Condition | TextDocument
Subscription Condition | Url Subscription Condition | Url
Subscription Request | Amount Subscription Request | Amount
Subscription Request | CredentialRequest Subscription Request | CredentialRequest
Subscription Request | DublinCore
Subscription Request | HostingSubscription Subscription Request | HostingSubscription
Subscription Request | Person Subscription Request | Person
Subscription Request | Price Subscription Request | Price
......
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