|
|
|
|
@ -140,11 +140,13 @@ module Submissions
|
|
|
|
|
configs = submitter.account.account_configs.where(key: [AccountConfig::FLATTEN_RESULT_PDF_KEY,
|
|
|
|
|
AccountConfig::WITH_SIGNATURE_ID,
|
|
|
|
|
AccountConfig::WITH_FILE_LINKS_KEY,
|
|
|
|
|
AccountConfig::WITH_TIMESTAMP_SECONDS_KEY,
|
|
|
|
|
AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY,
|
|
|
|
|
AccountConfig::WITH_SIGNATURE_ID_REASON_KEY])
|
|
|
|
|
|
|
|
|
|
with_signature_id = configs.find { |c| c.key == AccountConfig::WITH_SIGNATURE_ID }&.value == true
|
|
|
|
|
is_flatten = configs.find { |c| c.key == AccountConfig::FLATTEN_RESULT_PDF_KEY }&.value != false
|
|
|
|
|
with_timestamp_seconds = configs.find { |c| c.key == AccountConfig::WITH_TIMESTAMP_SECONDS_KEY }&.value == true
|
|
|
|
|
with_submitter_timezone = configs.find { |c| c.key == AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY }&.value == true
|
|
|
|
|
with_file_links = configs.find { |c| c.key == AccountConfig::WITH_FILE_LINKS_KEY }&.value == true
|
|
|
|
|
with_signature_id_reason =
|
|
|
|
|
@ -195,11 +197,13 @@ module Submissions
|
|
|
|
|
fill_submitter_fields(submitter, submitter.account, pdfs_index, with_signature_id:, is_flatten:,
|
|
|
|
|
with_submitter_timezone:,
|
|
|
|
|
with_file_links:,
|
|
|
|
|
with_timestamp_seconds:,
|
|
|
|
|
with_signature_id_reason:)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def fill_submitter_fields(submitter, account, pdfs_index, with_signature_id:, is_flatten:, with_headings: nil,
|
|
|
|
|
with_submitter_timezone: false, with_signature_id_reason: true, with_file_links: nil)
|
|
|
|
|
with_submitter_timezone: false, with_signature_id_reason: true,
|
|
|
|
|
with_timestamp_seconds: false, with_file_links: nil)
|
|
|
|
|
cell_layouters = Hash.new do |hash, valign|
|
|
|
|
|
hash[valign] = HexaPDF::Layout::TextLayouter.new(text_valign: valign.to_sym, text_align: :center)
|
|
|
|
|
end
|
|
|
|
|
@ -320,13 +324,15 @@ module Submissions
|
|
|
|
|
timezone = submitter.account.timezone
|
|
|
|
|
timezone = submitter.timezone || submitter.account.timezone if with_submitter_timezone
|
|
|
|
|
|
|
|
|
|
time_format = with_timestamp_seconds ? :detailed : :long
|
|
|
|
|
|
|
|
|
|
if with_signature_id_reason || field.dig('preferences', 'reasons').present?
|
|
|
|
|
"#{"#{I18n.t('reason')}: " if reason_value}#{reason_value || I18n.t('digitally_signed_by')} " \
|
|
|
|
|
"#{submitter.name}#{" <#{submitter.email}>" if submitter.email.present?}\n" \
|
|
|
|
|
"#{I18n.l(attachment.created_at.in_time_zone(timezone), format: :long)} " \
|
|
|
|
|
"#{I18n.l(attachment.created_at.in_time_zone(timezone), format: time_format)} " \
|
|
|
|
|
"#{TimeUtils.timezone_abbr(timezone, attachment.created_at)}"
|
|
|
|
|
else
|
|
|
|
|
"#{I18n.l(attachment.created_at.in_time_zone(timezone), format: :long)} " \
|
|
|
|
|
"#{I18n.l(attachment.created_at.in_time_zone(timezone), format: time_format)} " \
|
|
|
|
|
"#{TimeUtils.timezone_abbr(timezone, attachment.created_at)}"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|