Skip to content

Commit

Permalink
Leave benefit selections blank on pdf if unselected (#16318)
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiWilkin authored Apr 12, 2024
1 parent 84381a1 commit c81ef53
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/pdf_fill/forms/va21p530v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,9 @@ def merge_fields(_options = {})

expand_cemetery_location

# special case: the UI only has a 'yes' checkbox, so the PDF 'noTransportation' checkbox can never be true.
@form_data['hasTransportation'] = @form_data['transportation'] == true ? 'YES' : nil

# special case: these fields were built as checkboxes instead of radios, so usual radio logic can't be used.
burial_expense_responsibility = @form_data['burialExpenseResponsibility']
@form_data['hasBurialExpenseResponsibility'] = burial_expense_responsibility ? 'On' : nil
Expand Down Expand Up @@ -759,7 +762,6 @@ def merge_fields(_options = {})
govtContributions
previouslyReceivedAllowance
allowanceStatementOfTruth
transportation
].each do |attr|
expand_checkbox_in_place(@form_data, attr)
end
Expand Down
5 changes: 2 additions & 3 deletions spec/fixtures/pdf_fill/21P-530V2/merge_fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"signatureDate":"2024-03-21",
"veteranSocialSecurityNumber2":{"first":"987", "second":"65", "third":"4322"},
"veteranSocialSecurityNumber3":{"first":"987", "second":"65", "third":"4322"},
"hasTransportation":"YES",
"hasBurialExpenseResponsibility":"On",
"noBurialExpenseResponsibility":null,
"hasPlotExpenseResponsibility":"On",
Expand All @@ -93,7 +94,5 @@
"hasPreviouslyReceivedAllowance":"YES",
"noPreviouslyReceivedAllowance":null,
"hasAllowanceStatementOfTruth":null,
"noAllowanceStatementOfTruth":null,
"hasTransportation":"YES",
"noTransportation":null
"noAllowanceStatementOfTruth":null
}
13 changes: 13 additions & 0 deletions spec/lib/pdf_fill/forms/va21p530v2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,18 @@ def class_form_data
get_fixture('pdf_fill/21P-530V2/merge_fields').to_json
)
end

it 'leaves benefit selections blank on pdf if unselected', run_at: '2024-03-21 00:00:00 EDT' do
unselected_benefits_data = get_fixture('pdf_fill/21P-530V2/kitchen_sink').except(
'burialAllowance', 'plotAllowance', 'transportation'
)
expected_merge_data = get_fixture('pdf_fill/21P-530V2/merge_fields').except(
'burialAllowance', 'plotAllowance', 'transportation'
)
expected_merge_data['hasTransportation'] = nil
expect(described_class.new(unselected_benefits_data).merge_fields.to_json).to eq(
expected_merge_data.to_json
)
end
end
end

0 comments on commit c81ef53

Please sign in to comment.