From c2e245e2da01b565c1b94c070bb9c4a19257779e 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 96c7b472a8..71eef78b3d 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1724,7 +1724,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){ @@ -1838,10 +1838,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; @@ -1854,7 +1857,8 @@ sub GetBorrowersWhoHaveNotBorrowedSince { } $query.=" GROUP BY borrowers.borrowernumber"; if ($filterdate){ - $query.=" HAVING latestissue