From 695dc9f20f88673714b92576af654d402bb9977d Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 5 Mar 2014 11:45:08 -0500 Subject: [PATCH] Bug 9011 - Add support for StoreLastBorrower to AnonymiseIssueHistory --- C4/Circulation.pm | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 76f9313..03ba805 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2880,12 +2880,18 @@ sub AnonymiseIssueHistory { # The anonymisation will fail quietly if AnonymousPatron is not a valid entry my $anonymouspatron = (C4::Context->preference('AnonymousPatron')) ? C4::Context->preference('AnonymousPatron') : 0; my @bind_params = ($anonymouspatron, $date); + if (defined $borrowernumber) { $query .= " AND borrowernumber = ?"; push @bind_params, $borrowernumber; } else { $query .= " AND (SELECT privacy FROM borrowers WHERE borrowers.borrowernumber=old_issues.borrowernumber) <> 0"; } + + if ( C4::Context->preference('StoreLastBorrower') ) { + $query .= " AND issue_id IN ( SELECT issue_id FROM old_issues GROUP BY itemnumber ORDER BY issue_id DESC ) "; + } + my $sth = $dbh->prepare($query); $sth->execute(@bind_params); my $anonymisation_err = $dbh->err; -- 1.7.2.5