From c0bffc295c8e2a0bf5357f8302d14e5654d6f7bc Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 4 Apr 2006 13:13:47 +0000 Subject: [PATCH] * using a left join to avoid missing some lines. * fixing a bug when a parameter is empty. --- overdue.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/overdue.pl b/overdue.pl index f82387e17c..f04c445969 100755 --- a/overdue.pl +++ b/overdue.pl @@ -34,7 +34,7 @@ my $order=$input->param('order'); my $bornamefilter=$input->param('borname'); my $borcatfilter=$input->param('borcat'); my $itemtypefilter=$input->param('itemtype'); -my $borflagsfilter=$input->param('borflags'); +my $borflagsfilter=$input->param('borflags') || " "; my $branchfilter=$input->param('branch'); my $showall=$input->param('showall'); my $theme = $input->param('theme'); # only used if allowthemeoverride is set @@ -121,9 +121,13 @@ my $dbh = C4::Context->dbh; $bornamefilter =~s/\*/\%/g; $bornamefilter =~s/\?/\_/g; -my $strsth="select date_due,concat(firstname,' ',surname) as borrower, borrowers.phone, borrowers.emailaddress,issues.itemnumber, biblio.title, biblio.author from issues, borrowers,items,biblioitems, biblio where isnull(returndate) "; +my $strsth="select date_due,concat(surname,' ', firstname) as borrower, borrowers.phone, borrowers.emailaddress,issues.itemnumber, biblio.title, biblio.author from issues +LEFT JOIN borrowers ON issues.borrowernumber=borrowers.borrowernumber +LEFT JOIN items ON issues.itemnumber=items.itemnumber +LEFT JOIN biblioitems ON biblioitems.biblioitemnumber=items.biblioitemnumber +LEFT JOIN biblio ON biblio.biblionumber=items.biblionumber +where isnull(returndate) "; $strsth.= " && date_due<'".$todaysdate."' " unless ($showall); -$strsth.= " && issues.borrowernumber=borrowers.borrowernumber && issues.itemnumber=items.itemnumber && biblioitems.biblioitemnumber=items.biblioitemnumber && biblio.biblionumber=items.biblionumber "; $strsth.=" && (borrowers.firstname like '".$bornamefilter."%' or borrowers.surname like '".$bornamefilter."%' or borrowers.cardnumber like '".$bornamefilter."%')" if($bornamefilter) ; $strsth.=" && borrowers.categorycode = '".$borcatfilter."' " if($borcatfilter) ; $strsth.=" && biblioitems.itemtype = '".$itemtypefilter."' " if($itemtypefilter) ; -- 2.39.5