From d83fdcb50b74caa4d45296b859467fb2783c5d05 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 21 Jul 2020 13:08:18 +0100 Subject: [PATCH] Bug 24786: Update point of sale to use session register This patch adds handling to allow for the use of the session cash register by default if it has been set, otherwise it defaults to '-- None --' and requires the end user to select the register to proceed with the sale. Test plan 1/ Enable cash registers via the 'UseCashRegisters' system preference 2/ Enable point of sale via the 'EnablePointOfSale' system preference 3/ Navigate to the point of sale page 4/ Note that if you are logged in at a branch with no cash registers yet defined, then an alert should appear 5/ Note that when you are logged in at a branch with cash regsiters defined, but without a cash register associated with your session then the cash 'Cash register' select box is populated with '-- None --' and you are required to select a register prior to submission 6/ Note that upon selection, the '-- None --' option is disabled 7/ Note that when you have a register associated with your session then the 'Cash register' select box is pre-populated with that register. 8/ Signoff Signed-off-by: Andrew Fuerste-Henry --- .../prog/en/includes/html_helpers.inc | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt | 13 +++++-------- pos/pay.pl | 22 ---------------------- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index d8d7e12fcd..19f89bb810 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -25,7 +25,7 @@ [% BLOCK options_for_registers %] - + [% FOREACH r IN registers %] [% IF r.branch == branch %] [% IF r.selected %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt index 3977ca09d7..08b79318e4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -1,11 +1,14 @@ [% USE raw %] [% USE Asset %] +[% USE Branches %] [% USE Koha %] [% USE Price %] [% USE TablesSettings %] +[% USE Registers %] [% SET footerjs = 1 %] [% PROCESS 'payments.inc' %] [% INCLUDE 'doc-head-open.inc' %] +[% SET registers = Registers.all( filters => { current_branch => 1 } ) %] Koha › Payments [% INCLUDE 'doc-head-close.inc' %] @@ -20,7 +23,7 @@
- [% IF ( error_registers ) %] + [% IF ( registers.size == 0 ) %]

You must have at least one cash register associated with the library before you can record payments. @@ -126,13 +129,7 @@

  • diff --git a/pos/pay.pl b/pos/pay.pl index 5cc4279992..6fd7fcef30 100755 --- a/pos/pay.pl +++ b/pos/pay.pl @@ -32,28 +32,6 @@ 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 $default_registerid = $input->param('default_register'); -my $registers = Koha::Cash::Registers->search( - { branch => $library_id, archived => 0 }, - { order_by => { '-asc' => 'name' } } -); - -if ( !$registers->count ) { - $template->param( error_registers => 1 ); -} -else { - if ( !$default_registerid ) { - my $default_register = Koha::Cash::Registers->find( - { branch => $library_id, branch_default => 1 } ); - $default_registerid = - $default_register ? $default_register->id : $registers->next->id; - } - - $template->param( - default_register => $default_registerid, - registers => $registers, - ); -} my $invoice_types = Koha::Account::DebitTypes->search_with_library_limits( { can_be_sold => 1 }, -- 2.11.0