From e67b6862f93394f3d4354510c5d060ff902d0129 Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Tue, 8 Oct 2013 09:34:42 +0200 Subject: [PATCH] Bug 11009: Do not display circulation history 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 useful 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 Signed-off-by: Owen Leonard This works as advertised and seems like a reasonable thing to do. I suspect that someone will object... Perhaps that person will implement a solution which uses an AJAX DataTable. Signed-off-by: Brendan Gallagher Signed-off-by: Galen Charlton (cherry picked from commit f2ad1faa63988b9dbf32cf8f8e35d59e7b584f2b) Signed-off-by: Fridolin SOMERS --- .../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 f36e254f90..47ed060685 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 0f0c3df4ec..2a57c42992 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} ) { -- 2.20.1