Bugzilla – Attachment 107148 Details for
Bug 24786
Allow setting a cash register for a login session and configuring library-default cash registers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24786: Update paycollect to use session register
Bug-24786-Update-paycollect-to-use-session-registe.patch (text/plain), 7.07 KB, created by
Martin Renvoize (ashimema)
on 2020-07-21 12:42:23 UTC
(
hide
)
Description:
Bug 24786: Update paycollect to use session register
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-07-21 12:42:23 UTC
Size:
7.07 KB
patch
obsolete
>From 3135e1c3321b5e69b39c36b56f72b3e5aa8ceb38 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 21 Jul 2020 10:30:09 +0100 >Subject: [PATCH] Bug 24786: Update paycollect 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 payment. >--- > Koha/Template/Plugin/Registers.pm | 8 +++-- > .../prog/en/includes/html_helpers.inc | 2 +- > .../prog/en/modules/members/paycollect.tt | 30 +++++++------------ > members/paycollect.pl | 28 +---------------- > 4 files changed, 18 insertions(+), 50 deletions(-) > >diff --git a/Koha/Template/Plugin/Registers.pm b/Koha/Template/Plugin/Registers.pm >index e4ef8cd3d2..b2952fc57c 100644 >--- a/Koha/Template/Plugin/Registers.pm >+++ b/Koha/Template/Plugin/Registers.pm >@@ -44,7 +44,7 @@ sub session_register_name { > =head2 > > [% SET registers = Registers.all() %] >- [% SET registers = Registers.all( { branch => branchcode } ); >+ [% SET registers = Registers.all( { filters => { current_branch => 1 } } ); > > Returns a list of all cash registers available that adhere to the passed filters. > >@@ -53,7 +53,11 @@ Returns a list of all cash registers available that adhere to the passed filters > sub all { > my ( $self, $params ) = @_; > >- my $registers = Koha::Cash::Registers->search()->unblessed(); >+ my $filters = $params->{filters}; >+ my $where; >+ $where->{branch} = C4::Context->userenv->{'branch'} >+ if $filters->{current_branch}; >+ my $registers = Koha::Cash::Registers->search($where)->unblessed(); > for my $register ( @{$registers} ) { > $register->{selected} = ( defined( $self->session_register ) > && $register->{id} == $self->session_register ) ? 1 : 0; >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 6ecb03cd7b..0bb0b8426f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >@@ -12,7 +12,7 @@ > <!-- <option hidden disabled selected value> -- select an option -- </option> --> > <option id="noregister"[% IF register_required %] disabled selected [% END %] value="">-- None --</option> > [% FOREACH r IN registers %] >- [% IF r.branch == branch %] >+ [% IF r.branch == Branches.GetLoggedInBranchcode %] > [% IF r.selected %] > <option class="[% r.branch | html %] [% IF r.branch_default %]default[% END %]" value="[% r.id | html %]" selected="selected">[% r.name | html %]</option> > [% ELSE %] >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 4f54f8a207..81ec48f950 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -2,11 +2,13 @@ > [% USE Asset %] > [% USE Koha %] > [% USE Branches %] >+[% USE Registers %] > [% USE Price %] > [% SET footerjs = 1 %] > [% PROCESS 'payments.inc' %] > [% PROCESS 'accounts.inc' %] > [% INCLUDE 'doc-head-open.inc' %] >+[% SET registers = Registers.all( filters => { current_branch => 1 } ) %] > <title>Koha › Patrons › > [% IF type == 'WRITEOFF' %] > Write off an amount for [% patron.firstname | html %] [% patron.surname | html %] >@@ -73,7 +75,7 @@ > [% END %] > > [% IF ( pay_individual ) %] >- [% IF ( error_registers ) %] >+ [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %] > <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> >@@ -135,15 +137,9 @@ > > [% IF Koha.Preference('UseCashRegisters') %] > <li> >- <label for="cash_register">Cash register: </label> >- <select name="cash_register" id="cash_register"> >- [% 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 %] >+ <label for="registerid">Cash register: </label> >+ <select name="registerid" id="registerid"> >+ [% PROCESS options_for_registers register_required => 1 %] > </select> > </li> > [% END %] >@@ -204,7 +200,7 @@ > </div> > </form> > [% ELSE %] >- [% IF ( error_registers && type != 'writeoff' ) %] >+ [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( 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> >@@ -256,15 +252,9 @@ > > [% IF Koha.Preference('UseCashRegisters') %] > <li> >- <label for="cash_register">Cash register: </label> >- <select name="cash_register" id="cash_register"> >- [% 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 %] >+ <label for="registerid">Cash register: </label> >+ <select name="registerid" id="registerid"> >+ [% PROCESS options_for_registers register_required => 1 %] > </select> > </li> > [% END %] >diff --git a/members/paycollect.pl b/members/paycollect.pl >index c258560bc9..e40d5e7b71 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -78,33 +78,7 @@ my $payment_note = uri_unescape scalar $input->param('payment_note'); > my $payment_type = scalar $input->param('payment_type'); > my $accountlines_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 $registerid = $input->param('registerid'); > if ( $pay_individual || $writeoff_individual ) { > if ($pay_individual) { > $template->param( pay_individual => 1 ); >-- >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 24786
:
107145
|
107146
|
107147
|
107148
|
107149
|
107739
|
107740
|
107741
|
107742
|
107743
|
107754
|
107755
|
107756
|
107757
|
107758
|
107759
|
107957
|
107958
|
107959
|
107960
|
107961
|
107962
|
108060
|
108061
|
108062
|
108063
|
108064
|
108065
|
108066
|
108510
|
108511
|
108512
|
108513
|
108514
|
108515
|
108516
|
110162
|
110163
|
110164
|
110165
|
110166
|
110167
|
110168
|
110187
|
110188
|
110189
|
110190
|
110191
|
110192
|
110193
|
111066
|
111067
|
111068
|
111069
|
111070
|
111071
|
111072
|
111074
|
111126
|
111127
|
111128
|
111129
|
111130
|
111131
|
111132
|
111133
|
111220
|
111221
|
111222
|
111223
|
111224
|
111225
|
111226
|
111227
|
111228
|
111229
|
111230
|
111231
|
111232
|
111233
|
111234
|
111235
|
111611
|
111612
|
111613
|
111614
|
111615
|
111616
|
111617
|
111618
|
111619
|
111620
|
111623
|
111725
|
111757
|
111758
|
111759
|
111760
|
111761
|
111762
|
111763
|
111764
|
111765
|
111766
|
111767
|
111768
|
111769
|
111770
|
111776
|
111777
|
111778
|
111779
|
111780
|
111781
|
111782
|
111783
|
111784
|
111785
|
111786
|
111787
|
111788
|
112985
|
112988
|
112989
|
113226
|
113227
|
113241
|
113251
|
113253
|
113256
|
113257
|
113260