workflows: call to get_submitter_email instead of reimplementing it
This commit is contained in:
parent
3e6de7a813
commit
1dc60256bc
|
@ -693,6 +693,9 @@ class FormDef(StorableObject):
|
|||
# if there is no user, or user has no email address, look
|
||||
# up in submitted form for one that would hold the user
|
||||
# email (the one set to be prefilled by user email)
|
||||
if not formdata.data:
|
||||
return None
|
||||
|
||||
fields = formdata.formdef.fields
|
||||
for field in fields:
|
||||
if not hasattr(field, 'prefill'):
|
||||
|
|
|
@ -1259,32 +1259,9 @@ class SendmailWorkflowStatusItem(WorkflowStatusItem):
|
|||
continue
|
||||
|
||||
if dest == '_submitter':
|
||||
field_email = users_cfg.get('field_email') or 'email'
|
||||
done = False
|
||||
if formdata.user:
|
||||
if formdata.user.email:
|
||||
addresses.append(formdata.user.email)
|
||||
done = True
|
||||
elif formdata.user.form_data and formdata.user.form_data.get(field_email):
|
||||
addresses.append(formdata.user.form_data.get(field_email))
|
||||
done = True
|
||||
|
||||
if not done:
|
||||
# if there is no user, or user has no email address, look
|
||||
# up in submitted form for one that would hold the user
|
||||
# email (the one set to be prefilled by user email)
|
||||
fields = formdata.formdef.fields
|
||||
for field in fields:
|
||||
if not hasattr(field, 'prefill'):
|
||||
continue
|
||||
if field.prefill and field.prefill.get('type') == 'user':
|
||||
if field.prefill.get('value') == field_email:
|
||||
v = formdata.data.get(field.id)
|
||||
if v:
|
||||
addresses.append(v)
|
||||
done = True
|
||||
break
|
||||
|
||||
submitter_email = formdata.formdef.get_submitter_email(formdata)
|
||||
if submitter_email:
|
||||
addresses.append(submitter_email)
|
||||
continue
|
||||
|
||||
dest = get_role_translation(formdata, dest)
|
||||
|
|
Loading…
Reference in New Issue