From dc4ae67ac8f09c9086b0278f13611eac1106acba 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 --- .../prog/en/includes/html_helpers.inc | 2 +- .../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 bbd35efe7f..6ecb03cd7b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -10,7 +10,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 021e4ea611..049a6e77ff 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -1,10 +1,13 @@ [% USE raw %] [% USE Asset %] +[% USE Branches %] [% USE Koha %] [% USE Price %] +[% 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' %] @@ -19,7 +22,7 @@
- [% IF ( error_registers ) %] + [% IF registers.size == 0 %]
You must have at least one cash register associated with this branch before you can record payments.
@@ -117,13 +120,7 @@
  • diff --git a/pos/pay.pl b/pos/pay.pl index acee17d3c9..05c38fb22f 100755 --- a/pos/pay.pl +++ b/pos/pay.pl @@ -33,28 +33,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.20.1