Browse Source

Bug 24786: Update borroaccount 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 refund or payout action.

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>
20.11.x
Martin Renvoize 3 years ago
committed by Jonathan Druart
parent
commit
114e851f8f
  1. 28
      koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
  2. 27
      members/boraccount.pl

28
koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt

@ -7,7 +7,9 @@
[% USE AuthorisedValues %]
[% USE Price %]
[% USE Branches %]
[% USE Registers %]
[% SET footerjs = 1 %]
[% SET registers = Registers.all( filters => { current_branch => 1 } ) %]
[% PROCESS 'accounts.inc' %]
@ -149,6 +151,11 @@
<h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
</div>
<div class="modal-body">
[% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
<div id="payout_error" class="dialog alert">
You must have at least one cash register associated with this branch before you can record cash payouts.
</div>
[% END %]
<fieldset class="rows">
<ol>
<li>
@ -178,13 +185,7 @@
<li>
<label for="registerid">Cash register: </label>
<select name="registerid" id="payout_registerid">
[% FOREACH register IN registers %]
[% IF register.id == registerid %]
<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>
[% END %]
@ -215,6 +216,11 @@
<h4 class="modal-title" id="issueRefundLabel">Issue refund</h4>
</div>
<div class="modal-body">
[% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
<div id="refund_error" class="dialog alert">
You must have at least one cash register associated with this branch before you can record cash refunds.
</div>
[% END %]
<fieldset class="rows">
<ol>
<li>
@ -245,13 +251,7 @@
<li>
<label for="registerid">Cash register: </label>
<select name="registerid" id="refund_registerid">
[% FOREACH register IN registers %]
[% IF register.id == registerid %]
<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>
[% END %]

27
members/boraccount.pl

@ -66,32 +66,7 @@ unless ( $patron ) {
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
my $registerid;
if ( C4::Context->preference('UseCashRegisters') ) {
$registerid = scalar $input->param('registerid');
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 ( !$registerid ) {
my $default_register = Koha::Cash::Registers->find(
{ branch => $library_id, branch_default => 1 } );
$registerid = $default_register->id if $default_register;
}
$registerid = $registers->next->id if !$registerid;
$template->param(
registerid => $registerid,
registers => $registers,
);
}
}
my $registerid = $input->param('registerid');
if ( $action eq 'void' ) {
my $payment_id = scalar $input->param('accountlines_id');

Loading…
Cancel
Save