From 1b105a9b7c3e41b9530857775e480c8c6d4f20b1 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Tue, 29 Dec 2009 16:06:35 +0100 Subject: [PATCH] [followup](bug #3667) cleaning borrowers fix This fix GetBorrowersWhoHaveNotBorrowedSince to select only borrowers that have no issues and have no old_issues more recent than a specified date. --- C4/Members.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index f5a360e803..43305c5cbd 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1756,7 +1756,7 @@ Looks up the different title . Returns array with all borrowers title =cut sub GetTitles { - my @borrowerTitle = split /,|\|/,C4::Context->preference('BorrowersTitles'); + my @borrowerTitle = split (/,|\|/,C4::Context->preference('BorrowersTitles')); unshift( @borrowerTitle, "" ); my $count=@borrowerTitle; if ($count == 1){ @@ -1870,10 +1870,13 @@ sub GetBorrowersWhoHaveNotBorrowedSince { : ""); my $dbh = C4::Context->dbh; my $query = " - SELECT borrowers.borrowernumber,max(issues.timestamp) as latestissue + SELECT borrowers.borrowernumber, + max(old_issues.timestamp) as latestissue, + max(issues.timestamp) as currentissue FROM borrowers JOIN categories USING (categorycode) - LEFT JOIN issues ON borrowers.borrowernumber = issues.borrowernumber + LEFT JOIN old_issues USING (borrowernumber) + LEFT JOIN issues USING (borrowernumber) WHERE category_type <> 'S' "; my @query_params; @@ -1886,7 +1889,8 @@ sub GetBorrowersWhoHaveNotBorrowedSince { } $query.=" GROUP BY borrowers.borrowernumber"; if ($filterdate){ - $query.=" HAVING latestissue