Bug 37671: (QA follow-up) Tidy printreceipt.pl

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Andrew Fuerste Henry 2026-04-03 12:55:27 +00:00 committed by Lucas Gass
parent 528f81b7fd
commit 3598cea2ba
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 12 additions and 11 deletions

View File

@ -35,9 +35,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
}
);
my $payment_id = $input->param('accountlines_id');
my $payment_id = $input->param('accountlines_id');
my $accountline = Koha::Account::Lines->find($payment_id);
my $patron = $accountline->patron;
my $patron = $accountline->patron;
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
output_and_exit_if_error(
@ -50,17 +50,18 @@ output_and_exit_if_error(
}
) if $patron; # Payment could have been anonymous
my $lang = $patron ? $patron->lang : $template->lang;
my $lang = $patron ? $patron->lang : $template->lang;
# Determine template and table based on account line type
my ($letter_code, $table_key, $table_id);
if ($accountline->is_credit) {
my ( $letter_code, $table_key, $table_id );
if ( $accountline->is_credit ) {
$letter_code = 'RECEIPT';
$table_key = 'credits';
$table_id = $accountline->accountlines_id;
} elsif ($accountline->is_debit && $accountline->debit_type_code eq 'PAYOUT') {
$table_key = 'credits';
$table_id = $accountline->accountlines_id;
} elsif ( $accountline->is_debit && $accountline->debit_type_code eq 'PAYOUT' ) {
$letter_code = 'PAYOUT';
$table_key = 'debits';
$table_id = $accountline->accountlines_id;
$table_key = 'debits';
$table_id = $accountline->accountlines_id;
} else {
die "Account line " . $payment_id . " is not a credit or supported payout transaction";
}
@ -73,7 +74,7 @@ my $letter = C4::Letters::GetPreparedLetter(
lang => $lang,
tables => {
$table_key => $table_id,
borrowers => $patron ? $patron->borrowernumber : undef
borrowers => $patron ? $patron->borrowernumber : undef
},
substitute => {
tendered => scalar $input->param('tendered'),