26 lines
1.2 KiB
Ruby
26 lines
1.2 KiB
Ruby
module IdCard
|
|
class PrintData < ApplicationRecord
|
|
belongs_to :employer, class_name: 'Employer'
|
|
|
|
STRING_ATTRIBUTES = %w[provider_line_1 provider_line_2 provider_line_3 provider_line_4 provider_line_5 provider_line_6 provider_line_7 provider_line_8 provider_line_9 provider_line_10 provider_line_11 provider_line_12 claim_to_1 claim_to_2 claim_to_3 claim_to_4 claim_to_5 claim_to_6 claim_to_7 claim_to_8 claim_to_9 claim_to_10 claim_to_11 claim_to_12 dependent_1 dependent_2 dependent_3 dependent_4 dependent_5 dependent_6 dependent_7 dependent_8 dental_coverage]
|
|
|
|
before_validation :assign_blank_strings_to_unassigned_params
|
|
|
|
private
|
|
|
|
def has_jasper_sorting_fields
|
|
missing_sample_card_fields = sample_plan_title.blank?
|
|
missing_member_card_fields = employer_name.blank? || full_name_last_name_first.blank?
|
|
|
|
if missing_sample_card_fields || missing_member_card_fields
|
|
errors.add(:base, "Required field for Jasper Server is missing")
|
|
end
|
|
end
|
|
|
|
def assign_blank_strings_to_unassigned_params
|
|
STRING_ATTRIBUTES.each do |attr|
|
|
self[attr] = "" if self[attr].blank?
|
|
end
|
|
end
|
|
end
|
|
end |