add with signature id completed config

This commit is contained in:
Pete Matsyburka
2026-07-14 12:47:38 +03:00
parent 73734b0de7
commit 61fc24d35d
7 changed files with 31 additions and 13 deletions
@@ -18,7 +18,8 @@ module Submissions
AccountConfig::WITH_TIMESTAMP_SECONDS_KEY,
AccountConfig::ROTATE_INCREMENTAL_PDF_KEY,
AccountConfig::WITH_FILE_LINKS_KEY,
AccountConfig::WITH_SIGNATURE_ID_REASON_KEY])
AccountConfig::WITH_SIGNATURE_ID_REASON_KEY,
AccountConfig::WITH_SIGNATURE_ID_COMPLETED_AT_KEY])
with_signature_id = configs.find { |c| c.key == AccountConfig::WITH_SIGNATURE_ID }&.value == true
with_file_links = configs.find { |c| c.key == AccountConfig::WITH_FILE_LINKS_KEY }&.value == true
@@ -28,6 +29,8 @@ module Submissions
with_timestamp_seconds = configs.find { |c| c.key == AccountConfig::WITH_TIMESTAMP_SECONDS_KEY }&.value == true
with_signature_id_reason =
configs.find { |c| c.key == AccountConfig::WITH_SIGNATURE_ID_REASON_KEY }&.value != false
with_signature_id_completed_at =
configs.find { |c| c.key == AccountConfig::WITH_SIGNATURE_ID_COMPLETED_AT_KEY }&.value == true
file_links_expire_at = Accounts.link_expires_at(submission.account) if with_file_links
@@ -45,7 +48,7 @@ module Submissions
with_signature_id:, is_flatten:, with_headings: index.zero?,
with_submitter_timezone:, with_file_links:,
file_links_expire_at:, with_signature_id_reason:,
with_timestamp_seconds:)
with_timestamp_seconds:, with_signature_id_completed_at:)
end
template = submission.template
+14 -6
View File
@@ -140,7 +140,8 @@ module Submissions
AccountConfig::WITH_TIMESTAMP_SECONDS_KEY,
AccountConfig::ROTATE_INCREMENTAL_PDF_KEY,
AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY,
AccountConfig::WITH_SIGNATURE_ID_REASON_KEY])
AccountConfig::WITH_SIGNATURE_ID_REASON_KEY,
AccountConfig::WITH_SIGNATURE_ID_COMPLETED_AT_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
@@ -150,6 +151,8 @@ module Submissions
with_file_links = configs.find { |c| c.key == AccountConfig::WITH_FILE_LINKS_KEY }&.value == true
with_signature_id_reason =
configs.find { |c| c.key == AccountConfig::WITH_SIGNATURE_ID_REASON_KEY }&.value != false
with_signature_id_completed_at =
configs.find { |c| c.key == AccountConfig::WITH_SIGNATURE_ID_COMPLETED_AT_KEY }&.value == true
file_links_expire_at = Accounts.link_expires_at(submitter.account) if with_file_links
@@ -201,12 +204,14 @@ module Submissions
with_file_links:,
with_timestamp_seconds:,
with_signature_id_reason:,
with_signature_id_completed_at:,
file_links_expire_at:)
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_timestamp_seconds: false, with_file_links: nil,
with_timestamp_seconds: false, with_signature_id_completed_at: false,
with_file_links: nil,
file_links_expire_at: Accounts.link_expires_at(account))
cell_layouters = Hash.new do |hash, valign|
hash[valign] = HexaPDF::Layout::TextLayouter.new(text_valign: valign.to_sym, text_align: :center)
@@ -337,14 +342,17 @@ module Submissions
time_format = with_timestamp_seconds ? :detailed : :long
signature_timestamp =
(with_signature_id_completed_at ? submitter.completed_at : nil) || attachment.created_at
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: time_format)} " \
"#{TimeUtils.timezone_abbr(timezone, attachment.created_at)}"
"#{I18n.l(signature_timestamp.in_time_zone(timezone), format: time_format)} " \
"#{TimeUtils.timezone_abbr(timezone, signature_timestamp)}"
else
"#{I18n.l(attachment.created_at.in_time_zone(timezone), format: time_format)} " \
"#{TimeUtils.timezone_abbr(timezone, attachment.created_at)}"
"#{I18n.l(signature_timestamp.in_time_zone(timezone), format: time_format)} " \
"#{TimeUtils.timezone_abbr(timezone, signature_timestamp)}"
end
end