Bugzilla – Attachment 28088 Details for
Bug 6427
Rewrite of the accounts system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6427 [Part 22] - Remove unused scripts that reference previous accounts tables, references to old subroutines
Bug-6427-Part-22---Remove-unused-scripts-that-refe.patch (text/plain), 31.65 KB, created by
Kyle M Hall (khall)
on 2014-05-08 12:16:59 UTC
(
hide
)
Description:
Bug 6427 [Part 22] - Remove unused scripts that reference previous accounts tables, references to old subroutines
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-05-08 12:16:59 UTC
Size:
31.65 KB
patch
obsolete
>From 26a3e239c37f186842167705f45cd2fd106d30dd Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 7 Mar 2014 08:27:30 -0500 >Subject: [PATCH] Bug 6427 [Part 22] - Remove unused scripts that reference previous accounts tables, references to old subroutines > >--- > C4/Circulation.pm | 4 - > circ/add_message.pl | 5 - > circ/del_message.pl | 5 - > circ/stats.pl | 189 -------------- > .../prog/en/modules/circ/circulation-home.tt | 1 - > .../intranet-tmpl/prog/en/modules/circ/stats.tt | 55 ---- > .../prog/en/modules/reports/reports-home.tt | 1 - > .../prog/en/modules/reports/stats_screen.tt | 131 ---------- > offline_circ/enqueue_koc.pl | 1 - > offline_circ/process_koc.pl | 12 +- > reports/stats.print.pl | 178 ------------- > reports/stats.screen.pl | 267 -------------------- > 12 files changed, 9 insertions(+), 840 deletions(-) > delete mode 100755 circ/stats.pl > delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/stats.tt > delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/reports/stats_screen.tt > delete mode 100755 reports/stats.print.pl > delete mode 100755 reports/stats.screen.pl > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index e7fdd78..2309fd2 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2010,10 +2010,6 @@ of the return. It is ignored when a dropbox_branch is passed in. > C<$privacy> contains the privacy parameter. If the patron has set privacy to 2, > the old_issue is immediately anonymised > >-Ideally, this function would be internal to C<C4::Circulation>, >-not exported, but it is currently needed by one >-routine in C<C4::Accounts>. >- > =cut > > sub MarkIssueReturned { >diff --git a/circ/add_message.pl b/circ/add_message.pl >index 9c39dc9..1f34020 100755 >--- a/circ/add_message.pl >+++ b/circ/add_message.pl >@@ -26,11 +26,6 @@ use C4::Context; > use C4::Auth; > use C4::Output; > use C4::Members; >-use C4::Accounts; >-use C4::Stats; >-use C4::Koha; >-use C4::Overdues; >-use C4::Branch; # GetBranches > > my $input = new CGI; > >diff --git a/circ/del_message.pl b/circ/del_message.pl >index da13bdb..77745b2 100755 >--- a/circ/del_message.pl >+++ b/circ/del_message.pl >@@ -26,11 +26,6 @@ use C4::Context; > use C4::Auth; > use C4::Output; > use C4::Members; >-use C4::Accounts; >-use C4::Stats; >-use C4::Koha; >-use C4::Overdues; >-use C4::Branch; # GetBranches > > my $input = new CGI; > >diff --git a/circ/stats.pl b/circ/stats.pl >deleted file mode 100755 >index 558a985..0000000 >--- a/circ/stats.pl >+++ /dev/null >@@ -1,189 +0,0 @@ >-#!/usr/bin/perl >- >- >-#written 14/1/2000 >-#script to display reports >- >-# Copyright 2000-2002 Katipo Communications >-# >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it under the >-# terms of the GNU General Public License as published by the Free Software >-# Foundation; either version 2 of the License, or (at your option) any later >-# version. >-# >-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >-# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License along >-# 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; FIXME - Bug 2505 >-use CGI; >-use C4::Context; >-use C4::Output; >-use C4::Auth; >-use Date::Manip; >-use C4::Stats; >-use C4::Debug; >- >-use vars qw($debug); >- >-my $input = new CGI; >-my $time = $input->param('time') || ''; >- >-my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >- { >- template_name => "circ/stats.tmpl", >- query => $input, >- type => "intranet", >- authnotrequired => 0, >- flagsrequired => { reports => 1 }, >- debug => 1, >- } >-); >- >-my $date; >-my $date2; >-if ( $time eq 'yesterday' ) { >- $date = ParseDate('yesterday'); >- $date2 = ParseDate('today'); >-} >-elsif ( $time eq 'today' ) { >- $date = ParseDate('today'); >- $date2 = ParseDate('tomorrow'); >-} >-elsif ( $time eq 'daybefore' ) { >- $date = ParseDate('2 days ago'); >- $date2 = ParseDate('yesterday'); >-} >-elsif ( $time eq 'month' ) { >- $date = ParseDate('1 month ago'); >- $date2 = ParseDate('today'); >-} >-elsif ( $time =~ /\// ) { >- $date = ParseDate($time); >- $date2 = ParseDateDelta('+ 1 day'); >- $date2 = DateCalc( $date, $date2 ); >-} else { >- $template->param(notime => '1'); # TODO: add error feedback if time sent, but unrecognized >- output_html_with_http_headers $input, $cookie, $template->output; >- exit; >-} >- >-$debug and warn "d : $date // d2 : $date2"; >-$date = UnixDate( $date, '%Y-%m-%d' ); >-$date2 = UnixDate( $date2, '%Y-%m-%d' ); >-$debug and warn "d : $date // d2 : $date2"; >-my @payments = TotalPaid( $date, $date2 ); >-my $count = @payments; >-my $total = 0; >-my $totalw = 0; >-my $oldtime; >-my @loop; >-my %row; >-my $i = 0; >- >-while ( $i < $count ) { >- $debug and warn " pay : " . $payments[$i]{'timestamp'}; >- my $time = $payments[$i]{'datetime'}; >- my $payments = $payments[$i]{'value'}; >- my $charge = 0; >- my @temp = split(/ /, $payments[$i]{'datetime'}); >- my $date = $temp[0]; >- my @charges = >- getcharges( $payments[$i]{'borrowernumber'}, $payments[$i]{'timestamp'} ); >- my $count = @charges; >- my $temptotalf = 0; >- my $temptotalr = 0; >- my $temptotalres = 0; >- my $temptotalren = 0; >- my $temptotalw = 0; >- >- # FIXME: way too much logic to live only here in a report script >- for ( my $i2 = 0 ; $i2 < $count ; $i2++ ) { >- $charge += $charges[$i2]->{'amount'}; >- %row = ( >- name => $charges[$i2]->{'description'}, >- type => $charges[$i2]->{'accounttype'}, >- time => $charges[$i2]->{'timestamp'}, >- amount => $charges[$i2]->{'amount'}, >- branch => $charges[$i2]->{'amountoutstanding'} >- ); >- push( @loop, \%row ); >- if ( $payments[$i]{'accountytpe'} ne 'W' ) { >- if ( $charges[$i2]->{'accounttype'} eq 'Rent' ) { >- $temptotalr += >- $charges[$i2]->{'amount'} - >- $charges[$i2]->{'amountoutstanding'}; >- } >- if ( $charges[$i2]->{'accounttype'} eq 'F' >- || $charges[$i2]->{'accounttype'} eq 'FU' >- || $charges[$i2]->{'accounttype'} eq 'FN' ) >- { >- $temptotalf += >- $charges[$i2]->{'amount'} - >- $charges[$i2]->{'amountoutstanding'}; >- } >- if ( $charges[$i2]->{'accounttype'} eq 'Res' ) { >- $temptotalres += >- $charges[$i2]->{'amount'} - >- $charges[$i2]->{'amountoutstanding'}; >- } >- if ( $charges[$i2]->{'accounttype'} eq 'R' ) { >- $temptotalren += >- $charges[$i2]->{'amount'} - >- $charges[$i2]->{'amountoutstanding'}; >- } >- } >- } >- my $time2 = $payments[$i]{'date'}; >- my $branch = Getpaidbranch( $time2, $payments[$i]{'borrowernumber'} ); >- my $borrowernumber = $payments[$i]{'borrowernumber'}; >- my $oldtime = $payments[$i]{'timestamp'}; >- my $oldtype = $payments[$i]{'accounttype'}; >- >- while ($borrowernumber eq $payments[$i]{'borrowernumber'} >- && $oldtype == $payments[$i]{'accounttype'} >- && $oldtime eq $payments[$i]{'timestamp'} ) >- { >- my $xtime2 = $payments[$i]{'date'}; >- my $branch = Getpaidbranch( $xtime2, $payments[$i]{'borrowernumber'} ); >- if ( $payments[$i]{'accounttype'} eq 'W' ) { >- $totalw += $payments[$i]{'amount'}; >- } >- else { >- $payments[$i]{'amount'} = $payments[$i]{'amount'} * -1; >- $total += $payments[$i]{'amount'}; >- } >- >- #FIXME: display layer HTML >- %row = ( >- name => "<b>" >- . $payments[$i]{'firstname'} >- . $payments[$i]{'surname'} . "</b>", >- type => $payments[$i]{'accounttype'}, >- time => $payments[$i]{'date'}, >- amount => $payments[$i]{'amount'}, >- branch => $branch >- ); >- push( @loop, \%row ); >- $oldtype = $payments[$i]{'accounttype'}; >- $oldtime = $payments[$i]{'timestamp'}; >- $borrowernumber = $payments[$i]{'borrowernumber'}; >- $i++; >- } >-} >- >-$template->param( >- loop1 => \@loop, >- totalw => $totalw, >- total => $total >-); >- >-output_html_with_http_headers $input, $cookie, $template->output; >- >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >index e5eaddc..6a58ae8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >@@ -45,7 +45,6 @@ > - <b>Warning:</b> This report is very resource intensive on > systems with large numbers of overdue items.</li>[% END %] > <li> <a href="/cgi-bin/koha/circ/branchoverdues.pl">Overdues with fines</a> - Limited to your library. See report help for other details.</li> >-<!-- <li> <a href="/cgi-bin/koha/circ/stats.pl?time=yesterday">Daily reconciliation</a></li> --> > </ul> > > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/stats.tt >deleted file mode 100644 >index d62c1af..0000000 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/stats.tt >+++ /dev/null >@@ -1,55 +0,0 @@ >-[% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Circulation › Statistics</title> >-[% INCLUDE 'doc-head-close.inc' %] >-</head> >-<body id="circ_stats" class="circ"> >-[% INCLUDE 'header.inc' %] >-[% INCLUDE 'circ-search.inc' %] >- >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> › Statistics</div> >- >-<div id="doc3" class="yui-t2"> >- >- <div id="bd"> >- <div id="yui-main"> >- <div class="yui-b"> >- >- [% IF ( notime ) %] >- <h1>Display statistics for:</h1> >- <ul> >- <li><a href="/cgi-bin/koha/circ/stats.pl?time=yesterday">yesterday</a></li> >- <li><a href="/cgi-bin/koha/circ/stats.pl?time=today">today</a></li> >- [% ELSE %] >- [% IF ( loop1 ) %] >- <table> >- <caption>Statistics</caption> >- <tr> >- <th>Name</th> >- <th>Type</th> >- <th>Date/time</th> >- <th>Amount</th> >- <th>Library</th> >- <tr> >- [% FOREACH loop IN loop1 %] >- <tr> >- <td>[% loop.name %]</td> >- <td>[% loop.type %]</td> >- <td>[% loop.time %]</td> >- <td>[% loop.amount %]</td> >- <td>[% loop.branch %]</td> >- </tr> >- [% END %] >- </table> >- <p>Total paid: [% total %]<br />Total written off: [% totalw %]</p> >- [% ELSE %] >- <h3>No statistics to report</h3> >- [% END %] >- >- [% END %] >-</div> >-</div> >-<div class="yui-b"> >-[% INCLUDE 'circ-menu.inc' %] >-</div> >-</div> >-[% INCLUDE 'intranet-bottom.inc' %] >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >index c7744fa..2197e10 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >@@ -65,7 +65,6 @@ > <li><a href="/cgi-bin/koha/reports/issues_avg_stats.pl">Average loan time</a></li> > <li><a href="http://schema.koha-community.org/" target="blank">Koha database schema</a></li> > <li><a href="http://wiki.koha-community.org/wiki/SQL_Reports_Library" target="blank">Koha reports library</a></li> >- <!--<li><a href="/cgi-bin/koha/reports/stats.screen.pl">Till reconciliation</a></li> --> > </ul></div> > </div> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/stats_screen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/stats_screen.tt >deleted file mode 100644 >index df53367..0000000 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/stats_screen.tt >+++ /dev/null >@@ -1,131 +0,0 @@ >-[% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Reports › Till reconciliation</title> >-[% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'calendar.inc' %] >-</head> >-<body id="rep_stats_screen" class="rep"> >-[% INCLUDE 'header.inc' %] >-[% INCLUDE 'circ-search.inc' %] >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> › Till reconciliation >-</div> >- >-<div id="doc3" class="yui-t2"> >- >- <div id="bd"> >- <div id="yui-main"> >- <div class="yui-b"> >- >-<h1>Till reconciliation</h1> >- >-<fieldset><legend>Search between two dates</legend> >-<form action="stats.screen.pl" method="post"> >- <label for="from">Start Date: </label> >- <input type="text" name="time" size="10" value="[% IF ( date ) %][% date %][% ELSE %]today[% END %]" id="from" class="datepickerfrom" /> >- <label for="to">End Date: </label> >- <input type="text" name="time2" size="10" value="[% IF ( date2 ) %][% date2 %][% ELSE %]tomorrow[% END %]" class="datepickerto" id="to" /> >- <input type="submit" value="To screen" name="submit" class="submit" /> >-<!-- <input type="submit" value="To Excel" name="submit" class="button"> --></fieldset> >-</form> >- >-<h2>Payments</h2> >- >- <table> >- <tr> >- <th>Library</th> >- <th>Date/time</th> >- <th>Surname</th> >- <th>First name</th> >- <th>Description</th> >- <th>Charge type</th> >- <th>Invoice amount</th> >- <th>Payment type</th> >- <th>Payment amount</th> >- </tr> >- >- [% FOREACH loop IN loop1 %] >- <tr> >- <td>[% loop.branch %]</td> >- <td>[% loop.datetime %]</td> >- <td>[% loop.surname %]</td> >- <td>[% loop.firstname %]</td> >- <td>[% loop.description %]</td> >- <td>[% loop.accounttype %]</td> >- <td>[% loop.amount %]</td> >- <td>[% loop.type %]</td> >- <td>[% loop.value %]</td> >- </tr> >- [% END %] >- </table> >- >-<p> >- <b>Total amount paid: [% totalpaid %]</b> >-</p> >- >- >-<h2>Credits</h2> >- >- <table> >- <tr> >- <th>Library</th> >- <th>Date/time</th> >- <th>Surname</th> >- <th>First name</th> >- <th>Description</th> >- <th>Charge type</th> >- <th>Invoice amount</th> >- </tr> >- >- [% FOREACH loop IN loop2 %] >- <tr> >- <td>[% loop.creditbranch %]</td> >- <td>[% loop.creditdate %]</td> >- <td>[% loop.creditsurname %]</td> >- <td>[% loop.creditfirstname %]</td> >- <td>[% loop.creditdescription %]</td> >- <td>[% loop.creditaccounttype %]</td> >- <td>[% loop.creditamount %]</td> >- </tr> >- [% END %] >- </table> >-<p> >- <ul><li> <b>Total amount credits: [% totalcredits %]</b></li> >- <li><b>Total number written off: [% totalwritten %] charges</b></li></ul> >-</p> >- >- >-<h2>Refunds</h2> >- >- <table> >- <tr> >- <th>Library</th> >- <th>Date/time</th> >- <th>Surname</th> >- <th>First name</th> >- <th>Description</th> >- <th>Charge type</th> >- <th>Invoice amount</th> >- </tr> >- >- [% FOREACH loop IN loop3 %] >- <tr> >- <td>[% loop.refundbranch %]</td> >- <td>[% loop.refunddate %]</td> >- <td>[% loop.refundsurname %]</td> >- <td>[% loop.refundfirstname %]</td> >- <td>[% loop.refunddescription %]</td> >- <td>[% loop.refundaccounttype %]</td> >- <td>[% loop.refundamount %]</td> >- </tr> >- [% END %] >- </table> >-<p> >- <ul><li><b>Total amount refunds: [% totalrefund %]</b></li> >- <li><b>Total amount of cash collected: [% totalcash %] </b></li></ul> >-</p> >-</div> >-</div> >-<div class="yui-b"> >-[% INCLUDE 'reports-menu.inc' %] >-</div> >-</div> >-[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/offline_circ/enqueue_koc.pl b/offline_circ/enqueue_koc.pl >index bfc1e35..f0eb0ce 100755 >--- a/offline_circ/enqueue_koc.pl >+++ b/offline_circ/enqueue_koc.pl >@@ -27,7 +27,6 @@ use C4::Auth; > use C4::Koha; > use C4::Context; > use C4::Biblio; >-use C4::Accounts; > use C4::Circulation; > use C4::Items; > use C4::Members; >diff --git a/offline_circ/process_koc.pl b/offline_circ/process_koc.pl >index 75ff319..2753bdf 100755 >--- a/offline_circ/process_koc.pl >+++ b/offline_circ/process_koc.pl >@@ -27,13 +27,14 @@ use C4::Auth; > use C4::Koha; > use C4::Context; > use C4::Biblio; >-use C4::Accounts; > use C4::Circulation; > use C4::Items; > use C4::Members; > use C4::Stats; > use C4::UploadedFile; > use C4::BackgroundJob; >+use Koha::Accounts; >+use Koha::Database; > > use Date::Calc qw( Add_Delta_Days Date_to_Days ); > >@@ -357,8 +358,13 @@ sub kocReturnItem { > > sub kocMakePayment { > my ( $circ ) = @_; >- my $borrower = GetMember( 'cardnumber'=>$circ->{ 'cardnumber' } ); >- recordpayment( $borrower->{'borrowernumber'}, $circ->{'amount'} ); >+ >+ my $borrower = >+ Koha::Database->new()->schema()->resultset('Borrower') >+ ->single( { cardnumber => $circ->{'cardnumber'} } ); >+ >+ AddCredit({ borrower => $borrower, amount => $circ->{'amount'} }); >+ > push @output, { > payment => 1, > amount => $circ->{'amount'}, >diff --git a/reports/stats.print.pl b/reports/stats.print.pl >deleted file mode 100755 >index 066aafa..0000000 >--- a/reports/stats.print.pl >+++ /dev/null >@@ -1,178 +0,0 @@ >-#!/usr/bin/perl >- >-use strict; >-#use warnings; FIXME - Bug 2505 >-use CGI; >-use C4::Output; >- >-use C4::Auth; >-use C4::Context; >-use Date::Manip; >-use C4::Stats; >-use Text::CSV_XS; >-&Date_Init("DateFormat=non-US"); # set non-USA date, eg:19/08/2005 >- >-my $csv = Text::CSV_XS->new( >- { >- 'quote_char' => '"', >- 'escape_char' => '"', >- 'sep_char' => ',', >- 'binary' => 1 >- } >-); >- >-my $input=new CGI; >-my $time=$input->param('time'); >-my $time2=$input->param('time2'); >- >-my @loop1; >-my @loop2; >-my $date; >-my $date2; >-if ($time eq 'yesterday'){ >- $date=ParseDate('yesterday'); >- $date2=ParseDate('today'); >-} >-if ($time eq 'today'){ >- $date=ParseDate('today'); >- $date2=ParseDate('tomorrow'); >-} >-if ($time eq 'daybefore'){ >- $date=ParseDate('2 days ago'); >- $date2=ParseDate('yesterday'); >-} >-if ($time eq 'month') { >- $date = ParseDate('1 month ago'); >- $date2 = ParseDate('today'); >- >-} >-if ($time=~ /\//){ >- $date=ParseDate($time); >- $date2=ParseDateDelta('+ 1 day'); >- $date2=DateCalc($date,$date2); >-} >- >-if ($time eq ''){ >- $date=ParseDate('today'); >- $date2=ParseDate('tomorrow'); >-} >- >-if ($time2 ne ''){ >- $date=ParseDate($time); >- $date2=ParseDate($time2); >-} >- >-my $date=UnixDate($date,'%Y-%m-%d'); >-my $date2=UnixDate($date2,'%Y-%m-%d'); >- >-#warn "MASON: DATE: $date, $date2"; >- >-#get a list of every payment >-my @payments=TotalPaid($date,$date2); >- >-my $count=@payments; >-# print "MASON: number of payments=$count\n"; >- >-my $i=0; >-my $totalcharges=0; >-my $totalcredits=0; >-my $totalpaid=0; >-my $totalwritten=0; >- >-# lets get a a list of all individual item charges paid for by that payment >-while ($i<$count ){ >- >- my $count; >- my @charges; >- >- if ($payments[$i]{'type'} ne 'writeoff'){ # lets ignore writeoff payments!. >- @charges=getcharges($payments[$i]{'borrowernumber'}, $payments[$i]{'timestamp'}, $payments[$i]{'proccode'}); >- $totalcharges++; >- $count=@charges; >- >- # getting each of the charges and putting them into a array to be printed out >- #this loops per charge per person >- for (my $i2=0;$i2<$count;$i2++){ >- >- my $hour=substr($payments[$i]{'timestamp'},8,2); >- my $min=substr($payments[$i]{'timestamp'},10,2); >- my $sec=substr($payments[$i]{'timestamp'},12,2); >- my $time="$hour:$min:$sec"; >- my $time2="$payments[$i]{'date'}"; >-# my $branch=Getpaidbranch($time2,$payments[$i]{'borrowernumber'}); >- my $branch=$payments[$i]{'branch'}; >- >- my @rows1 = ($branch, # lets build up a row >- $payments[$i]->{'datetime'}, >- $payments[$i]->{'surname'}, >- $payments[$i]->{'firstname'}, >- $charges[$i2]->{'description'}, >- $charges[$i2]->{'accounttype'}, >- # rounding amounts to 2dp and adding dollar sign to make excel read it as currency format >- "\$".sprintf("%.2f", $charges[$i2]->{'amount'}), >- $payments[$i]->{'type'}, >- "\$".$payments[$i]->{'value'}); >- >- push (@loop1, \@rows1); >- $totalpaid = $totalpaid + $payments[$i]->{'value'}; >- } >- } else { >- ++$totalwritten; >- } >- >- $i++; #increment the while loop >-} >- >-#get credits and append to the bottom of payments >-my @credits=getcredits($date,$date2); >- >-my $count=@credits; >-my $i=0; >- >-while ($i<$count ){ >- >- my @rows2 = ($credits[$i]->{'branchcode'}, >- $credits[$i]->{'date'}, >- $credits[$i]->{'surname'}, >- $credits[$i]->{'firstname'}, >- $credits[$i]->{'description'}, >- $credits[$i]->{'accounttype'}, >- "\$".$credits[$i]->{'amount'}); >- >- push (@loop2, \@rows2); >- $totalcredits = $totalcredits + $credits[$i]->{'amount'}; >- $i++; >-} >- >-#takes off first char minus sign "-100.00" >-$totalcredits = substr($totalcredits, 1); >- >-print $input->header( >- -type => 'application/vnd.ms-excel', >- -attachment => "stats.csv", >-); >-print "Branch, Datetime, Surname, Firstnames, Description, Type, Invoice amount, Payment type, Payment Amount\n"; >- >- >-for my $row ( @loop1 ) { >- >- $csv->combine(@$row); >- my $string = $csv->string; >- print $string, "\n"; >-} >- >-print ",,,,,,,\n"; >- >-for my $row ( @loop2 ) { >- >- $csv->combine(@$row); >- my $string = $csv->string; >- print $string, "\n"; >-} >- >-print ",,,,,,,\n"; >-print ",,,,,,,\n"; >-print ",,Total Amount Paid, $totalpaid\n"; >-print ",,Total Number Written, $totalwritten\n"; >-print ",,Total Amount Credits, $totalcredits\n"; >- >diff --git a/reports/stats.screen.pl b/reports/stats.screen.pl >deleted file mode 100755 >index 16b8f8a..0000000 >--- a/reports/stats.screen.pl >+++ /dev/null >@@ -1,267 +0,0 @@ >-#!/usr/bin/perl >- >-# Copyright Katipo Communications 2006 >-# >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it under the >-# terms of the GNU General Public License as published by the Free Software >-# Foundation; either version 2 of the License, or (at your option) any later >-# version. >-# >-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >-# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License along >-# 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; FIXME - Bug 2505 >-use CGI; >-use C4::Output; >-use C4::Auth; >-use C4::Context; >-use C4::Stats; >-use C4::Accounts; >-use C4::Debug; >-use Date::Manip; >- >-my $input = new CGI; >-my $time = $input->param('time'); >-my $time2 = $input->param('time2'); >-my $op = $input->param('submit'); >- >-my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >- { >- template_name => "reports/stats_screen.tmpl", >- query => $input, >- type => "intranet", >- authnotrequired => 1, >- flagsrequired => { reports => '*' }, >- debug => 1, >- } >-); >- >-( $time = "today" ) if !$time; >-( $time2 = "tomorrow" ) if !$time2; >- >-my $date = ParseDate($time); >-my $date2 = ParseDate($time2); >-$date = UnixDate( $date, '%Y-%m-%d' ); >-$date2 = UnixDate( $date2, '%Y-%m-%d' ); >-$debug and warn "MASON: TIME: $time, $time2"; >-$debug and warn "MASON: DATE: $date, $date2"; >- >-# get a list of every payment >-my @payments = TotalPaid( $date, $date2 ); >- >-my $count = @payments; >- >-$debug and warn "MASON: number of payments=$count\n"; >- >-my $i = 0; >-my $totalcharges = 0; >-my $totalcredits = 0; >-my $totalpaid = 0; >-my $totalwritten = 0; >-my @loop1; >-my @loop2; >- >-# lets get a a list of all individual item charges paid for by that payment >- >-foreach my $payment (@payments) { >- >- my @charges; >- if ( $payment->{'type'} ne 'writeoff' ) { >- >- @charges = getcharges( >- $payment->{'borrowernumber'}, >- $payment->{'timestamp'}, >- $payment->{'proccode'} >- ); >- $totalcharges++; >- my $count = @charges; >- >- # getting each of the charges and putting them into a array to be printed out >- #this loops per charge per person >- for ( my $i2 = 0 ; $i2 < $count ; $i2++ ) { >- my $hour = substr( $payment->{'timestamp'}, 8, 2 ); >- my $min = substr( $payment->{'timestamp'}, 10, 2 ); >- my $sec = substr( $payment->{'timestamp'}, 12, 2 ); >- my $time = "$hour:$min:$sec"; >- my $time2 = "$payment->{'date'}"; >- >- # my $branch=Getpaidbranch($time2,$payment->{'borrowernumber'}); >- my $branch = $payment->{'branch'}; >- >- # lets build up a row >- my %rows1 = ( >- branch => $branch, >- datetime => $payment->{'datetime'}, >- surname => $payment->{'surname'}, >- firstname => $payment->{'firstname'}, >- description => $charges[$i2]->{'description'}, >- accounttype => $charges[$i2]->{'accounttype'}, >- amount => sprintf( "%.2f", $charges[$i2]->{'amount'} ) >- , # rounding amounts to 2dp >- type => $payment->{'type'}, >- value => sprintf( "%.2f", $payment->{'value'} ) >- ); # rounding amounts to 2dp >- >- push( @loop1, \%rows1 ); >- >- } >- $totalpaid = $totalpaid + $payment->{'value'}; >- $debug and warn "totalpaid = $totalpaid"; >- } >- else { >- ++$totalwritten; >- } >- >-} >- >-#get credits and append to the bottom of payments >-my @credits = getcredits( $date, $date2 ); >- >-my $count = @credits; >-my $i = 0; >- >-while ( $i < $count ) { >- >- my %rows2 = ( >- creditbranch => $credits[$i]->{'branchcode'}, >- creditdate => $credits[$i]->{'date'}, >- creditsurname => $credits[$i]->{'surname'}, >- creditfirstname => $credits[$i]->{'firstname'}, >- creditdescription => $credits[$i]->{'description'}, >- creditaccounttype => $credits[$i]->{'accounttype'}, >- creditamount => sprintf( "%.2f", $credits[$i]->{'amount'} ) >- ); >- >- push( @loop2, \%rows2 ); >- $totalcredits = $totalcredits + $credits[$i]->{'amount'}; >- $i++; #increment the while loop >-} >- >-#takes off first char minus sign "-100.00" >-$totalcredits = substr( $totalcredits, 1 ); >- >-my $totalrefunds = 0; >-my @loop3; >-my @refunds = getrefunds( $date, $date2 ); >-$count = @refunds; >-$i = 0; >- >-while ( $i < $count ) { >- >- my %rows3 = ( >- refundbranch => $refunds[$i]->{'branchcode'}, >- refunddate => $refunds[$i]->{'datetime'}, >- refundsurname => $refunds[$i]->{'surname'}, >- refundfirstname => $refunds[$i]->{'firstname'}, >- refunddescription => $refunds[$i]->{'description'}, >- refundaccounttype => $refunds[$i]->{'accounttype'}, >- refundamount => sprintf( "%.2f", $refunds[$i]->{'amount'} ) >- ); >- >- push( @loop3, \%rows3 ); >- $totalrefunds = $totalrefunds + $refunds[$i]->{'amount'}; >- $i++; #increment the while loop >-} >- >-my $totalcash = $totalpaid - $totalrefunds; >- >-if ( $op eq 'To Excel' ) { >- >- my $csv = Text::CSV_XS->new( >- { >- 'quote_char' => '"', >- 'escape_char' => '"', >- 'sep_char' => ',', >- 'binary' => 1 >- } >- ); >- >- print $input->header( >- -type => 'application/vnd.ms-excel', >- -attachment => "stats.csv", >- ); >- print >-"Branch, Datetime, Surname, Firstnames, Description, Type, Invoice amount, Payment type, Payment Amount\n"; >- >- $DB::single = 1; >- >- for my $row (@loop1) { >- my @array = ( >- $row->{'branch'}, $row->{'datetime'}, >- $row->{'surname'}, $row->{'firstname'}, >- $row->{'description'}, $row->{'accounttype'}, >- $row->{'amount'}, $row->{'type'}, >- $row->{'value'} >- ); >- >- $csv->combine(@array); >- my $string = $csv->string(@array); >- print $string, "\n"; >- } >- print ",,,,,,,\n"; >- print >-"Branch, Date/time, Surname, Firstname, Description, Charge Type, Invoice Amount\n"; >- >- for my $row (@loop2) { >- >- my @array = ( >- $row->{'creditbranch'}, $row->{'creditdate'}, >- $row->{'creditsurname'}, $row->{'creditfirstname'}, >- $row->{'creditdescription'}, $row->{'creditaccounttype'}, >- $row->{'creditamount'} >- ); >- >- $csv->combine(@array); >- my $string = $csv->string(@array); >- print $string, "\n"; >- } >- print ",,,,,,,\n"; >- print >-"Branch, Date/time, Surname, Firstname, Description, Charge Type, Invoice Amount\n"; >- >- for my $row (@loop3) { >- my @array = ( >- $row->{'refundbranch'}, $row->{'refunddate'}, >- $row->{'refundsurname'}, $row->{'refundfirstname'}, >- $row->{'refunddescription'}, $row->{'refundaccounttype'}, >- $row->{'refundamount'} >- ); >- >- $csv->combine(@array); >- my $string = $csv->string(@array); >- print $string, "\n"; >- >- } >- >- print ",,,,,,,\n"; >- print ",,,,,,,\n"; >- print ",,Total Amount Paid, $totalpaid\n"; >- print ",,Total Number Written, $totalwritten\n"; >- print ",,Total Amount Credits, $totalcredits\n"; >- print ",,Total Amount Refunds, $totalrefunds\n"; >-} >-else { >- $template->param( >- date => $time, >- date2 => $time2, >- loop1 => \@loop1, >- loop2 => \@loop2, >- loop3 => \@loop3, >- totalpaid => $totalpaid, >- totalcredits => $totalcredits, >- totalwritten => $totalwritten, >- totalrefund => $totalrefunds, >- totalcash => $totalcash, >- ); >- output_html_with_http_headers $input, $cookie, $template->output; >-} >- >-- >1.7.2.5
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 6427
:
21922
|
22704
|
22705
|
22708
|
22709
|
22710
|
22741
|
22870
|
22871
|
22872
|
22873
|
22874
|
22875
|
22876
|
22881
|
22889
|
22940
|
22948
|
22949
|
22995
|
23000
|
23137
|
23158
|
23161
|
23171
|
23186
|
23269
|
23275
|
23276
|
23391
|
23392
|
23400
|
23401
|
23402
|
23403
|
23404
|
23405
|
23406
|
23407
|
23408
|
23409
|
23410
|
23411
|
23412
|
23413
|
23420
|
23421
|
23422
|
23423
|
23424
|
23425
|
23426
|
23427
|
23428
|
23429
|
23430
|
23431
|
23432
|
23433
|
23440
|
23441
|
23442
|
23443
|
23444
|
23445
|
23446
|
23447
|
23448
|
23449
|
23450
|
23451
|
23452
|
23453
|
23454
|
23458
|
23459
|
23460
|
23461
|
23462
|
23463
|
23464
|
23465
|
23466
|
23467
|
23468
|
23469
|
23470
|
23471
|
23603
|
23643
|
23644
|
23645
|
23646
|
23647
|
23648
|
23649
|
23650
|
23651
|
23652
|
23653
|
23654
|
23655
|
23656
|
23657
|
23937
|
23938
|
23939
|
23940
|
23941
|
23942
|
23943
|
23944
|
23945
|
23946
|
23947
|
23948
|
23949
|
23950
|
23951
|
24612
|
24613
|
24614
|
24615
|
24616
|
24617
|
24618
|
24619
|
24620
|
24621
|
24622
|
24623
|
24624
|
24625
|
24626
|
24627
|
24628
|
24757
|
24758
|
24759
|
24760
|
24761
|
24762
|
24763
|
24764
|
24765
|
24766
|
24767
|
24768
|
24769
|
24770
|
24771
|
24772
|
24777
|
24792
|
24793
|
24794
|
24795
|
24796
|
24797
|
24798
|
24799
|
24800
|
24801
|
24802
|
24803
|
24804
|
24805
|
24806
|
24807
|
24808
|
24809
|
24810
|
24811
|
24812
|
24813
|
24814
|
24815
|
24816
|
24817
|
24818
|
24819
|
24820
|
24821
|
24822
|
24823
|
24824
|
24825
|
24826
|
24827
|
24828
|
24829
|
24830
|
24831
|
24832
|
24833
|
24834
|
24835
|
24836
|
24837
|
24838
|
24839
|
24840
|
24841
|
24842
|
24843
|
24844
|
25777
|
25778
|
25779
|
25780
|
25781
|
25782
|
25783
|
25784
|
25785
|
25786
|
25787
|
25788
|
25789
|
25790
|
25791
|
25792
|
25793
|
25794
|
25795
|
25796
|
25797
|
25798
|
25799
|
25800
|
25801
|
25802
|
25803
|
25804
|
25805
|
25806
|
25807
|
25808
|
25809
|
25810
|
25811
|
25812
|
25813
|
25814
|
25815
|
25816
|
25930
|
25932
|
25933
|
25934
|
26033
|
26034
|
26035
|
26036
|
26107
|
27167
|
27168
|
27169
|
27170
|
27171
|
27172
|
27173
|
27174
|
27175
|
27176
|
27177
|
27178
|
27179
|
27180
|
27181
|
27182
|
27183
|
27184
|
27185
|
27186
|
27187
|
27189
|
27190
|
27197
|
28067
|
28068
|
28069
|
28070
|
28071
|
28072
|
28073
|
28074
|
28075
|
28076
|
28077
|
28078
|
28079
|
28080
|
28081
|
28082
|
28083
|
28084
|
28085
|
28086
|
28087
|
28088
|
28089
|
28090
|
28091
|
28527
|
28528
|
28529
|
28530
|
28531
|
28532
|
28533
|
28534
|
28535
|
28536
|
28537
|
28538
|
28539
|
28540
|
28541
|
28542
|
28543
|
28544
|
28545
|
28546
|
28547
|
28548
|
28549
|
28550
|
28551
|
28552
|
28553
|
28555
|
28556
|
28561
|
28563
|
28564
|
28795
|
28796
|
28797
|
28798
|
28799
|
28800
|
28801
|
28802
|
28803
|
28804
|
28805
|
28806
|
28807
|
28808
|
28809
|
28810
|
28811
|
28812
|
28813
|
28814
|
28815
|
28816
|
28817
|
28818
|
28819
|
28820
|
28821
|
28822
|
28887
|
28888
|
28889
|
28890
|
28909
|
29176
|
29230
|
29231
|
29232
|
29233
|
29234
|
29235
|
29236
|
29237
|
29238
|
29239
|
29240
|
29241
|
29242
|
29243
|
29244
|
29245
|
29246
|
29247
|
29248
|
29249
|
29250
|
29251
|
29252
|
29253
|
29254
|
29255
|
29256
|
29257
|
29258
|
29259
|
29260
|
29261
|
29262
|
29263
|
29264
|
29265
|
29706
|
29707
|
29708
|
29709
|
29710
|
29711
|
29712
|
29713
|
29714
|
29715
|
29716
|
29717
|
29719
|
29720
|
29721
|
29722
|
29723
|
29724
|
29725
|
29726
|
29727
|
29728
|
29729
|
29730
|
30271
|
30272
|
30273
|
30274
|
30275
|
30276
|
30277
|
30278
|
30279
|
30280
|
30281
|
30282
|
30320
|
30321
|
30322
|
30323
|
30324
|
30325
|
30326
|
30327
|
30328
|
30329
|
30330
|
30331
|
30416
|
30417
|
30418
|
30419
|
30420
|
30421
|
30422
|
30423
|
30424
|
30425
|
30426
|
30427
|
31477
|
31478
|
31479
|
31480
|
31481
|
31482
|
31483
|
31484
|
31485
|
31486
|
31487
|
31488
|
31754
|
31755
|
31756
|
31757
|
31758
|
31759
|
31760
|
31761
|
31762
|
31763
|
31764
|
31765
|
31766
|
31767
|
31768
|
31769
|
31770
|
31771
|
31772
|
31773
|
31774
|
31775
|
31776
|
31777
|
32478
|
32479
|
32480
|
32481
|
32482
|
32483
|
32484
|
32485
|
32486
|
32487
|
32488
|
32489
|
32591
|
32592
|
32593
|
32594
|
32595
|
32596
|
32597
|
32598
|
32599
|
32600
|
32601
|
32602
|
32827
|
32828
|
32829
|
32830
|
32831
|
32832
|
32833
|
32834
|
32835
|
32836
|
32837
|
32838
|
33251
|
33252
|
33253
|
33254
|
33255
|
33256
|
33257
|
33258
|
33259
|
33260
|
33261
|
33262
|
34096
|
34097
|
34098
|
34099
|
34100
|
34101
|
34102
|
34103
|
34104
|
34105
|
34106
|
34107
|
34204
|
34205
|
34206
|
34207
|
34208
|
34209
|
34210
|
34211
|
34212
|
34213
|
34214
|
34215
|
35196
|
35197
|
35198
|
35199
|
35200
|
35201
|
35202
|
35203
|
35204
|
35205
|
35206
|
35207
|
35208
|
35302
|
36324
|
36326
|
36327
|
36328
|
36329
|
36330
|
36331
|
36332
|
36333
|
36334
|
36335
|
36337
|
36338
|
36340
|
36380
|
36391
|
36393
|
37127
|
37128
|
37129
|
37130
|
37131
|
37133
|
37134
|
37135
|
37136
|
37137
|
37138
|
37139
|
37140
|
37141
|
37142
|
37143
|
37147
|
37148
|
37149
|
37150
|
37151
|
37152
|
37153
|
37154
|
37155
|
37156
|
37157
|
37158
|
37159
|
37160
|
37161
|
37162
|
37229
|
37230
|
37231
|
37232
|
37233
|
37234
|
37235
|
37236
|
37237
|
37238
|
37239
|
37240
|
37241
|
37242
|
37243
|
37244
|
38247
|
38248
|
38249
|
38250
|
38251
|
38252
|
38253
|
38254
|
38255
|
38256
|
38257
|
38258
|
38259
|
38260
|
38261
|
38262
|
39063
|
39064
|
39065
|
39066
|
39067
|
39069
|
39070
|
39071
|
39072
|
39073
|
39074
|
39075
|
39076
|
39077
|
39078
|
39079
|
39671
|
39672
|
39673
|
39674
|
39675
|
39676
|
39677
|
39678
|
39679
|
39680
|
39681
|
39682
|
39683
|
39684
|
39685
|
39686