Bugzilla – Attachment 92811 Details for
Bug 23321
Add 'cash registers' to the accounts system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23321: (follow-up) Require cash registers for payments
Bug-23321-follow-up-Require-cash-registers-for-pay.patch (text/plain), 4.80 KB, created by
Martin Renvoize (ashimema)
on 2019-09-13 15:30:13 UTC
(
hide
)
Description:
Bug 23321: (follow-up) Require cash registers for payments
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-09-13 15:30:13 UTC
Size:
4.80 KB
patch
obsolete
>From 5548da85b445bcfddef751c37e9805f2dcee503b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 19 Jul 2019 09:20:49 +0100 >Subject: [PATCH] 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 > >Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> >--- > .../prog/en/modules/members/paycollect.tt | 15 ++++++++ > members/paycollect.pl | 38 ++++++++++++------- > 2 files changed, 40 insertions(+), 13 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >index 535b66b6cc..2f71eb842f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -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> > >diff --git a/members/paycollect.pl b/members/paycollect.pl >index 2a1aeb9b0b..0974997885 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -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) { >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23321
:
91596
|
91597
|
91598
|
91599
|
91600
|
91601
|
91602
|
91621
|
92057
|
92058
|
92059
|
92060
|
92061
|
92062
|
92063
|
92064
|
92065
|
92083
|
92084
|
92085
|
92086
|
92087
|
92088
|
92089
|
92090
|
92091
|
92394
|
92395
|
92396
|
92397
|
92398
|
92399
|
92400
|
92401
|
92402
|
92467
|
92468
|
92469
|
92470
|
92471
|
92472
|
92473
|
92474
|
92475
|
92803
|
92804
|
92805
|
92806
|
92807
|
92808
|
92809
|
92810
|
92811
|
92812
|
92813
|
92814
|
92829
|
92879
|
92880
|
92881
|
92882
|
92883
|
92884
|
92885
|
92886
|
92887
|
92888
|
92889
|
93019
|
93020
|
93021
|
93022
|
93023
|
93024
|
93025
|
93026
|
93027
|
93028
|
93029
|
93030
|
93031
|
93032
|
93033
|
93034
|
93035
|
93188