Browse Source

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 <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
tags/v20.11.00
3 changed files with 6 additions and 31 deletions
  1. +1
    -1
      koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc
  2. +5
    -8
      koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt
  3. +0
    -22
      pos/pay.pl

+ 1
- 1
koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc View File

@@ -25,7 +25,7 @@

[% BLOCK options_for_registers %]
<!-- <option hidden disabled selected value> -- select an option -- </option> -->
<option id="noregister" value="">-- None --</option>
<option id="noregister"[% IF register_required %] disabled selected [% END %] value="">-- None --</option>
[% FOREACH r IN registers %]
[% IF r.branch == branch %]
[% IF r.selected %]


+ 5
- 8
koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt View File

@@ -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 } ) %]
<title>Koha &rsaquo; Payments</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
@@ -20,7 +23,7 @@
<div class="row">
<div class="col-sm-10 col-sm-push-2">

[% IF ( error_registers ) %]
[% IF ( registers.size == 0 ) %]
<div id="error_message" class="dialog message">
<p>
You must have at least one cash register associated with the library before you can record payments.
@@ -126,13 +129,7 @@
<li>
<label for="registerid">Cash register: </label>
<select name="registerid" id="registerid">
[% FOREACH register IN registers %]
[% IF register.id == default_register %]
<option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
[% ELSE %]
<option value="[% register.id | html %]">[% register.name | html %]</option>
[% END %]
[% END %]
[% PROCESS options_for_registers register_required => 1 %]
</select>
</li>
</ol>


+ 0
- 22
pos/pay.pl View File

@@ -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 },


Loading…
Cancel
Save