Bugzilla – Attachment 15778 Details for
Bug 9730
The sub 'AnonymiseIssueHistory' fails quietly if 'AnonymousPatron' is not a valid entry
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
0001-Bug-9730-AnonymiseIssueHistory-fails-quietly-if-Anon.patch (text/plain), 1.79 KB, created by
Christophe Croullebois
on 2013-02-28 16:10:16 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Christophe Croullebois
Created:
2013-02-28 16:10:16 UTC
Size:
1.79 KB
patch
obsolete
>From 353d8b9d2deb161acf3349be96e204e138dd5133 Mon Sep 17 00:00:00 2001 >From: Christophe Croullebois <christophe.croullebois@biblibre.com> >Date: Thu, 28 Feb 2013 16:15:07 +0100 >Subject: [PATCH 1/1] Bug 9730: AnonymiseIssueHistory fails quietly if > AnonymousPatron is not a valid entry > >it fails also if 'AnonymousPatron' = 0 >With the patch in this case the borrowernumber becomes NULL >--- > C4/Circulation.pm | 20 +++++++++++++------- > 1 file changed, 13 insertions(+), 7 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index f1c8662..32bf162 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2861,15 +2861,21 @@ sub AnonymiseIssueHistory { > my $dbh = C4::Context->dbh; > my $query = " > UPDATE old_issues >- SET borrowernumber = ? >- WHERE returndate < ? >- AND borrowernumber IS NOT NULL > "; > >- # The default of 0 does not work due to foreign key constraints >- # 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 there is no preference for 'AnonymousPatron' we update borrowernumber to NULL >+ my (@bind_params, $anonymouspatron); >+ if ($anonymouspatron = (C4::Context->preference('AnonymousPatron'))){ >+ $query .= " SET borrowernumber = ?"; >+ @bind_params = ($anonymouspatron, $date); >+ }else { >+ $query .= " SET borrowernumber = NULL"; >+ @bind_params = ($date); >+ } >+ >+ $query .= " WHERE returndate < ? >+ AND borrowernumber IS NOT NULL"; >+ > if (defined $borrowernumber) { > $query .= " AND borrowernumber = ?"; > push @bind_params, $borrowernumber; >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9730
: 15778 |
18864