add personalization options
This commit is contained in:
@@ -94,11 +94,27 @@ class ProcessSubmitterCompletionJob
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
to = build_to_addresses(submitter)
|
maybe_enqueue_copy_emails(submitter)
|
||||||
|
end
|
||||||
|
|
||||||
return if to.blank? || submitter.template.preferences['documents_copy_email_enabled'] == false
|
def maybe_enqueue_copy_emails(submitter)
|
||||||
|
return if submitter.template.preferences['documents_copy_email_enabled'] == false
|
||||||
|
|
||||||
SubmitterMailer.documents_copy_email(submitter, to:).deliver_later!
|
configs = AccountConfigs.find_or_initialize_for_key(submitter.account,
|
||||||
|
AccountConfig::SUBMITTER_DOCUMENTS_COPY_EMAIL_KEY)
|
||||||
|
|
||||||
|
return if configs.value['enabled'] == false
|
||||||
|
|
||||||
|
to = submitter.submission.submitters.reject { |e| e.preferences['send_email'] == false }
|
||||||
|
.sort_by(&:completed_at).select(&:email?).map(&:friendly_name)
|
||||||
|
|
||||||
|
return if to.blank?
|
||||||
|
|
||||||
|
if configs.value['bcc_recipients'] == true
|
||||||
|
to.each { |to| SubmitterMailer.documents_copy_email(submitter, to:).deliver_later! }
|
||||||
|
else
|
||||||
|
SubmitterMailer.documents_copy_email(submitter, to: to.join(', ')).deliver_later!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_bcc_addresses(submission)
|
def build_bcc_addresses(submission)
|
||||||
@@ -110,11 +126,6 @@ class ProcessSubmitterCompletionJob
|
|||||||
bcc.to_s.scan(User::EMAIL_REGEXP)
|
bcc.to_s.scan(User::EMAIL_REGEXP)
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_to_addresses(submitter)
|
|
||||||
submitter.submission.submitters.reject { |e| e.preferences['send_email'] == false }
|
|
||||||
.sort_by(&:completed_at).select(&:email?).map(&:friendly_name).join(', ')
|
|
||||||
end
|
|
||||||
|
|
||||||
def enqueue_next_submitter_request_notification(submitter)
|
def enqueue_next_submitter_request_notification(submitter)
|
||||||
next_submitter_item =
|
next_submitter_item =
|
||||||
submitter.submission.template_submitters.find do |e|
|
submitter.submission.template_submitters.find do |e|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<div class="collapse-content">
|
<div class="collapse-content">
|
||||||
<%= form_for AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_DOCUMENTS_COPY_EMAIL_KEY), url: settings_personalization_path, method: :post, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %>
|
<%= form_for AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_DOCUMENTS_COPY_EMAIL_KEY), url: settings_personalization_path, method: :post, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %>
|
||||||
<%= f.hidden_field :key %>
|
<%= f.hidden_field :key %>
|
||||||
<%= f.fields_for :value, Struct.new(:subject, :body, :reply_to, :attach_audit_log, :attach_documents).new(*f.object.value.values_at('subject', 'body', 'reply_to', 'attach_audit_log', 'attach_documents')) do |ff| %>
|
<%= f.fields_for :value, Struct.new(:subject, :body, :reply_to, :attach_audit_log, :attach_documents, :bcc_recipients, :enabled).new(*f.object.value.values_at('subject', 'body', 'reply_to', 'attach_audit_log', 'attach_documents', 'bcc_recipients', 'enabled')) do |ff| %>
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<%= ff.label :subject, t('subject'), class: 'label' %>
|
<%= ff.label :subject, t('subject'), class: 'label' %>
|
||||||
<%= ff.text_field :subject, required: true, class: 'base-input', dir: 'auto' %>
|
<%= ff.text_field :subject, required: true, class: 'base-input', dir: 'auto' %>
|
||||||
@@ -24,23 +24,41 @@
|
|||||||
<%= ff.text_area :body, required: true, class: 'base-input w-full py-2', dir: 'auto' %>
|
<%= ff.text_area :body, required: true, class: 'base-input w-full py-2', dir: 'auto' %>
|
||||||
</autoresize-textarea>
|
</autoresize-textarea>
|
||||||
</div>
|
</div>
|
||||||
<% if can?(:manage, :reply_to) %>
|
<% if can?(:manage, :reply_to) || can?(:manage, :personalization_advanced) %>
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<%= ff.label :reply_to, t('reply_to'), class: 'label' %>
|
<%= ff.label :reply_to, t('reply_to'), class: 'label' %>
|
||||||
<%= ff.email_field :reply_to, class: 'base-input', dir: 'auto', placeholder: t(:email) %>
|
<%= ff.email_field :reply_to, class: 'base-input', dir: 'auto', placeholder: t(:email) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="flex items-center justify-between pt-2.5 mx-1">
|
<div class="space-y-3.5">
|
||||||
<span>
|
<div class="flex items-center justify-between mx-1">
|
||||||
<%= t('attach_documents') %>
|
<span>
|
||||||
</span>
|
<%= t('attach_documents') %>
|
||||||
<%= ff.check_box :attach_documents, { checked: ff.object.attach_documents != false, class: 'toggle' }, 'true', 'false' %>
|
</span>
|
||||||
</div>
|
<%= ff.check_box :attach_documents, { checked: ff.object.attach_documents != false, class: 'toggle' }, 'true', 'false' %>
|
||||||
<div class="flex items-center justify-between pb-2.5 mx-1">
|
</div>
|
||||||
<span>
|
<div class="flex items-center justify-between mx-1">
|
||||||
<%= t('attach_audit_log_pdf') %>
|
<span>
|
||||||
</span>
|
<%= t('attach_audit_log_pdf') %>
|
||||||
<%= ff.check_box :attach_audit_log, { checked: ff.object.attach_audit_log != false, class: 'toggle' }, 'true', 'false' %>
|
</span>
|
||||||
|
<%= ff.check_box :attach_audit_log, { checked: ff.object.attach_audit_log != false, class: 'toggle' }, 'true', 'false' %>
|
||||||
|
</div>
|
||||||
|
<% unless Docuseal.multitenant? %>
|
||||||
|
<div class="flex items-center justify-between mx-1">
|
||||||
|
<span>
|
||||||
|
<%= t('bcc_recipients') %>
|
||||||
|
</span>
|
||||||
|
<%= ff.check_box :bcc_recipients, { checked: ff.object.bcc_recipients == true, class: 'toggle' }, 'true', 'false' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if !Docuseal.multitenant? || can?(:manage, :personalization_advanced) %>
|
||||||
|
<div class="flex items-center justify-between mx-1">
|
||||||
|
<span>
|
||||||
|
<%= t('send_emails_automatically_on_completion') %>
|
||||||
|
</span>
|
||||||
|
<%= ff.check_box :enabled, { checked: ff.object.enabled != false, class: 'toggle' }, 'true', 'false' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="form-control pt-2">
|
<div class="form-control pt-2">
|
||||||
|
|||||||
@@ -206,7 +206,7 @@
|
|||||||
<span>
|
<span>
|
||||||
<%= t('send_emails_automatically_on_completion') %>
|
<%= t('send_emails_automatically_on_completion') %>
|
||||||
</span>
|
</span>
|
||||||
<%= ff.check_box :documents_copy_email_enabled, { checked: ff.object.documents_copy_email_enabled != false, class: 'toggle', onchange: 'this.form.requestSubmit()' }, 'true', 'false' %>
|
<%= ff.check_box :documents_copy_email_enabled, { checked: ff.object.documents_copy_email_enabled != false && configs['enabled'] != false, class: 'toggle', onchange: 'this.form.requestSubmit()', disabled: configs['enabled'] == false }, 'true', 'false' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="form-control pt-2">
|
<div class="form-control pt-2">
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ en: &en
|
|||||||
language_ko: 한국어
|
language_ko: 한국어
|
||||||
hi_there: Hi there
|
hi_there: Hi there
|
||||||
thanks: Thanks
|
thanks: Thanks
|
||||||
|
bcc_recipients: BCC recipients
|
||||||
edit_per_party: Edit per party
|
edit_per_party: Edit per party
|
||||||
reply_to: Reply to
|
reply_to: Reply to
|
||||||
pending_by_me: Pending by me
|
pending_by_me: Pending by me
|
||||||
@@ -745,6 +746,7 @@ en: &en
|
|||||||
read: Read your data
|
read: Read your data
|
||||||
|
|
||||||
es: &es
|
es: &es
|
||||||
|
bcc_recipients: Destinatarios CCO
|
||||||
edit_per_party: Editar por parte
|
edit_per_party: Editar por parte
|
||||||
signed: Firmado
|
signed: Firmado
|
||||||
reply_to: Responder a
|
reply_to: Responder a
|
||||||
@@ -1472,6 +1474,7 @@ es: &es
|
|||||||
read: Leer tus datos
|
read: Leer tus datos
|
||||||
|
|
||||||
it: &it
|
it: &it
|
||||||
|
bcc_recipients: Destinatari BCC
|
||||||
edit_per_party: Modifica per partito
|
edit_per_party: Modifica per partito
|
||||||
signed: Firmato
|
signed: Firmato
|
||||||
reply_to: Rispondi a
|
reply_to: Rispondi a
|
||||||
@@ -2198,6 +2201,7 @@ it: &it
|
|||||||
read: Leggi i tuoi dati
|
read: Leggi i tuoi dati
|
||||||
|
|
||||||
fr: &fr
|
fr: &fr
|
||||||
|
bcc_recipients: Destinataires en CCI
|
||||||
edit_per_party: Éditer par partie
|
edit_per_party: Éditer par partie
|
||||||
signed: Signé
|
signed: Signé
|
||||||
reply_to: Répondre à
|
reply_to: Répondre à
|
||||||
@@ -2926,6 +2930,7 @@ fr: &fr
|
|||||||
read: Lire vos données
|
read: Lire vos données
|
||||||
|
|
||||||
pt: &pt
|
pt: &pt
|
||||||
|
bcc_recipients: Destinatários BCC
|
||||||
edit_per_party: Edita por festa
|
edit_per_party: Edita por festa
|
||||||
signed: Assinado
|
signed: Assinado
|
||||||
reply_to: Responder a
|
reply_to: Responder a
|
||||||
@@ -3653,6 +3658,7 @@ pt: &pt
|
|||||||
read: Ler seus dados
|
read: Ler seus dados
|
||||||
|
|
||||||
de: &de
|
de: &de
|
||||||
|
bcc_recipients: BCC-Empfänger
|
||||||
edit_per_party: Bearbeiten pro Partei
|
edit_per_party: Bearbeiten pro Partei
|
||||||
signed: Unterschrieben
|
signed: Unterschrieben
|
||||||
reply_to: Antworten auf
|
reply_to: Antworten auf
|
||||||
|
|||||||
Reference in New Issue
Block a user