Bug 26689: Check for specific template then fallback - printinvoice

This patch adds a check for a more specific ACCOUNT_DEBIT template
(named to match the debit_type_code of the credit line) prior to
falling back to the ACCOUNT_DEBIT template.

Test plan
1/ On a patrons account page use the print option on a series of debit
lines with differing credit types (Overdue, Payout)
2/ Note that the same template 'ACCOUNT_DEBIT' is used for all types
3/ Apply the patch
4/ Run step 1 again and note all still print using ACCOUNT_DEBIT
5/ Add a new notice template under the 'circulation' module with a code
that matches one of your account debit types (OVERDUE, PAYOUT)
6/ Run step 1 again and note that where you have added a specific notice
for that debit type it has been used.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 8e46612d7c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 021ca321ee)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Martin Renvoize 2021-03-12 16:09:22 +00:00 committed by Arthur Suzuki
parent 8463b63d9b
commit e4f6538094
1 changed files with 12 additions and 0 deletions

View File

@ -56,6 +56,18 @@ output_and_exit_if_error(
);
my $letter = C4::Letters::GetPreparedLetter(
module => 'circulation',
letter_code => $debit->debit_type_code,
branchcode => C4::Context::mybranch,
message_transport_type => 'print',
lang => $patron->lang,
tables => {
debits => $debit_id,
borrowers => $patron->borrowernumber
}
);
$letter //= C4::Letters::GetPreparedLetter(
module => 'circulation',
letter_code => 'ACCOUNT_DEBIT',
branchcode => C4::Context::mybranch,