# Copyright 2000-2002 Katipo Communications
+# Parts copyright 2010 BibLibre
#
# This file is part of Koha.
#
# 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., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# 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::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;
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";
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
$bornamefilter =~s/\?/\_/g;
my $strsth="SELECT date_due,
+ borrowers.title as borrowertitle,
concat(surname,' ', firstname) as borrower,
+ borrowers.streetnumber,
+ borrowers.streettype,
+ borrowers.address,
+ borrowers.address2,
+ borrowers.city,
+ borrowers.zipcode,
+ borrowers.country,
borrowers.phone,
borrowers.email,
issues.itemnumber,
$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;
borrowernumber => $data->{borrowernumber},
barcode => $data->{barcode},
itemnum => $data->{itemnumber},
+ borrowertitle => $data->{borrowertitle},
name => $data->{borrower},
+ streetnumber => $data->{streetnumber},
+ streettype => $data->{streettype},
+ address => $data->{address},
+ address2 => $data->{address2},
+ city => $data->{city},
+ zipcode => $data->{zipcode},
+ country => $data->{country},
phone => $data->{phone},
email => $data->{email},
biblionumber => $data->{biblionumber},