From c0f887171044247c510b1d8f43a38acf15d5352e Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Tue, 8 Oct 2013 09:34:42 +0200 Subject: [PATCH 1/2] Bug 11009 - Do not allow reading records of anonymous patron When using an anonymous patron to anonymise issues history, this patron may have a huge number of old issues. In this case, trying to display the reading history of this patron will perform a huge SQL query. It is not usefull to have the reading history of this anonymous patron. This patch adds an alert instead of old issues when displaying reading records of anonymous patron. Test plan : - Set syspref AnonymousPatron to 0. - Select a borrower with old issues. For example 123. - Look at its reading records page : members/readingrec.pl => Old issues are displayed in a datatable - Set syspref AnonymousPatron with this borrower number. For example 123. - Look at its reading records page => Old issues are not displayed and an alert is displayed - Using SQL query, remove old issues of this borrower : DELETE FROM old_issues WHERE borrowernumber=123. - Look at its reading records page => A message is displayed --- koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt | 9 ++++++--- members/readingrec.pl | 8 +++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt index f36e254..47ed060 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -46,7 +46,12 @@
[% INCLUDE 'members-toolbar.inc' %]

Circulation history

-[% IF loop_reading %] + +[% IF is_anonymous %] +
This is the anonymous patron.
+[% ELSIF ( !loop_reading ) %] +
This patron has no circulation history.
+[% ELSE %]
@@ -101,8 +106,6 @@ [% END %] -[% ELSE %] -
This patron has no circulation history.
[% END %]
diff --git a/members/readingrec.pl b/members/readingrec.pl index d41e3f9..e50aa6a 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -63,7 +63,13 @@ if ($input->param('borrowernumber')) { my $order = 'date_due desc'; my $limit = 0; -my $issues = GetAllIssues($borrowernumber,$order,$limit); +my $issues = (); +# Do not request the old issues of anonymous patron +if ( $borrowernumber == C4::Context->preference('AnonymousPatron') ){ + $template->param( is_anonymous => 1 ); +} else { + $issues = GetAllIssues($borrowernumber,$order,$limit); +} my $branches = GetBranches(); foreach my $issue ( @{$issues} ) { -- 1.7.10.4