Browse Source

Bug 23354: (RM follow-up) Correction for cash register selection

The form element for selectin cash register override at point of sale was
misnamed and as such one could not actually override the cash register.

This patch corrects the form element name and updates the logic very
slighlty to ensure we still fall back to the defualt no the subsequent
page load.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Martin Renvoize 3 years ago
parent
commit
8d8c5f7311
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 20
      pos/pay.pl

20
pos/pay.pl

@ -31,9 +31,10 @@ my ( $template, $loggedinuser, $cookie, $user_flags ) = get_template_and_user(
);
my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
my $library_id = C4::Context->userenv->{'branch'};
my $registerid = $input->param('registerid');
my $registers = Koha::Cash::Registers->search(
my $library_id = C4::Context->userenv->{'branch'};
my $registerid = $input->param('registerid');
my $default_registerid = $input->param('default_register');
my $registers = Koha::Cash::Registers->search(
{ branch => $library_id, archived => 0 },
{ order_by => { '-asc' => 'name' } }
);
@ -42,22 +43,21 @@ if ( !$registers->count ) {
$template->param( error_registers => 1 );
}
else {
if ( !$registerid ) {
if ( !$default_registerid ) {
my $default_register = Koha::Cash::Registers->find(
{ branch => $library_id, branch_default => 1 } );
$registerid = $default_register->id if $default_register;
$default_registerid =
$default_register ? $default_register->id : $registers->next->id;
}
$registerid = $registers->next->id if !$registerid;
$template->param(
registerid => $registerid,
registers => $registers,
default_register => $default_registerid,
registers => $registers,
);
}
my $invoice_types =
Koha::Account::DebitTypes->search_with_library_limits(
{ can_be_sold => 1 },
Koha::Account::DebitTypes->search_with_library_limits( { can_be_sold => 1 },
{}, $library_id );
$template->param( invoice_types => $invoice_types );

Loading…
Cancel
Save