[Koha-patches] [PATCH] [SIGNED-OFF] Bug #6049 - Add a filter by date in overdue.pl
Christophe Croullebois
christophe.croullebois at biblibre.com
Wed Apr 6 10:20:59 CEST 2011
From: Alex Arnaud <alex.arnaud at biblibre.com>
Signed-off-by: Christophe Croullebois <christophe.croullebois at biblibre.com>
---
circ/overdue.pl | 12 ++++++-
.../prog/en/modules/circ/overdue.tmpl | 30 ++++++++++++++++++++
2 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/circ/overdue.pl b/circ/overdue.pl
index 3510a2b..94bd0f8 100755
--- a/circ/overdue.pl
+++ b/circ/overdue.pl
@@ -27,7 +27,7 @@ use CGI qw(-oldstyle_urls);
use C4::Auth;
use C4::Branch;
use C4::Debug;
-use C4::Dates qw/format_date/;
+use C4::Dates qw/format_date format_date_in_iso/;
use Date::Calc qw/Today/;
use Text::CSV_XS;
@@ -40,6 +40,8 @@ my $itemtypefilter = $input->param('itemtype') || '';
my $borflagsfilter = $input->param('borflag') || '';
my $branchfilter = $input->param('branch') || '';
my $op = $input->param('op') || '';
+my $dateduefrom = format_date_in_iso($input->param( 'dateduefrom' )) || '';
+my $datedueto = format_date_in_iso($input->param( 'datedueto' )) || '';
my $isfiltered = $op =~ /apply/i && $op =~ /filter/i;
my $noreport = C4::Context->preference('FilterBeforeOverdueReport') && ! $isfiltered && $op ne "csv";
@@ -209,7 +211,11 @@ $template->param(
patron_attr_filter_loop => \@patron_attr_filter_loop,
borname => $bornamefilter,
order => $order,
- showall => $showall);
+ showall => $showall,
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
+ dateduefrom => $input->param( 'dateduefrom' ) || '',
+ datedueto => $input->param( 'datedueto' ) || '',
+);
if ($noreport) {
# la de dah ... page comes up presto-quicko
@@ -254,6 +260,8 @@ if ($noreport) {
$strsth.=" AND biblioitems.itemtype = '" . $itemtypefilter . "' " if $itemtypefilter;
$strsth.=" AND borrowers.flags = '" . $borflagsfilter . "' " if $borflagsfilter;
$strsth.=" AND borrowers.branchcode = '" . $branchfilter . "' " if $branchfilter;
+ $strsth.=" AND date_due < '" . $datedueto . "' " if $datedueto;
+ $strsth.=" AND date_due > '" . $dateduefrom . "' " if $dateduefrom;
# restrict patrons (borrowers) to those matching the patron attribute filter(s), if any
my $bnlist = $have_pattr_filter_data ? join(',',keys %borrowernumber_to_attributes) : '';
$strsth =~ s/WHERE 1=1/WHERE 1=1 AND borrowers.borrowernumber IN ($bnlist)/ if $bnlist;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tmpl
index 9682fb1..c1f2053 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tmpl
@@ -69,6 +69,7 @@
<style type="text/css">
.sql {display:none;}
</style>
+<!-- TMPL_INCLUDE NAME="calendar.inc" -->
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->
@@ -137,6 +138,35 @@
<fieldset class="brief">
<h4>Filter On:</h4>
<ol>
+ <li style="border: dashed; border-width:1px;">Date due:
+ <label for="dateduefrom">From:
+ <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="dateduefrom_button" alt="Show Calendar" />
+ </label>
+ <input type="text" id="dateduefrom" name="dateduefrom" size="20" value="<!-- TMPL_VAR NAME="dateduefrom" -->" />
+ <script language="JavaScript" type="text/javascript">
+ Calendar.setup(
+ {
+ inputField : "dateduefrom",
+ ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+ button : "dateduefrom_button"
+ }
+ );
+ </script>
+
+ <label for="datedueto">To:
+ <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="datedueto_button" alt="Show Calendar" />
+ </label>
+ <input type="text" id="datedueto" name="datedueto" size="20" value="<!-- TMPL_VAR NAME="datedueto" -->" />
+ <script language="JavaScript" type="text/javascript">
+ Calendar.setup(
+ {
+ inputField : "datedueto",
+ ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+ button : "datedueto_button"
+ }
+ );
+ </script>
+ </li>
<li><label>Name or cardnumber:</label><input type="text" name="borname" value="<!--TMPL_VAR Name="borname" escape="html" -->" /></li>
<li><label>Patron category:</label><select name="borcat" id="borcat"><option value="">Any</option>
<!-- TMPL_LOOP name="borcatloop" -->
--
1.7.0.4
More information about the Koha-patches
mailing list