respect email settings in default workflow

This commit is contained in:
Frédéric Péters 2012-08-16 13:25:02 +02:00
parent a861d290b0
commit 9268ccaec6
2 changed files with 21 additions and 11 deletions

View File

@ -609,7 +609,7 @@ class FormDef(StorableObject):
from qommon.admin.emails import EmailsDirectory
EmailsDirectory.register('new_user', N_('Notification of creation to user'),
N_('Available variables: user, name, url, details'), enabled = False,
enabled = False,
category = N_('Workflow'),
default_subject = N_('New form ([name])'),
default_body = N_('''\

View File

@ -213,36 +213,46 @@ class Workflow(StorableObject):
notify_new_receiver_email.to = ['_receiver']
notify_new_receiver_email.subject = EmailsDirectory.get_subject('new_receiver')
notify_new_receiver_email.body = EmailsDirectory.get_body('new_receiver')
if not EmailsDirectory.is_enabled('new_receiver'):
notify_new_receiver_email = None
notify_new_user_email = SendmailWorkflowStatusItem()
notify_new_user_email.id = '_notify_new_user_email'
notify_new_user_email.to = ['_submitter']
notify_new_user_email.subject = EmailsDirectory.get_subject('new_user')
notify_new_user_email.body = EmailsDirectory.get_body('new_user')
if not EmailsDirectory.is_enabled('new_user'):
notify_change_user_email = None
notify_change_receiver_email = SendmailWorkflowStatusItem()
notify_change_receiver_email.id = '_notify_change_receiver_email'
notify_change_receiver_email.to = ['_receiver']
notify_change_receiver_email.subject = EmailsDirectory.get_subject('change_receiver')
notify_change_receiver_email.body = EmailsDirectory.get_body('change_receiver')
if not EmailsDirectory.is_enabled('change_receiver'):
notify_change_receiver_email = None
notify_change_user_email = SendmailWorkflowStatusItem()
notify_change_user_email.id = '_notify_change_user_email'
notify_change_user_email.to = ['_submitter']
notify_change_user_email.subject = EmailsDirectory.get_subject('change_user')
notify_change_user_email.body = EmailsDirectory.get_body('change_user')
if not EmailsDirectory.is_enabled('change_user'):
notify_change_user_email = None
new_status.items.append(notify_new_receiver_email)
new_status.items.append(notify_new_user_email)
if notify_new_receiver_email:
new_status.items.append(notify_new_receiver_email)
if notify_new_user_email:
new_status.items.append(notify_new_user_email)
accepted_status.items.append(notify_change_receiver_email)
accepted_status.items.append(notify_change_user_email)
rejected_status.items.append(notify_change_receiver_email)
rejected_status.items.append(notify_change_user_email)
finished_status.items.append(notify_change_receiver_email)
finished_status.items.append(notify_change_user_email)
if notify_change_receiver_email:
accepted_status.items.append(notify_change_receiver_email)
rejected_status.items.append(notify_change_receiver_email)
finished_status.items.append(notify_change_receiver_email)
if notify_change_user_email:
accepted_status.items.append(notify_change_user_email)
rejected_status.items.append(notify_change_user_email)
finished_status.items.append(notify_change_user_email)
accept = ChoiceWorkflowStatusItem()
accept.id = '_accept'