Bugzilla – Attachment 9009 Details for
Bug 2034
circ/billing.pl needs the more complex code to achieve goals for large data sets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 2034: Removing unused scripts billig.pl/billing.tt
Bug-2034-Removing-unused-scripts-billigplbillingtt.patch (text/plain), 14.52 KB, created by
Katrin Fischer
on 2012-04-08 09:28:12 UTC
(
hide
)
Description:
Bug 2034: Removing unused scripts billig.pl/billing.tt
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2012-04-08 09:28:12 UTC
Size:
14.52 KB
patch
obsolete
>From f2aaa5a2d2b802f84a64404f272d2e82b0e6abf1 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <Katrin.Fischer.83@web.de> >Date: Sun, 8 Apr 2012 11:26:24 +0200 >Subject: [PATCH] Bug 2034: Removing unused scripts billig.pl/billing.tt > >- Scripts are currently not linked from anywhere in the templates >- Functionality can also be achieved with a custom report >- There are unresolved problems with the sql in the existig scripts >--- > circ/billing.pl | 172 -------------------- > .../intranet-tmpl/prog/en/modules/circ/billing.tt | 162 ------------------ > .../prog/en/modules/circ/circulation-home.tt | 1 - > 3 files changed, 0 insertions(+), 335 deletions(-) > delete mode 100755 circ/billing.pl > delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/billing.tt > >diff --git a/circ/billing.pl b/circ/billing.pl >deleted file mode 100755 >index 9c47b75..0000000 >--- a/circ/billing.pl >+++ /dev/null >@@ -1,172 +0,0 @@ >-#!/usr/bin/perl >- >-# 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; >-use C4::Context; >-use C4::Output; >-use CGI; >-use C4::Auth; >-use C4::Dates qw/format_date format_date_in_iso/; >-use C4::Debug; >-use Date::Calc qw/Today Add_Delta_YM/; >- >-my $input = new CGI; >-my $order = $input->param('order') || ''; >-my $startdate = $input->param('from') || ''; >-my $enddate = $input->param('to') || ''; >-my $max_bill = $input->param('ratio') || C4::Context->preference('noissuescharge') || 20.00; >- >-my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >- { >- template_name => "circ/billing.tmpl", >- query => $input, >- type => "intranet", >- authnotrequired => 0, >- flagsrequired => { circulate => "circulate_remaining_permissions" }, >- debug => 1, >- } >-); >- >-my ( $year, $month, $day ) = Today(); >-my $todaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", $year, $month, $day); >-# Find yesterday for the default shelf pull start and end dates >-# A default of the prior years's holds is a reasonable way to pull holds >-my $datelastyear = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YM($year, $month, $day, -1, 0)); >- >-$startdate =~ s/^\s+//; >-$startdate =~ s/\s+$//; >-$enddate =~ s/^\s+//; >-$enddate =~ s/\s+$//; >-# Predefine the start and end dates if they are not already defined >-$startdate = format_date($datelastyear) unless $startdate; >-$enddate = format_date($todaysdate ) unless $enddate; >- >-my $dbh = C4::Context->dbh; >-my ($sqlorderby, $sqldatewhere, $presqldatewhere) = ("","",""); >-$debug and warn "start: " . format_date_in_iso($startdate) . "\nend: " . format_date_in_iso($enddate); >-my @query_params = (); >-# the dates below is to check for compliance of the current date range >-if ($enddate) { >- $sqldatewhere .= " AND date <= ?"; >- push @query_params, format_date_in_iso($enddate); >-} >-push @query_params, $max_bill; >-# the date below is to check for compliance of all fees prior >-if ($startdate) { >- $presqldatewhere .= " AND date < ?"; >- push @query_params, format_date_in_iso($startdate); >-} >-push @query_params, $max_bill; >- >-if ($order eq "patron") { >- $sqlorderby = " ORDER BY surname, firstname "; >-} elsif ($order eq "fee") { >- $sqlorderby = " ORDER BY l_amountoutstanding DESC "; >-} elsif ($order eq "desc") { >- $sqlorderby = " ORDER BY l_description "; >-} elsif ($order eq "type") { >- $sqlorderby = " ORDER BY l_accounttype "; >-} elsif ($order eq "date") { >- $sqlorderby = " ORDER BY l_date DESC "; >-} elsif ($order eq "total") { >- $sqlorderby = " ORDER BY sum_amount DESC "; >-} else { >- $sqlorderby = " ORDER BY surname, firstname "; >-} >-my $strsth = >- "SELECT >- GROUP_CONCAT(accountlines.accounttype ORDER BY accountlines.date DESC SEPARATOR '<br/>') as l_accounttype, >- GROUP_CONCAT(description ORDER BY accountlines.date DESC SEPARATOR '<br/>') as l_description, >- GROUP_CONCAT(round(amountoutstanding,2) ORDER BY accountlines.date DESC SEPARATOR '<br/>') as l_amountoutstanding, >- GROUP_CONCAT(accountlines.date ORDER BY accountlines.date DESC SEPARATOR '<br/>') as l_date, >- GROUP_CONCAT(accountlines.itemnumber ORDER BY accountlines.date DESC SEPARATOR '<br/>') as l_itemnumber, >- count(*) as cnt, >- max(accountlines.date) as maxdate, >- round(sum(amountoutstanding),2) as sum_amount, >- borrowers.borrowernumber as borrowernumber, >- borrowers.surname as surname, >- borrowers.firstname as firstname, >- borrowers.email as email, >- borrowers.phone as phone, >- accountlines.itemnumber, >- description, >- accountlines.date as accountdate >- FROM >- borrowers, accountlines >- WHERE >- accountlines.borrowernumber = borrowers.borrowernumber >- AND accountlines.amountoutstanding <> 0 >- AND accountlines.borrowernumber >- IN (SELECT borrowernumber FROM accountlines >- where borrowernumber >= 0 >- $sqldatewhere >- GROUP BY accountlines.borrowernumber HAVING sum(amountoutstanding) >= ? ) >- AND accountlines.borrowernumber >- NOT IN (SELECT borrowernumber FROM accountlines >- where borrowernumber >= 0 >- $presqldatewhere >- GROUP BY accountlines.borrowernumber HAVING sum(amountoutstanding) >= ? ) >-"; >- >-if (C4::Context->preference('IndependantBranches')){ >- $strsth .= " AND borrowers.branchcode=? "; >- push @query_params, C4::Context->userenv->{'branch'}; >-} >-$strsth .= " GROUP BY accountlines.borrowernumber HAVING sum(amountoutstanding) >= ? " . $sqlorderby; >-push @query_params, $max_bill; >- >-my $sth = $dbh->prepare($strsth); >-$sth->execute(@query_params); >- >-my @billingdata; >-while ( my $data = $sth->fetchrow_hashref ) { >- push @billingdata, { >- l_accountype => $data->{l_accounttype}, >- l_description => $data->{l_description}, >- l_amountoutstanding => $data->{l_amountoutstanding}, >- l_date => $data->{l_date}, >- l_itemnumber => $data->{l_itemnumber}, >- l_accounttype => $data->{l_accounttype}, >- l_title => $data->{l_title}, >- cnt => $data->{cnt}, >- maxdate => $data->{maxdate}, >- sum_amount => $data->{sum_amount}, >- borrowernumber => $data->{borrowernumber}, >- surname => $data->{surname}, >- firstname => $data->{firstname}, >- phone => $data->{phone}, >- email => $data->{email}, >- patronname => $data->{surname} . ", " . $data->{firstname}, >- description => $data->{description}, >- amountoutstanding => $data->{amountoutstanding}, >- accountdata => $data->{accountdata} >- }; >-} >- >-$template->param( >- todaysdate => format_date($todaysdate), >- from => $startdate, >- to => $enddate, >- ratio => $max_bill, >- billingloop => \@billingdata, >- DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), >-); >- >-output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/billing.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/billing.tt >deleted file mode 100644 >index f1f1d82..0000000 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/billing.tt >+++ /dev/null >@@ -1,162 +0,0 @@ >-[% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Circulation › Billing</title> >-[% INCLUDE 'doc-head-close.inc' %] >-<!-- Additions to enable Calendar system --> >-<link rel="stylesheet" type="text/css" href="[% themelang %]/lib/calendar/calendar-system.css" /> >-<script type="text/javascript" src="[% themelang %]/lib/calendar/calendar.js"></script> >-<script type="text/javascript" src="[% themelang %]/lib/calendar/calendar-en.js"></script> >-<script type="text/javascript" src="[% themelang %]/lib/calendar/calendar-setup.js"></script> >-<!-- End of additions --> >-</head> >-<body id="circ_billing" 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> › Billing</div> >- >-<div id="doc3" class="yui-t2"> >- >- <div id="bd"> >- <div id="yui-main"> >- <div class="yui-b"> >- >-<h2>Billing from [% from %] to [% to %]</h2> >-<h3>Reported on [% todaysdate %]</h3> >- >- >- >- >-[% IF ( billingloop ) %] >-<h4>The following patrons have bills.</h4> >- <table> >- <tr> >- <th>Patron >- <a href="/cgi-bin/koha/circ/billing.pl?order=patron&from=[% from %]&to=[% to %]">Sort</a> >- </th> >- <th>Fee Item >- <a href="/cgi-bin/koha/circ/billing.pl?order=fee&from=[% from %]&to=[% to %]">Sort</a> >- </th> >- <th>Description >- <a href="/cgi-bin/koha/circ/billing.pl?order=desc&from=[% from %]&to=[% to %]">Sort</a> >- </th> >- <th>Type >- <a href="/cgi-bin/koha/circ/billing.pl?order=type&from=[% from %]&to=[% to %]">Sort</a> >- </th> >- <th>Date >- <a href="/cgi-bin/koha/circ/billing.pl?order=date&from=[% from %]&to=[% to %]">Sort</a> >- </th> >- <th>Total Amount >- <a href="/cgi-bin/koha/circ/billing.pl?order=total&from=[% from %]&to=[% to %]">Sort</a> >- </th> >- </tr> >- >- [% FOREACH billingloo IN billingloop %] >- <tr> >- <td> >- <p><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% billingloo.borrowernumber %]">[% billingloo.patronname %]</a><br />[% billingloo.phone %]<br /> >- [% IF ( billingloo.email ) %]<a href="mailto:[% billingloo.email %]?subject=Account: [% billingloo.title %]"> >- [% billingloo.email %]</a>[% END %] >- </p> >- </td> >- <td align="right"> >- <p>[% billingloo.l_amountoutstanding %]</p> >- </td> >- <td> >- <p>[% billingloo.l_description %]</p> >- </td> >- <td> >- <p>[% billingloo.l_accounttype %]</p> >- </td> >- <td> >- <p>[% billingloo.l_date %]</p> >- </td> >- <td align="right"> >- <p>[% billingloo.sum_amount %]</p> >- </td> >- </tr> >- [% END %] >- </table> >- [% ELSE %] >- <b>No items found.</b> >- [% END %] >- >-</div> >-</div> >-<div class="yui-b"> >-<form action="/cgi-bin/koha/circ/billing.pl" method="post" > >-<fieldset class="brief"> >-<ol><li><label for="ratio"> >- Currency Cutoff: >-</label> >-<input type="text" size="5" id="ratio" name="ratio" value="[% ratio %]" /></li> >-<li><label for="from"> >- Start date: >-</label> >-<input type="text" size="10" id="from" name="from" value="[% from %]" /> >-<img src="[% themelang %]/lib/calendar/cal.gif" border="0" id="openCalendarFrom" style="cursor: pointer;" alt="" /> >-<script language="JavaScript" type="text/javascript"> >-function validate1(date) { >- var day = date.getDate(); >- var month = date.getMonth() + 1; >- var year = date.getFullYear(); >- var weekDay = date.getDay(); >- var dayMonth = month + '-' + day; >- var dateString = year + '-' + month + '-' + day; >- var dateTo = document.getElementById('to').value.split("-"); >- var limitDate = new Date(dateTo[0], (dateTo[1] - 1), dateTo[2]); >- if (date > limitDate) { >- return true; >- } else { >- return false; >- } >-} >-Calendar.setup( >- { >- inputField : "from", >- ifFormat : "[% DHTMLcalendar_dateformat %]", >- button : "openCalendarFrom", >- disableFunc : validate1, >- dateStatusFunc : validate1 >- } >-); >-</script></li> >-<li><label for="to" > >- End date: >-</label> >-<input size="10" id="to" name="to" value="[% to %]" type="text" /> >-<img src="[% themelang %]/lib/calendar/cal.gif" alt="" id="openCalendarTo" style="cursor: pointer;" border="0" /> >-<script type="text/javascript"> >- function validate2(date) { >- var day = date.getDate(); >- var month = date.getMonth() + 1; >- var year = date.getFullYear(); >- var weekDay = date.getDay(); >- var dayMonth = month + '-' + day; >- var dateString = year + '-' + month + '-' + day; >- var dateFrom = document.getElementById('from').value.split("-"); >- var limitDate = new Date(dateFrom[0], (dateFrom[1] - 1), dateFrom[2]); >- if (limitDate > date) { >- return true; >- } else { >- return false; >- } >- } >- >- Calendar.setup( >- { >- inputField : "to", >- ifFormat : "[% DHTMLcalendar_dateformat %]", >- button : "openCalendarTo", >- disableFunc : validate2, >- dateStatusFunc : validate2 >- } >- ); >-</script> >-(inclusive)</li></ol> >- >-<fieldset class="action"><input type="submit" value="Go" class="submit"/></fieldset></fieldset> >-</form> >-</div> >-</div> >-[% INCLUDE 'intranet-bottom.inc' %] >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 bdd735d..6602fed 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 >@@ -42,7 +42,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/billing.pl">Billing</a></li> --> > <!-- <li> <a href="/cgi-bin/koha/circ/stats.pl?time=yesterday">Daily reconciliation</a></li> --> > </ul> > >-- >1.7.5.4
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 2034
:
9009
|
9032