From c256f528094b20ca15c863dfecab5307b8bfa920 Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 20 Mar 2025 05:18:27 +0000 Subject: [PATCH] Bug 39372: Limit OPAC list creation This change adds a new system preference OpacAllowPrivateListCreation, which works with the existing system preference OpacAllowPublicListCreation, to determine when "New list", "Save to lists", "Add to list", "Save to another list", and "Add to a list" should appear. If both sysprefs are disabled, then you cannot do these actions. If one of the sysprefs is enabled, then these actions appear, but are limited to the private or public list type respective to the syspref. Test plan: 0. Apply the patch and koha-plack --restart kohadev 1. Perform the following steps using differing combinations of OpacAllowPrivateListCreation, or OpacAllowPublicListCreation, or both disabled 2. Click on Lists in masthead nav and note presence of "New list" link 3. Perform a search 4. Note the presence of "Save to lists" and "Add to list" links 5. Go to a record detail page 6. Note the presence of "Save to your lists" on the sidebar 7. Create a list 8. Go to the list 9. Note the presence of "Save to another list" and "New list" links 10. Add a record to the cart 11. Note the presence of "Add to a list" link Signed-off-by: Marion Durand --- .../en/modules/admin/preferences/opac.pref | 7 +++ .../bootstrap/en/includes/masthead.inc | 6 +- .../en/includes/opac-detail-sidebar.inc | 2 +- .../en/includes/result-batch-controls.inc | 8 ++- .../en/includes/title-actions-menu.inc | 2 +- .../en/modules/opac-addbybiblionumber.tt | 57 +++++++++++-------- .../bootstrap/en/modules/opac-basket.tt | 4 +- .../bootstrap/en/modules/opac-shelves.tt | 16 ++++-- 8 files changed, 63 insertions(+), 39 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index ec83b17a01..e48f695cef 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -651,6 +651,13 @@ OPAC: 0: "Don't hide" 1: Hide - "the bibliographic record when all its items are hidden by OpacHiddenItems." + - + - pref: OpacAllowPrivateListCreation + default: 1 + choices: + 0: "Don't allow" + 1: Allow + - "OPAC users to create private lists." - - pref: OpacAllowPublicListCreation default: 1 diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index 9eb4e7b5d1..5729d6b2b3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -98,8 +98,10 @@ [% ELSE %] No private lists [% END %] - New list - [% ELSE %] + [% IF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] + New list + [% END %] + [% ELSIF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] Log in to create your own lists [% END # / IF loggedinusername %] [% END # / IF opacuserlogin %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc index 03e74f148c..74f39e80c6 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc @@ -35,7 +35,7 @@ [% END %] [% IF Koha.Preference( 'virtualshelves' ) == 1 %] - [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername ) %] + [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername && ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) ) %]
  • Save to your lists
  • diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/result-batch-controls.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/result-batch-controls.inc index 1a9e80aa62..da58793675 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/result-batch-controls.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/result-batch-controls.inc @@ -29,9 +29,11 @@ [% IF ( ListsEnabled ) %]
    - + [% IF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] + + [% END %]