From 3ea6e78909112c4e636e6ad0bc7f593e60b9338a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Sat, 31 Oct 2015 21:24:44 +0100 Subject: [PATCH] Bug 15096: Export today's checked in barcodes: Display warning if reading history is set to "never" If a patron's privacy settings are set to "Never" for keeping a reading history, "Export today's checked in barcodes" returns an empty file. This patch does not allow to export in such case. To test: - Apply patch - Check out / check in in some items -Test toolbar: - On user's detail page, go to More->Export today's checked in barcodes - Verify that the menu item does not appear if syspref 'intranetreadinghistory' is set to 'Don't allow' - Verify that the menu item appears if syspref 'intranetreadinghistory' is set to allow and - that the menu item is grayed out with a tooltip if the user has set privacy settings to never keep a reading history - that the menu item works as before if user's privacy settings allow reading history. - Test left tab "Circulation history": - Verify that the left tab "Circulation history" does not appear if syspref 'intranetreadinghistory' is set to 'Don't allow' - Verify that the tab appars if syspref 'intranetreadinghistory' is set to 'Allow' and - that a message appears if user's privacy settings do not allow to keep the reading history - that the export works as before if user's privacy settings allow to keep the reading history (Amended and changed test plan for comment #9) Signed-off-by: Aleisha Signed-off-by: Kyle M Hall Signed-off-by: Brendan A Gallagher --- .../prog/en/includes/members-toolbar.inc | 10 ++++-- .../prog/en/modules/members/readingrec.tt | 2 ++ members/readingrec.pl | 34 +++++++++++-------- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index 475b155b08..9ecce1072f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -38,7 +38,7 @@ $(document).ready(function(){ $(".btn-group").removeClass("open"); });[% END %] [% END %] - $("#updatechild, #patronflags, #renewpatron, #deletepatron").tooltip(); + $("#updatechild, #patronflags, #renewpatron, #deletepatron, #exportbarcodes").tooltip(); $("#exportcheckins").click(function(){ export_barcodes(); $(".btn-group").removeClass("open"); @@ -199,7 +199,13 @@ function searchToHold(){ [% ELSE %]
  • Update child to adult patron
  • [% END %] -
  • Export today's checked in barcodes
  • + [% IF Koha.Preference('intranetreadinghistory') %] + [%IF ( privacy == 2 ) %] +
  • Export today's checked in barcodes
  • + [% ELSE %] +
  • Export today's checked in barcodes
  • + [% END %] + [% END %] 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 59b845dcff..0f3bbe9c31 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -53,6 +53,8 @@
    Staff members are not allowed to access patron's checkout history
    [% ELSIF is_anonymous %]
    This is the anonymous patron, so no circulation history is displayed. To get a list of anonymized loans, please run a report.
    +[% ELSIF ( privacy == 2) %] +
    This patron has set the privacy rules to never keeping a circulation history.
    [% ELSIF ( !loop_reading ) %]
    This patron has no circulation history.
    [% ELSE %] diff --git a/members/readingrec.pl b/members/readingrec.pl index f9bda6cde7..537e4aa459 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -75,21 +75,24 @@ my $branches = GetBranches(); # barcode export if ( $op eq 'export_barcodes' ) { - my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); - my @barcodes = - map { $_->{barcode} } grep { $_->{returndate} =~ m/^$today/o } @{$issues}; - my $borrowercardnumber = - GetMember( borrowernumber => $borrowernumber )->{'cardnumber'}; - my $delimiter = "\n"; - binmode( STDOUT, ":encoding(UTF-8)" ); - print $input->header( - -type => 'application/octet-stream', - -charset => 'utf-8', - -attachment => "$today-$borrowercardnumber-checkinexport.txt" - ); - my $content = join $delimiter, uniq(@barcodes); - print $content; - exit; + if ( $data->{'privacy'} < 2) { + my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); + my @barcodes = + map { $_->{barcode} } grep { $_->{returndate} =~ m/^$today/o } @{$issues}; + my $borrowercardnumber = + GetMember( borrowernumber => $borrowernumber )->{'cardnumber'}; + my $delimiter = "\n"; + binmode( STDOUT, ":encoding(UTF-8)" ); + print $input->header( + -type => 'application/octet-stream', + -charset => 'utf-8', + -attachment => "$today-$borrowercardnumber-checkinexport.txt" + ); + + my $content = join $delimiter, uniq(@barcodes); + print $content; + exit; + } } if ( $data->{'category_type'} eq 'C') { @@ -122,6 +125,7 @@ $template->param(%$data); $template->param( readingrecordview => 1, borrowernumber => $borrowernumber, + privacy => $data->{'privacy'}, categoryname => $data->{description}, is_child => ( $data->{category_type} eq 'C' ), branchname => $branches->{ $data->{branchcode} }->{branchname}, -- 2.39.5