From 89716a78e9a7ed4c80dddba916d52737c7f2b468 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 16 Sep 2020 11:02:22 +0100 Subject: [PATCH] Bug 26269: Fix variable name mismatch for cash_register in paycollect It appears that through various rebases the variable names in the form and the controller script have become mismatched. This patch corrects the situation and clarifies their intended use. Test plan: 1/ Turn on cash registers in sysprefs 2/ Define at least 2 cash registers in Admin 3/ Create a manual invoice on a patron 4/ Pay off half of your fee, selecting the first register 5/ Pay off the remaining fee, selecting the second register 6/ Query accountlines.register_id for your two payments 8/ Confirm the two accountlines.register_id's do not match (thus the passed variable was used) https://bugs.koha-community.org/show_bug.cgi?id=26469 Signed-off-by: Jessie Zairo Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart --- .../prog/en/modules/members/paycollect.tt | 4 ++-- members/paycollect.pl | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt index f1daae3fa2..3facc29b24 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -154,7 +154,7 @@ [% FOREACH register IN registers %] - [% IF register.id == registerid %] + [% IF register.id == default_register %] [% ELSE %] diff --git a/members/paycollect.pl b/members/paycollect.pl index 3f5bb3c357..471559202e 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -77,9 +77,9 @@ my $payment_note = uri_unescape scalar $input->param('payment_note'); my $payment_type = scalar $input->param('payment_type'); my $accountlines_id; -my $registerid; +my $cash_register_id; if ( C4::Context->preference('UseCashRegisters') ) { - $registerid = $input->param('registerid'); + $cash_register_id = $input->param('cash_register'); my $registers = Koha::Cash::Registers->search( { branch => $library_id, archived => 0 }, { order_by => { '-asc' => 'name' } } @@ -90,16 +90,16 @@ if ( C4::Context->preference('UseCashRegisters') ) { } else { - if ( !$registerid ) { + if ( !$cash_register_id ) { my $default_register = Koha::Cash::Registers->find( { branch => $library_id, branch_default => 1 } ); - $registerid = $default_register->id if $default_register; + $cash_register_id = $default_register->id if $default_register; } - $registerid = $registers->next->id if !$registerid; + $cash_register_id = $registers->next->id if !$cash_register_id; $template->param( - registerid => $registerid, - registers => $registers, + default_register => $cash_register_id, + registers => $registers, ); } } @@ -196,7 +196,7 @@ if ( $total_paid and $total_paid ne '0.00' ) { note => $payment_note, interface => C4::Context->interface, payment_type => $payment_type, - cash_register => $registerid + cash_register => $cash_register_id } ); $payment_id = $pay_result->{payment_id}; @@ -221,7 +221,7 @@ if ( $total_paid and $total_paid ne '0.00' ) { note => $note, interface => C4::Context->interface, payment_type => $payment_type, - cash_register => $registerid + cash_register => $cash_register_id } ); } @@ -237,7 +237,7 @@ if ( $total_paid and $total_paid ne '0.00' ) { payment_type => $payment_type, interface => C4::Context->interface, payment_type => $payment_type, - cash_register => $registerid + cash_register => $cash_register_id } ); } -- 2.39.5