From 28079b6488446f552c657adcf6d51b06c2cff850 Mon Sep 17 00:00:00 2001 From: Zoe Bennett Date: Tue, 16 Jan 2018 23:04:20 +0000 Subject: [PATCH] Bug 17765: Hid 'Holds' link on the 'Details' and 'Checkout' pages when the user does not have the permission to 'reserveforothers'. Test Plan: 1) With a user who has the permission to 'reserveforothers' check that the 'Holds' link is on the 'Details' and 'Check out' pages 2) Then with a user who does not have the permission to 'reserveforothers' check that on the 'Details' and 'Check out' pages there is no longer the 'Holds' link next to the 'Checkouts' and 'Fines & Charges' tabs. --- circ/circulation.pl | 4 ++++ .../prog/en/modules/circ/circulation.tt | 6 ++++-- .../prog/en/modules/members/moremember.tt | 24 +++++++++++++--------- members/moremember.pl | 5 +++++ 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 5dc5d89..4438dfb 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -176,6 +176,10 @@ my $print = $query->param('print') || q{}; my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice my $charges = $query->param('charges') || q{}; +my $flags = C4::Auth::getuserflags($patron->flags, $patron->userid); +if (ref $flags->{reserveforothers} && $flags->{reserveforothers}){ + $template->param( has_reserveforothers_permission => 1 )} + # Check if stickyduedate is turned off if ( @$barcodes ) { # was stickyduedate loaded from session? diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 842e479..937efb0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -934,7 +934,7 @@ No patron matched [% message | html %] [% IF relatives_issues_count %]
  • Relatives' checkouts
  • [% END %] - + [% IF has_reserveforothers_permission %]
  • [% IF ( holds_count ) %] [% holds_count %] Hold(s) @@ -942,6 +942,7 @@ No patron matched [% message | html %] 0 Holds [% END %]
  • + [% END %] [% IF Koha.Preference('ArticleRequests') %]
  • @@ -998,6 +999,7 @@ No patron matched [% message | html %] [% INCLUDE borrower_debarments.inc %] +[% IF has_reserveforothers_permission %]
    [% IF ( holds_count ) %]
    @@ -1052,7 +1054,7 @@ No patron matched [% message | html %]

    Patron has nothing on hold.

    [% END %]
    - +[% END %] [% IF Koha.Preference('ArticleRequests') %] [% INCLUDE 'patron-article-requests.inc' %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 180d941..6a1dfb0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -65,7 +65,7 @@ $(document).ready(function() { $('#'+ui.newTab.context.id).click(); } } ); - $("#holdst").dataTable($.extend(true, {}, dataTablesDefaults, { + $(CAN_user_reserveforothers("#holdst").dataTable($.extend(true, {}, dataTablesDefaults, { "sDom": 't', "aoColumnDefs": [ { "aTargets": [ -1,-2 ], "bSortable": false, "bSearchable": false } @@ -74,7 +74,7 @@ $(document).ready(function() { { "sType": "title-string" },{ "sType": "anti-the" },null,null,null,null,null,null ], "bPaginate": false - })); + }))); [% IF ( picture ) %] // new YAHOO.widget.Button("delpicture"); // FIXME: formatting mismatch between YUI and normal button $('#delpicture').click(function(){ @@ -446,7 +446,7 @@ function validate1(date) { [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
  • Check previous checkouts: [% IF ( checkprevcheckout == 'yes' ) %] - Yes + Yes [% ELSIF ( checkprevcheckout == 'no' ) %] No [% ELSE %] @@ -508,13 +508,15 @@ function validate1(date) {
  • Relatives' checkouts
  • [% END %]
  • Fines & Charges
  • + [% IF has_reserveforothers_permission %]
  • - [% IF ( holds_count ) %] - [% holds_count %] Hold(s) - [% ELSE %] - 0 Holds - [% END %] + [% IF ( holds_count ) %] + [% holds_count %] Hold(s) + [% ELSE %] + 0 Holds + [% END %]
  • + [% END %] [% IF Koha.Preference('ArticleRequests') %]
  • [% patron.article_requests_current.count %] Article requests @@ -574,6 +576,7 @@ function validate1(date) { [% INCLUDE borrower_debarments.inc %] +[% IF has_reserveforothers_permission %]
    [% IF ( holds_count ) %] @@ -620,12 +623,13 @@ function validate1(date) { - + [% END # IF SuspendHoldsIntranet %] [% ELSE %]

    Patron has nothing on hold.

    [% END %] -
    + +[% END %] [% IF Koha.Preference('ArticleRequests') %] diff --git a/members/moremember.pl b/members/moremember.pl index f79f2f8..56db5dd 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -167,6 +167,11 @@ if ( $patron->is_debarred ) { } } +my $flags = C4::Auth::getuserflags($patron->flags, $patron->userid); +if (ref $flags->{reserveforothers} && $flags->{reserveforothers}){ + $template->param( has_reserveforothers_permission => 1); +} + $data->{ "sex_".$data->{'sex'}."_p" } = 1 if defined $data->{sex}; if ( $category_type eq 'C') { -- 2.1.4