From 60fe73b95d4dfff7d2d193d3466a4491c431f1fb Mon Sep 17 00:00:00 2001 From: Laura_Escamilla Date: Fri, 28 Jun 2024 17:28:17 +0000 Subject: [PATCH] Bug 37144 - Add a subpermission for hiding patron contact information --- .../data/mysql/mandatory/userpermissions.sql | 1 + .../intranet-tmpl/prog/en/includes/circ-menu.inc | 2 +- .../prog/en/includes/patron-search.inc | 4 +++- .../prog/en/includes/permissions.inc | 5 +++++ .../prog/en/includes/str/members-menu.inc | 1 + .../prog/en/includes/waiting_holds.inc | 2 ++ .../prog/en/modules/circ/circulation.tt | 1 + .../intranet-tmpl/prog/en/modules/circ/returns.tt | 10 ++++++++++ .../prog/en/modules/circ/view_holdsqueue.tt | 2 +- .../prog/en/modules/members/moremember-brief.tt | 1 + .../prog/en/modules/members/moremember.tt | 11 +++++++++++ koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 15 ++++++++------- 12 files changed, 45 insertions(+), 10 deletions(-) diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index 4b5c8ebe2c..3790de0abd 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -49,6 +49,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 4, 'list_borrowers', 'Search, list and view patrons'), ( 4, 'send_messages_to_borrowers', 'Send messages to patrons'), ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'), + ( 4, 'view_contact_information', 'View patron contact information'), ( 6, 'place_holds', 'Place holds for patrons'), ( 6, 'modify_holds_priority', 'Modify holds priority'), ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index b54aa71d6e..53dbd0b2a6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -62,7 +62,7 @@
  • ([% patron.pronouns | html %])
  • [% END %] - [% IF !(Koha.Preference('HidePersonalPatronDetailOnCirculation')) %] + [% IF !(Koha.Preference('HidePersonalPatronDetailOnCirculation')) && CAN_user_borrowers_view_contact_information %] [% PROCESS 'display-address-style' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc index c8dd64c124..3b8dbfbee4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -505,14 +505,16 @@ r += $patron_to_html(row, { invert_name: 1 }); [% END %] r += '
    '; + [% IF CAN_borrowers_view_contact_information %] r += '
    ' - + return r; } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index b8f2c2b040..3c059ffdb9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -321,6 +321,11 @@ View patron infos from any libraries. If not set the logged in user could only access patron infos from its own library or group of libraries. + ([% name | html %]) + [%- CASE 'view_contact_information' -%] + + View patron contact information. + ([% name | html %]) [%- CASE 'send_messages_to_borrowers' -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc index 530e9bfb89..dd76703c25 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc @@ -12,6 +12,7 @@ var CAN_user_borrowers_edit_borrowers = "[% CAN_user_borrowers_edit_borrowers | html %]"; var CAN_user_borrowers_delete_borrowers = "[% CAN_user_borrowers_delete_borrowers | html %]"; + var CAN_user_borrowers_view_contact_information = "[% CAN_user_borrowers_view_contact_information | html %]"; var dateformat = "[% Koha.Preference('dateformat') | html %]"; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc index f654f50c29..1967300ad7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc @@ -53,11 +53,13 @@
    Barcode: [% reserveloo.item.barcode | html %] [% INCLUDE 'patron-title.inc' patron=reserveloo.borrower invert_name=1 no_title=1 %] + [% IF CAN_user_borrowers_view_contact_information %] [% IF ( reserveloo.borrower.phone ) %]
    [% reserveloo.borrower.phone | html %][% END %] [% IF ( reserveloo.borrower.notice_email_address ) %]
    [% reserveloo.borrower.notice_email_address | html %]
    [% END %] + [% END %] [% Branches.GetName( reserveloo.item.homebranch ) | html %] [% Branches.GetName( reserveloo.item.holdingbranch ) | html %][% IF (reserveloo.desk_id ) %], [% reserveloo.desk.desk_name | html %][% END %] 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 c124dcb6cf..b383252763 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1012,6 +1012,7 @@ var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 | html %]; var AllowRenewalOnHoldOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalOnHoldOverride') )? 1: 0 | html %]; var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 | html %]; + var ViewContactInformation = [% (CAN_user_borrowers_view_contact_information)? 1 : 0 | html %]; var script = "circulation"; var relatives_borrowernumbers = new Array(); [% FOREACH b IN relatives_borrowernumbers %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 474a3e6473..fcf9c7194a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -81,6 +81,7 @@ - [% patron.category.description | html %] + [% IF CAN_user_view_contact_information %] [% INCLUDE display_holdpatron_address %] [% IF ( patron.phone ) %] @@ -96,6 +97,7 @@ [% END %] [% END %] + [% END %] [% UNLESS ( transfertodo) %] [% INCLUDE display_bormessagepref %] @@ -651,6 +653,7 @@ [% INCLUDE 'patron-title.inc' patron=patron hide_patron_infos_if_needed=1 invert_name=1 link_to="circulation_reserves" %] - [% patron.category.description | html %] + [% IF CAN_user_view_contact_information %] [% INCLUDE display_holdpatron_address %] [% IF ( patron.phone ) %]
  • [% patron.phone | html %]
  • @@ -659,6 +662,7 @@ [% IF ( patron.email ) %]
  • [% patron.email | html %]
  • [% END %] + [% END %] [% IF ( patron.is_debarred ) %]
  • Patron is RESTRICTED
  • @@ -832,6 +836,7 @@ - [% patron.category.description | html %] + [% IF CAN_user_view_contact_information %] [% INCLUDE display_holdpatron_address %] [% IF ( patron.phone ) %] @@ -847,6 +852,7 @@ [% END %] [% END %] + [% END %] [% UNLESS ( transfertodo) %] [% INCLUDE display_bormessagepref %] @@ -950,6 +956,7 @@ - [% recall.patron.category.description | html %] + [% IF CAN_user_view_contact_information %] [% INCLUDE display_holdpatron_address patron=recall.patron %] [% IF ( recall.patron.phone ) %] @@ -965,6 +972,7 @@ [% END %] [% END %] + [% END %] [% UNLESS ( transfertodo) %] [% INCLUDE display_bormessagepref %] @@ -1053,6 +1061,7 @@ - [% recall.patron.category.description | html %] + [% IF CAN_user_view_contact_information %] [% INCLUDE display_holdpatron_address patron=recall.patron %] [% IF ( recall.patron.phone ) %] @@ -1068,6 +1077,7 @@ [% END %] [% END %] + [% END %] [% UNLESS ( transfertodo) %] [% INCLUDE display_bormessagepref %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt index 49f2342125..7b49d4d143 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt @@ -209,7 +209,7 @@

    [% INCLUDE 'patron-title.inc' invert_name=1 patron=itemsloo.patron hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]

    - [% UNLESS Koha.Preference('HidePatronName') %] + [% UNLESS Koha.Preference('HidePatronName') || !CAN_user_borrowers_view_contact_information %]

    [% itemsloo.patron.phone | html %]

    [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt index 4c07cbf432..f388882cf5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt @@ -22,6 +22,7 @@
    + [% IF CAN_user_borrowers_view_contact_information %]
    [% IF ( patron.othernames ) %]“[% patron.othernames | html %]”[% 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 e00506ab50..4c05987ca9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -127,12 +127,15 @@ [% IF ( patron.othernames ) %]
    “[% patron.othernames | html %]”
    [% END %] + [% IF CAN_user_borrowers_view_contact_information %]
      [% PROCESS 'display-address-style' %]
    + [% END %] + [% IF CAN_user_borrowers_view_contact_information %]
      [% IF ( patron.phone ) %] @@ -272,6 +275,7 @@ [% END %]
    [% # /div.rows %] + [% END %]
    [% # /div#patron-information %] [% IF Koha.Preference('HouseboundModule') %] @@ -571,13 +575,16 @@ Edit [% END %]
    + [% IF CAN_user_borrowers_view_contact_information %]
      [% PROCESS 'display-alt-address-style' %]
    + [% END %]
      + [% IF CAN_user_borrowers_view_contact_information %] [% IF ( patron.B_phone ) %]
    1. Phone: @@ -598,6 +605,7 @@ [% patron.contactnote |html %]
    2. [% END %] + [% END %]
    [% ELSE %] @@ -620,6 +628,7 @@
      + [% IF CAN_user_borrowers_view_contact_information %] [% IF ( patron.altcontactsurname ) %]
    1. Surname: @@ -675,6 +684,7 @@ [% patron.altcontactphone | html %]
    2. [% END %] + [% END %]
    [% # /div.rows %] [% ELSE %] @@ -751,6 +761,7 @@ var branchcode = "[% Branches.GetLoggedInBranchcode() | html %]"; var exports_enabled = "[% Koha.Preference('ExportCircHistory') | html %]"; var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 | html %]; + var ViewContactInformation = [% (CAN_user_borrowers_view_contact_information)? 1 : 0 | html %]; var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 | html %]; var AllowRenewalOnHoldOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalOnHoldOverride') )? 1: 0 | html %]; var script = "moremember"; diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index ceaf8b8d57..6347aac1a3 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -672,6 +672,7 @@ function patron_autocomplete(node, options) { } else { loggedInClass = ""; } + return $("
  • ") .addClass(loggedInClass) .data("ui-autocomplete-item", item) @@ -695,12 +696,12 @@ function patron_autocomplete(node, options) { __("years") + ")
    ," : "") + - " " + - $format_address(item, { + " "+ + $format_address(item, { no_line_break: true, include_li: false, - }) + - " " + + }) + " " + (!singleBranchMode ? '' + item.library.name.escapeHtml() + @@ -708,10 +709,10 @@ function patron_autocomplete(node, options) { : "") + "" + "" - ) + ) .appendTo(ul); - }); -} + }); + } function expandPatronSearchFields(search_fields) { switch (search_fields) { -- 2.39.2