Bug 23321: (follow-up) Require cash registers for payments
This follow-up catches the case where no cash registers have been defined for the current branch and as such payments cannot be processed. Test plan: 1) Ensure you have 'UseCashRegisters' set to 'Do' 2) Attempt to make a payment for a fee whilst logged into a branch that has not yet had cash registers configured. 3) Note that you are shown a warning and cannot proceed. 4) Signoff Sponsored-by: PTFS Europe Sponsored-by: Cheshire Libraries Shared Services Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
1a740fda1e
commit
57a93704c0
|
|
@ -61,6 +61,12 @@
|
|||
[% END %]
|
||||
|
||||
[% IF ( pay_individual ) %]
|
||||
[% IF ( error_registers ) %]
|
||||
<div id="error_message" class="dialog alert">
|
||||
You must have at least one cash register associated with this branch before you can record payments.
|
||||
</div>
|
||||
[% ELSE %]
|
||||
|
||||
<form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
|
||||
<input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
|
||||
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
|
||||
|
|
@ -144,6 +150,7 @@
|
|||
<a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
[% END %]
|
||||
[% ELSIF ( writeoff_individual ) %]
|
||||
<form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
|
||||
<input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
|
||||
|
|
@ -190,6 +197,11 @@
|
|||
</div>
|
||||
</form>
|
||||
[% ELSE %]
|
||||
[% IF ( error_registers && type != 'writeoff' ) %]
|
||||
<div id="error_message" class="dialog alert">
|
||||
You must have at least one cash register associated with this branch before you can record payments.
|
||||
</div>
|
||||
[% ELSE %]
|
||||
|
||||
<form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
|
||||
<input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
|
||||
|
|
@ -231,6 +243,7 @@
|
|||
<span id="change">0.00</span>
|
||||
</li>
|
||||
|
||||
[% IF type != 'writeoff' %]
|
||||
[% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
|
||||
[% IF payment_types %]
|
||||
<li>
|
||||
|
|
@ -258,6 +271,7 @@
|
|||
</select>
|
||||
</li>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
<li>
|
||||
<label for="selected_accts_notes">Note: </label>
|
||||
|
|
@ -270,6 +284,7 @@
|
|||
<a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</div></div>
|
||||
|
||||
|
|
|
|||
|
|
@ -75,20 +75,32 @@ my $payment_note = uri_unescape scalar $input->param('payment_note');
|
|||
my $payment_type = scalar $input->param('payment_type');
|
||||
my $accountlines_id;
|
||||
|
||||
my $registerid = $input->param('registerid');
|
||||
if ( !$registerid ) {
|
||||
$registerid = Koha::Cash::Registers->find(
|
||||
{ branch => $library_id, branch_default => 1 },
|
||||
)->id;
|
||||
my $registerid;
|
||||
if ( C4::Context->preference('UseCashRegisters') ) {
|
||||
$registerid = $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 $registers = Koha::Cash::Registers->search(
|
||||
{ branch => $library_id, archived => 0 },
|
||||
{ order_by => { '-asc' => 'name' } }
|
||||
);
|
||||
$template->param(
|
||||
registerid => $registerid,
|
||||
registers => $registers,
|
||||
);
|
||||
|
||||
if ( $pay_individual || $writeoff_individual ) {
|
||||
if ($pay_individual) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue