Bugzilla – Attachment 168231 Details for
Bug 30873
"Libraries" link on OPAC should be hideable by system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30873: Add system preference to hide libraries link in the OPAC
Bug-30873-Add-system-preference-to-hide-libraries-.patch (text/plain), 9.88 KB, created by
Owen Leonard
on 2024-06-28 11:04:41 UTC
(
hide
)
Description:
Bug 30873: Add system preference to hide libraries link in the OPAC
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2024-06-28 11:04:41 UTC
Size:
9.88 KB
patch
obsolete
>From 80d9966cd429c9f8048eae31fbaaa79d47a3ce5f Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 27 Jun 2024 18:26:34 +0000 >Subject: [PATCH] Bug 30873: Add system preference to hide libraries link in > the OPAC > >Some users would prefer that the libraries link not appear in the menu >of links under the OPAC's main search bar. This patch adds a preference >to do so. > >The preference defaults to "On" since "On" is the current default >behavior. > >To test, apply the patch and run the database update prcoess. > >- In the OPAC, confirm that by default the "Libraries" link appears. >- In the staff interface, go to Administration -> System preferences -> > OPACShowLibraries >- Set the preference to "Don't show" >- Return to the OPAC and confirm that the "Libraries" link isn't there. >- Try to navigate directly to /cgi-bin/koha/opac-library.pl. You should > be redirected to a 404 page. > >Sponsored-by: Athens County Public Libraries >--- > .../data/mysql/atomicupdate/bug_30873.pl | 18 +++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../en/modules/admin/preferences/opac.pref | 6 ++++++ > .../en/modules/labels/label-edit-batch.tt | 6 ++++-- > .../bootstrap/en/includes/masthead.inc | 20 ++++++++++--------- > labels/label-edit-batch.pl | 6 +----- > opac/opac-library.pl | 6 ++++++ > 7 files changed, 47 insertions(+), 16 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_30873.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_30873.pl b/installer/data/mysql/atomicupdate/bug_30873.pl >new file mode 100755 >index 0000000000..4e20eec083 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_30873.pl >@@ -0,0 +1,18 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "26205", >+ description => >+ "Add new system preference OPACShowLibraries to control whether the libraries link appears in the OPAC", >+ up => sub { >+ my ($args) = @_; >+ my $dbh = $args->{dbh}; >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) >+ VALUES ('OPACShowLibraries', '1', 'If enabled, a "Libraries" link appears in the OPAC pointing to a page with library information', '', 'YesNo') >+ } >+ ); >+ }, >+ } >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 0496d3fd48..a8a2f82bc9 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -544,6 +544,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OPACShibOnly','0','','If ON enables shibboleth only authentication for the opac','YesNo'), > ('OPACShowCheckoutName','0','','Displays in the OPAC the name of patron who has checked out the material. WARNING: Most sites should leave this off. It is intended for corporate or special sites which need to track who has the item.','YesNo'), > ('OPACShowHoldQueueDetails','none','none|priority|holds|holds_priority','Show holds details in OPAC','Choice'), >+('OPACShowLibraries', '1', 'If enabled, a link is shown in the OPAC pointing to a page with library information', '', 'YesNo'), > ('OPACShowMusicalInscripts','0','','Display musical inscripts on the OPAC record details page when available.','YesNo'), > ('OPACShowOpenURL', '0', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'), > ('OpacShowRecentComments','0',NULL,'If ON a link to recent comments will appear in the OPAC masthead','YesNo'), >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 8c2c30d7fd..00d257eb34 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 >@@ -42,6 +42,12 @@ OPAC: > 0: Disable > - "Koha OPAC as public. Private OPAC requires authentication before accessing the OPAC. " > - 'Note: This does not affect the public API, see the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RESTPublicAnonymousRequests">RESTPublicAnonymousRequests</a> to control the API.' >+ - >+ - pref: OPACShowLibraries >+ choices: >+ 1: "Show" >+ 0: "Don't show" >+ - "a link to a page in the OPAC showing information about each library. " > - > - "Show star-ratings on" > - pref: OpacStarRatings >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >index 73855dbef5..69a53808d3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >@@ -164,8 +164,9 @@ > <tr> > [% FOREACH text_field IN table_loo.text_fields %] > [% IF ( text_field.select_field ) %] >- <td> >- <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id |url %]&label_id=[% text_field.field_value |url %]"><i class="fa fa-trash-can"></i> Delete</a> >+ <td class="actions"> >+ <a class="btn btn-default btn-xs submit-form-link" id="deletebatch" href="#" data-op="cud-delete" data-batch_id="[% batch_id | html %]" data-label_id="[% text_field.field_value | html %]" data-method="post" data-action="/cgi-bin/koha/labels/label-edit-batch.pl" data-confirmation-msg="Are you sure you want to delete this?"><i class="fa fa-trash-can"></i> Delete</a> >+ > <a class="btn btn-default btn-xs export" href="#" data-batch-id="[% batch_id | html %]" data-label-id="[% text_field.field_value | html %]"><i class="fa-solid fa-share-from-square"></i> Export</a> > </td> > <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]"></td> >@@ -206,6 +207,7 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'greybox.inc' %] > [% INCLUDE 'datatables.inc' %] >+ [% Asset.js("js/form-submit.js") | $raw %] > <script> > function DeleteConfirm() { > var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]"); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 560b66dbe3..21780d429b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -364,15 +364,17 @@ > </li> > [% END %] > [% END %] >- <li class="nav-item"> >- <a id="library_page" href="/cgi-bin/koha/opac-library.pl"> >- [% IF ( singleBranchMode ) %] >- <span>Library</span> >- [% ELSE %] >- <span>Libraries</span> >- [% END %] >- </a> >- </li> >+ [% IF ( Koha.Preference('OPACShowLibraries') ) %] >+ <li class="nav-item"> >+ <a id="library_page" href="/cgi-bin/koha/opac-library.pl"> >+ [% IF ( singleBranchMode ) %] >+ <span>Library</span> >+ [% ELSE %] >+ <span>Libraries</span> >+ [% END %] >+ </a> >+ </li> >+ [% END %] > [% PROCESS koha_news_block news => OpacMoreSearches %] > </ul> <!-- /.nav#moresearches --> > </div> <!-- /.row --> >diff --git a/labels/label-edit-batch.pl b/labels/label-edit-batch.pl >index 23bd9e77d4..1a8759b49b 100755 >--- a/labels/label-edit-batch.pl >+++ b/labels/label-edit-batch.pl >@@ -67,7 +67,7 @@ $number_list = $cgi->param('number_list') if $cgi->param('number_list'); > > my $branch_code = C4::Context->userenv->{'branch'}; > >-if ($op eq 'remove') { >+if ($op eq 'cud-delete') { > $batch = C4::Labels::Batch->retrieve(batch_id => $batch_id); > foreach my $label_id (@label_ids) { > $err = $batch->remove_item($label_id); >@@ -77,10 +77,6 @@ if ($op eq 'remove') { > # print $cgi->redirect("label-edit-batch.pl?op=edit&batch_id=$batch_id"); > # exit; > } >-elsif ($op eq 'cud-delete') { >- $err = C4::Labels::Batch::delete(batch_id => $batch_id, branch_code => $branch_code); >- $errtype = 'BATCH_NOT_DELETED' if $err; >-} > elsif ($op eq 'cud-add') { > if ($number_list) { > my @numbers_list = split /\n/, $number_list; # Entries are effectively passed in as a <cr> separated list >diff --git a/opac/opac-library.pl b/opac/opac-library.pl >index 24611a1980..e4200f5741 100755 >--- a/opac/opac-library.pl >+++ b/opac/opac-library.pl >@@ -29,6 +29,12 @@ my $query = CGI->new(); > > my $branchcode = $query->param('branchcode'); > >+# if OPACShowLibraries is disabled, leave immediately >+if ( !C4::Context->preference('OPACShowLibraries') ) { >+ print $query->redirect("/cgi-bin/koha/errors/404.pl"); >+ exit; >+} >+ > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { > template_name => "opac-library.tt", >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30873
:
168210
|
168231
|
168233
|
168250
|
168351