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:
parent
528f81b7fd
commit
3598cea2ba
|
|
@ -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'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue