Bugzilla – Attachment 110165 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), 6.34 KB, created by
Martin Renvoize (ashimema)
on 2020-09-16 10:26:55 UTC
(
hide
)
Description:
Bug 24786: Update paycollect to use session register
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-09-16 10:26:55 UTC
Size:
6.34 KB
patch
obsolete
>From 75f2f6a2cb2ff587a6bf04da84bc336ad63b6ceb 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 | 5 ++-- > .../prog/en/modules/members/paycollect.tt | 18 +++--------- > members/paycollect.pl | 28 +------------------ > 4 files changed, 13 insertions(+), 46 deletions(-) > >diff --git a/Koha/Template/Plugin/Registers.pm b/Koha/Template/Plugin/Registers.pm >index a23fdb5e2d..ea38dff1eb 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_id ) > && $register->{id} == $self->session_register_id ) ? 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 19f89bb810..dd9467f161 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >@@ -24,10 +24,9 @@ > [% END %] > > [% BLOCK options_for_registers %] >- <!-- <option hidden disabled selected value> -- select an option -- </option> --> >- <option id="noregister"[% IF register_required %] disabled selected [% END %] value="">-- None --</option> >+ <option id="noregister"[% IF register_required %] disabled [% END %] selected="selected" value="">[% IF register_required %]-- Select an option--[% ELSE %]-- None --[% END %]</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 3facc29b24..8b58593805 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -2,6 +2,7 @@ > [% USE Asset %] > [% USE Koha %] > [% USE Branches %] >+[% USE Registers %] > [% USE Price %] > [% SET footerjs = 1 %] > [% PROCESS 'payments.inc' %] >@@ -20,6 +21,7 @@ > [% END %] > </div> > [% END %] >+[% 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 %] >@@ -153,13 +155,7 @@ > <li> > <label for="cash_register">Cash register: </label> > <select name="cash_register" id="cash_register"> >- [% 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> > [% END %] >@@ -289,13 +285,7 @@ > <li> > <label for="cash_register">Cash register: </label> > <select name="cash_register" id="cash_register"> >- [% 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> > [% END %] >diff --git a/members/paycollect.pl b/members/paycollect.pl >index 471559202e..5e3381e456 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -77,33 +77,7 @@ my $payment_note = uri_unescape scalar $input->param('payment_note'); > my $payment_type = scalar $input->param('payment_type'); > my $accountlines_id; > >-my $cash_register_id; >-if ( C4::Context->preference('UseCashRegisters') ) { >- $cash_register_id = $input->param('cash_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 ( !$cash_register_id ) { >- my $default_register = Koha::Cash::Registers->find( >- { branch => $library_id, branch_default => 1 } ); >- $cash_register_id = $default_register->id if $default_register; >- } >- $cash_register_id = $registers->next->id if !$cash_register_id; >- >- $template->param( >- default_register => $cash_register_id, >- registers => $registers, >- ); >- } >-} >- >+my $cash_register_id = $input->param('cash_register'); > 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