Bugzilla – Attachment 112960 Details for
Bug 24665
Add ability to run cash register report with new cash register feature
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24665: Add support for filtering by cash register
Bug-24665-Add-support-for-filtering-by-cash-regist.patch (text/plain), 4.60 KB, created by
Katrin Fischer
on 2020-11-03 22:31:32 UTC
(
hide
)
Description:
Bug 24665: Add support for filtering by cash register
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-11-03 22:31:32 UTC
Size:
4.60 KB
patch
obsolete
>From 38884d59f3da253889ad4c6d2294a3ea7994d435 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 21 Jul 2020 14:54:09 +0100 >Subject: [PATCH] Bug 24665: Add support for filtering by cash register > >This patch makes it possible to filter on cash register >on the cash register statistics page. > >To test: >- Activate UseCashRegisters >- Create a cash register or more to use >- Create some manual fees and fines >- Pay some of them off >- Go to Tools > Cash register statistics >- Test if the new filter for cash registers works as it should > >Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/Template/Plugin/Registers.pm | 9 ++++++++- > .../prog/en/modules/reports/cash_register_stats.tt | 14 ++++++++++++-- > reports/cash_register_stats.pl | 9 +++++++++ > 3 files changed, 29 insertions(+), 3 deletions(-) > >diff --git a/Koha/Template/Plugin/Registers.pm b/Koha/Template/Plugin/Registers.pm >index 7baf5d6bf8..d877de0ba8 100644 >--- a/Koha/Template/Plugin/Registers.pm >+++ b/Koha/Template/Plugin/Registers.pm >@@ -89,9 +89,16 @@ sub all { > $where->{branch} = C4::Context->userenv->{'branch'} > if ( $filters->{current_branch} && C4::Context->userenv ); > my $registers = Koha::Cash::Registers->search($where)->unblessed(); >+ >+ my $selected = $params->{selected}; > for my $register ( @{$registers} ) { >- $register->{selected} = ( defined( $self->session_register_id ) >+ if ( defined($selected) ) { >+ $register->{selected} = ( $register->{id} == $selected ) ? 1 : 0; >+ } >+ else { >+ $register->{selected} = ( defined( $self->session_register_id ) > && $register->{id} eq $self->session_register_id ) ? 1 : 0; >+ } > } > > return $registers; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt >index cbcc27a056..bc0dd7e9b9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt >@@ -1,8 +1,11 @@ > [% USE raw %] > [% USE Asset %] >+[% USE Branches %] >+[% USE Koha %] > [% USE KohaDates %] > [% USE Price %] > [% USE ItemTypes %] >+[% USE Registers %] > [% SET footerjs = 1 %] > [% PROCESS 'accounts.inc' %] > [% INCLUDE 'doc-head-open.inc' %] >@@ -96,9 +99,15 @@ > [% END %] > [% END %] > </select> >- </td> >- </tr> > </li> >+ [% IF Koha.Preference('UseCashRegisters') %] >+ <li> >+ <label for="registerid">Cash register: </label> >+ <select name="registerid" id="registerid"> >+ [% PROCESS options_for_registers registers => Registers.all( selected => registerid ) %] >+ </select> >+ </li> >+ [% END %] > </ol> > </fieldset> > >@@ -186,6 +195,7 @@ > </div> <!-- /.row --> > > [% MACRO jsinclude BLOCK %] >+ [% Asset.js("js/register_selection.js") | $raw %] > [% INCLUDE 'datatables.inc' %] > <script id="js"> > $(document).ready(function() { >diff --git a/reports/cash_register_stats.pl b/reports/cash_register_stats.pl >index b9a3fe818d..8e8f46ce72 100755 >--- a/reports/cash_register_stats.pl >+++ b/reports/cash_register_stats.pl >@@ -61,6 +61,7 @@ my @debit_types = > Koha::Account::DebitTypes->search()->as_list; > my @credit_types = > Koha::Account::CreditTypes->search()->as_list; >+my $registerid; > > if ($do_it) { > >@@ -94,6 +95,12 @@ if ($do_it) { > push @extra_params, $manager_branchcode; > } > >+ my $whereRegister = q{}; >+ $registerid = $input->param("registerid"); >+ if ($registerid) { >+ $whereRegister = q{ AND al.register_id = ?}; >+ push @extra_params, $registerid; >+ } > > my $query = " > SELECT round(amount,2) AS amount, description, >@@ -110,6 +117,7 @@ if ($do_it) { > WHERE CAST(al.date AS DATE) BETWEEN ? AND ? > $whereTType > $whereBranchCode >+ $whereRegister > ORDER BY al.date > "; > my $sth_stats = $dbh->prepare($query) or die "Unable to prepare query " . $dbh->errstr; >@@ -191,6 +199,7 @@ $template->param( > branchloop => Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed, > debit_types => \@debit_types, > credit_types => \@credit_types, >+ registerid => $registerid, > CGIsepChoice => GetDelimiterChoices, > ); > >-- >2.11.0
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 24665
:
107150
|
107164
|
112901
|
112960
|
113247
|
113248
|
113261