From f344e6b4ee6f430769a17b110720f91359e745f7 Mon Sep 17 00:00:00 2001 From: David Flater Date: Mon, 7 Jul 2025 15:17:54 +0000 Subject: [PATCH] Bug 32682: Implement reading history permission To test: 1. Create or modify a staff user with edit_borrowers permssion enabled ( Staff A ) 2. Create or modify a staff user without edit_borrowers permssion enabled ( Staff B ) 3. Ensure the "intranetreadinghistory" syspref is enabled 4. Check out an assortment of items to any patron 5. Apply patch, update_database, then restart_all 6. Check the permissions of the staff user A and ensure that they have been automatically assigned the new "view_checkout_history" permission 7. Check the permissions of the staff user B and ensure that they have NOT been automatically assigned the new "view_checkout_history" permission 8. View the same patron and ensure you can still see their checkout history as Staff A and as a superlibrarain 9. Disable the "intranetreadinghistory" syspref and remove the "view_checkout_history" permission of the staff user --- koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc | 10 ++++------ .../intranet-tmpl/prog/en/includes/members-toolbar.inc | 2 +- .../intranet-tmpl/prog/en/includes/permissions.inc | 3 +++ .../prog/en/modules/catalogue/issuehistory.tt | 2 +- .../prog/en/modules/members/readingrec.tt | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) 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 edb3b8bbfbc..ec41da18af2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -196,12 +196,10 @@ [% END %] [% END %] - [% IF CAN_user_borrowers_edit_borrowers %] - [% IF ( intranetreadinghistory ) %] -
  • - Circulation history -
  • - [% END %] + [% IF (CAN_user_borrowers_view_checkout_history && Koha.Preference('intranetreadinghistory')) %] +
  • + Circulation history +
  • [% END %] [% IF CAN_user_borrowers_edit_borrowers %] [% IF ( IntranetReadingHistoryHolds ) %] 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 62faf67702e..90bf4e99529 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -151,7 +151,7 @@ [% END %] [% END %] - [% IF Koha.Preference('intranetreadinghistory') %] + [% IF CAN_user_borrowers_view_checkout_history && Koha.Preference('intranetreadinghistory') %] [% IF ( patron.privacy == 2 ) %]
  • Export today's checked in barcodes diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index 8cb47687a64..e992cdc80c9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -320,6 +320,9 @@ [%- CASE 'edit_accountline_notes' -%] Edit accountline notes ([% name | html %]) + [%- CASE 'view_checkout_history' -%] + Viewing checkout history + ([% name | html %]) [%- CASE 'suggestions_manage' -%] Edit purchase suggestions ([% name | html %]) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt index 409f57721b0..0db4dc9c801 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt @@ -41,7 +41,7 @@

    Checkout history for [% INCLUDE 'biblio-title.inc' %]

    [% IF biblio.author %]

    by [% biblio.author | html %]

    [% END %] - [% SET show_patron_column = Koha.Preference('intranetreadinghistory') AND CAN_user_circulate_circulate_remaining_permissions %] + [% SET show_patron_column = (CAN_user_borrowers_view_checkout_history && Koha.Preference('intranetreadinghistory')) AND CAN_user_circulate_remaining_permissions %]
    [% IF checkouts %] 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 26c99e59f4b..70a9d9af786 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,7 @@ [% UNLESS checkouts %][% checkouts = [] %][% END %] [% UNLESS old_checkouts %][% old_checkouts = [] %][% END %] [% SET all_checkouts = checkouts.merge(old_checkouts) %] - [% UNLESS Koha.Preference('intranetreadinghistory') %] + [% UNLESS (CAN_user_borrowers_view_checkout_history && Koha.Preference('intranetreadinghistory')) %]
    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.
    -- 2.39.5