Bugzilla – Attachment 53571 Details for
Bug 6934
New report Cash Register Statistics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6934: Fix code in CashRegisterStats (dataTables pagination, more accurate descriptions, add a delimiter pull down, change C4::Dates to Koha::DateUtils)
Bug-6934-Fix-code-in-CashRegisterStats-dataTables-.patch (text/plain), 12.20 KB, created by
Bouzid Fergani
on 2016-07-21 14:57:38 UTC
(
hide
)
Description:
Bug 6934: Fix code in CashRegisterStats (dataTables pagination, more accurate descriptions, add a delimiter pull down, change C4::Dates to Koha::DateUtils)
Filename:
MIME Type:
Creator:
Bouzid Fergani
Created:
2016-07-21 14:57:38 UTC
Size:
12.20 KB
patch
obsolete
>From 82e007d1612c385c63fbb158c4adbb0f3d08ce07 Mon Sep 17 00:00:00 2001 >From: genevieve <genevieve.plantin@inlibro.com> >Date: Tue, 15 Sep 2015 11:18:49 -0400 >Subject: [PATCH] Bug 6934: Fix code in CashRegisterStats (dataTables > pagination, more accurate descriptions, add a delimiter pull down, change > C4::Dates to Koha::DateUtils) > >I cleaned up the code according to comment #23. I got rid of DHTMLcalendar_dateformat, >beacause it wasn't use in cash_register_stats.tt. C4::Dates is deprecated, >Koha::DateUtils is now used. >Some column names are changed and the pagination for the dataTables is fixed. > >Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> >--- > .../prog/en/includes/reports-menu.inc | 2 +- > .../prog/en/modules/reports/cash_register_stats.tt | 52 +++++++++++++--------- > reports/cash_register_stats.pl | 31 +++++++------ > 3 files changed, 49 insertions(+), 36 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc >index 41dd0d2..03b4b64 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc >@@ -10,7 +10,7 @@ > <li><a href="/cgi-bin/koha/reports/catalogue_stats.pl">Catalog</a></li> > <li><a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation</a></li> > <li><a href="/cgi-bin/koha/reports/serials_stats.pl">Serials</a></li> >- <li><a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash Register</a></li> >+ <li><a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash register</a></li> > <li><a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds</a></li> > </ul> > >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 4a5c10e..4ec7fe1 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,17 +1,19 @@ >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Reports [% IF ( do_it ) %]› Cash Register Statistics › Results[% ELSE %]› Cash Register Statistics[% END %]</title> >+<title>Koha › Reports [% IF ( do_it ) %]› Cash register statistics › Results[% ELSE %]› Cash register statistics[% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'datatables-strings.inc' %] > <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> >-<script type="text/javascript" id="js">$(document).ready(function() { >+<script type="text/javascript" id="js"> > $(document).ready(function() { > $("#tbl_cash_register_stats").dataTable($.extend(true, {}, dataTablesDefaults, { >- "iDisplayLength": 50 >+ "iDisplayLength": 50, >+ "sPaginationType": "full_numbers" > })); > }); >-}); </script> >+</script> > [% INCLUDE 'calendar.inc' %] > <script type="text/javascript"> > //<![CDATA[ >@@ -25,7 +27,6 @@ function isNull(f,noalert) { > } > > $(document).ready(function() { >- > // http://jqueryui.com/demos/datepicker/#date-range > var dates = $( "#filter_date_begin, #filter_date_end" ).datepicker({ > changeMonth: true, >@@ -56,8 +57,6 @@ $(document).ready(function() { > alert(alertString); > return false; > } >- >- $(this).submit(); > }); > }); > >@@ -73,9 +72,9 @@ $(document).ready(function() { > <a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> > › > [% IF ( do_it ) %] >- <a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash Register Statistics</a> › Results >+ <a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash register statistics</a> › Results > [% ELSE %] >- Cash Register Statistics >+ Cash register statistics > [% END %] > </div> > >@@ -88,7 +87,7 @@ $(document).ready(function() { > <h1>Cash register statistics</h1> > <form method="post" action="/cgi-bin/koha/reports/cash_register_stats.pl" id="frmCashRegister"> > <fieldset class="rows"> >- <legend>Cash Register statistics [% beginDate %] to [% endDate %]</legend> >+ <legend>Cash register statistics [% beginDate | $KohaDates %] to [% endDate | $KohaDates %]</legend> > <table> > <thead> > <tr> >@@ -99,9 +98,9 @@ $(document).ready(function() { > <tr> > <td> > <label for="filter_date_begin">From</label> >- <input type="text" size="10" id="filter_date_begin" name="filter_date_begin" value="[% beginDate %]" /> >+ <input type="text" size="10" id="filter_date_begin" name="filter_date_begin" value="[% beginDate | $KohaDates %]" /> > <label for="filter_date_end">To</label> >- <input type="text" size="10" id="filter_date_end" name="filter_date_end" value="[% endDate %]" /> >+ <input type="text" size="10" id="filter_date_end" name="filter_date_end" value="[% endDate | $KohaDates %]" /> > </td> > </tr> > </tbody> >@@ -144,9 +143,9 @@ $(document).ready(function() { > [% END %] > > [% IF transaction_type == "FU" %] >- <option value="FU" selected="selected">Fine - long period</option> >+ <option value="FU" selected="selected">Accruing fine</option> > [% ELSE %] >- <option value="FU">Fine - long period</option> >+ <option value="FU">Accruing fine</option> > [% END %] > > [% IF transaction_type == "PAY" %] >@@ -156,7 +155,7 @@ $(document).ready(function() { > [% END %] > > [% IF transaction_type == "A" %] >- <option value="A" selected="selected">Account Management Fee</option> >+ <option value="A" selected="selected">Account management fee</option> > [% ELSE %] > <option value="A">Account Management Fee</option> > [% END %] >@@ -218,6 +217,17 @@ $(document).ready(function() { > <label for="outputfile">To a file:</label> > <input type="radio" name="output" value="file" id="outputfile" /> > <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" /> >+ <label class="inline" for="sep">Delimiter: </label> >+ <select name="sep" id="sep" size="1"> >+ [% FOREACH value IN CGIsepChoice.values.sort() %] >+ [% IF ( value == CGIsepChoice.default ) %] >+ <option value="[% value %]" selected="selected">[% value %]</option> >+ [% ELSE %] >+ <option value="[% value %]">[% value %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ > </li> > </ol> > </fieldset> >@@ -233,15 +243,15 @@ $(document).ready(function() { > <thead> > <tr> > <th>Manager name</th> >- <th>Borrower cardnumber</th> >- <th>Borrower name</th> >- <th>Branch</th> >+ <th>Patron cardnumber</th> >+ <th>Patron name</th> >+ <th>Library</th> > <th>Transaction date</th> > <th>Transaction type</th> > <th>Amount</th> > <th>Biblio title</th> > <th>Barcode</th> >- <th>Document type</th> >+ <th>Item type</th> > </tr> > </thead> > [% FOREACH loopresul IN loopresult %] >@@ -250,7 +260,7 @@ $(document).ready(function() { > <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopresul.borrowernumber %]">[% loopresul.cardnumber %]</a></td> > <td>[% loopresul.bfirstname %] [% loopresul.bsurname %]</td> > <td>[% loopresul.branchname %]</td> >- <td>[% loopresul.date %]</td> >+ <td>[% loopresul.date | $KohaDates %]</td> > <td> > [% IF loopresul.accounttype == "ACT" %] > <span>Active transactions</span> >@@ -261,7 +271,7 @@ $(document).ready(function() { > [% ELSIF loopresul.accounttype == "F" %] > <span>Fine</span> > [% ELSIF loopresul.accounttype == "FU" %] >- <span>Fine - long period</span> >+ <span>Accruing fine</span> > [% ELSIF loopresul.accounttype == "Pay" %] > <span>Payment</span> > [% ELSIF loopresul.accounttype == "A" %] >diff --git a/reports/cash_register_stats.pl b/reports/cash_register_stats.pl >index 883b008..bd9aa0f 100755 >--- a/reports/cash_register_stats.pl >+++ b/reports/cash_register_stats.pl >@@ -14,8 +14,7 @@ > # with Koha; if not, write to the Free Software Foundation, Inc., > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >-use strict; >-use warnings; >+use Modern::Perl; > use C4::Auth; > use CGI; > use C4::Context; >@@ -23,7 +22,8 @@ use C4::Reports; > use C4::Output; > use C4::Koha; > use C4::Circulation; >-use C4::Dates qw/format_date format_date_in_iso/; >+use DateTime; >+use Koha::DateUtils; > use C4::Budgets qw/GetCurrency GetCurrencies/; > #use Data::Dumper; > #use Smart::Comments; >@@ -46,18 +46,17 @@ my $output = $input->param("output"); > my $basename = $input->param("basename"); > my $transaction_type = $input->param("transaction_type") || 'ACT'; > my $branchcode = $input->param("branch") || C4::Context->userenv->{'branch'}; >-our $sep = ","; >+our $sep = $input->param("sep") // ','; >+$sep = "\t" if ($sep eq 'tabulation'); > > $template->param( > do_it => $do_it, >- DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), >+ CGIsepChoice => GetDelimiterChoices, > ); > > #Initialize date pickers to today >-my $today = C4::Dates->today('iso'); >-my $fromDate = $today; >-my $toDate = $today; >- >+my $fromDate = dt_from_string; >+my $toDate = dt_from_string; > ### fromdate today: $fromDate > > my $query_manualinv = "SELECT id, authorised_value FROM authorised_values WHERE category = 'MANUAL_INV'"; >@@ -69,8 +68,10 @@ my $manualinv_types = $sth_manualinv->fetchall_arrayref({}); > > if ($do_it) { > >- $fromDate = format_date_in_iso($input->param("filter_date_begin")); >- $toDate = format_date_in_iso($input->param("filter_date_end")); >+ $fromDate = output_pref({ dt => eval { dt_from_string($input->param("filter_date_begin")) } || dt_from_string, >+ dateformat => 'sql', dateonly => 1 }); #for sql query >+ $toDate = output_pref({ dt => eval { dt_from_string($input->param("filter_date_end")) } || dt_from_string, >+ dateformat => 'sql', dateonly => 1 }); #for sql query > > my $whereTType = ''; > >@@ -119,7 +120,7 @@ if ($do_it) { > $row->{amountoutstanding} = 0 if (!$row->{amountoutstanding}); > #if ((abs($row->{amount}) - $row->{amountoutstanding}) > 0) { > $row->{amount} = sprintf("%.2f", abs ($row->{amount})); >- $row->{date} = format_date($row->{date}); >+ $row->{date} = dt_from_string($row->{date}, 'sql'); > ### date : $row->{date} > > push (@loopresult, $row); >@@ -178,12 +179,14 @@ if ($do_it) { > ### fromdate final: $fromDate > ### toDate final: $toDate > $template->param( >- beginDate => format_date($fromDate), >- endDate => format_date($toDate), >+ beginDate => dt_from_string($fromDate), >+ endDate => dt_from_string($toDate), > transaction_type => $transaction_type, > branchloop => C4::Branch::GetBranchesLoop($branchcode), > manualinv_types => $manualinv_types, >+ CGIsepChoice => GetDelimiterChoices, > ); >+ > output_html_with_http_headers $input, $cookie, $template->output; > > 1; >-- >1.9.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 6934
:
5634
|
5635
|
5640
|
5641
|
9379
|
9419
|
12602
|
12660
|
31210
|
36476
|
42564
|
42565
|
44847
|
44853
|
45972
|
45973
|
45974
|
48634
|
48642
|
48704
|
48705
|
48706
|
48707
|
48708
|
50429
|
50437
|
50938
|
53496
|
53500
|
53570
|
53571
|
53572
|
53573
|
53574
|
53575
|
53576
|
53577
|
53578
|
53579
|
53581
|
53582
|
53583
|
53584
|
53585
|
53586
|
53587
|
53588
|
53589
|
53590
|
53591
|
53648
|
53650
|
53651
|
53652
|
53653
|
53778
|
53780
|
54010
|
54088
|
54089
|
54090
|
54091
|
54092
|
54093
|
54094
|
54095
|
54096
|
54097
|
54098
|
54099
|
54100
|
55939
|
55988
|
55989
|
55990
|
55991
|
55992
|
55993
|
55994
|
55995
|
55996
|
55997
|
55998
|
55999
|
56000
|
56001
|
56763
|
56764