From 70485bf1cc6848b47797a4035be0689c598e456a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 4 Nov 2021 14:39:28 +0100 Subject: [PATCH] Bug 29180: Rename syspref RequestOnOpac with OPACHoldRequests It is a confusing name because we have 'Article Request' as a feature, and this does not follow Koha terminology. Test plan: `updatedatabase` and confirm that the syspref has been renamed `git grep RequestOnOpac` => No occurrence in the code QA: The syspref's value is always retrieved using Koha.Preference from .tt files, we don't need to send it from controllers or C4::Auth Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- C4/Auth.pm | 1 - C4/UsageStats.pm | 2 +- installer/data/mysql/atomicupdate/bug_29180.pl | 15 +++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 +- installer/data/mysql/update22to30.pl | 2 +- installer/html-template-to-template-toolkit.pl | 2 +- .../prog/en/modules/admin/preferences/opac.pref | 2 +- .../bootstrap/en/includes/opac-detail-sidebar.inc | 2 +- .../bootstrap/en/includes/title-actions-menu.inc | 4 ++-- .../opac-tmpl/bootstrap/en/modules/opac-basket.tt | 2 +- .../bootstrap/en/modules/opac-opensearch.tt | 2 +- .../bootstrap/en/modules/opac-results.tt | 10 +++++----- .../bootstrap/en/modules/opac-sendbasketform.tt | 2 +- .../bootstrap/en/modules/opac-sendshelfform.tt | 2 +- .../bootstrap/en/modules/opac-shelves.tt | 6 +++--- .../bootstrap/en/modules/opac-topissues.tt | 2 +- opac/opac-ISBDdetail.pl | 1 - opac/opac-MARCdetail.pl | 6 ------ opac/opac-detail.pl | 1 - opac/opac-reserve.pl | 4 ++-- 20 files changed, 38 insertions(+), 32 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_29180.pl diff --git a/C4/Auth.pm b/C4/Auth.pm index b531ab4a6a..8606e64bb8 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -597,7 +597,6 @@ sub get_template_and_user { OPACPrivacy => C4::Context->preference("OPACPrivacy"), OPACFinesTab => C4::Context->preference("OPACFinesTab"), OpacTopissue => C4::Context->preference("OpacTopissue"), - RequestOnOpac => C4::Context->preference("RequestOnOpac"), 'Version' => C4::Context->preference('Version'), hidelostitems => C4::Context->preference("hidelostitems"), mylibraryfirst => ( C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv ) ? C4::Context->userenv->{'branch'} : '', diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 2ff5303bcb..ef610b76bd 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -305,7 +305,7 @@ sub _shared_preferences { OpacTopissue opacuserlogin QuoteOfTheDay - RequestOnOpac + OPACHoldRequests OPACComments ShowReviewer ShowReviewerPhoto diff --git a/installer/data/mysql/atomicupdate/bug_29180.pl b/installer/data/mysql/atomicupdate/bug_29180.pl new file mode 100755 index 0000000000..82e7c3039c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_29180.pl @@ -0,0 +1,15 @@ +use Modern::Perl; + +return { + bug_number => "29180", + description => "Rename system preference RequestOnOpac with OPACHoldRequests", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + $dbh->do(q{ + UPDATE systempreferences + SET variable="OPACHoldRequests" + WHERE variable="RequestOnOpac" + }); + }, +} diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 9789af312e..fdc383b2b3 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -564,7 +564,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('RentalsInNoissuesCharge','1',NULL,'Rental charges block checkouts (added to noissuescharge).','YesNo'), ('ReplyToDefault','',NULL,'Use this email address as the replyto in emails','Free'), ('ReportsLog','0',NULL,'If ON, log information about reports.','YesNo'), -('RequestOnOpac','1',NULL,'If ON, globally enables patron holds on OPAC','YesNo'), +('OPACHoldRequests','1',NULL,'If ON, globally enables patron holds on OPAC','YesNo'), ('RequireStrongPassword','1','','Require a strong login password for staff and patrons','YesNo'), ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'), ('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'), diff --git a/installer/data/mysql/update22to30.pl b/installer/data/mysql/update22to30.pl index c5a183dae9..7592c9b626 100755 --- a/installer/data/mysql/update22to30.pl +++ b/installer/data/mysql/update22to30.pl @@ -414,7 +414,7 @@ my $DBversion = "3.00.00.000"; }, { uniquefieldrequired => 'variable', - variable => 'RequestOnOpac', + variable => 'OPACHoldRequests', value => '1', forceupdate => { 'explanation' => 1, 'type' => 1}, diff --git a/installer/html-template-to-template-toolkit.pl b/installer/html-template-to-template-toolkit.pl index c1ad8a4917..f76c87c904 100755 --- a/installer/html-template-to-template-toolkit.pl +++ b/installer/html-template-to-template-toolkit.pl @@ -27,7 +27,7 @@ my $tmpl_out_dir = 'koha-tt'; # template toolkit variables NOT to scope, in other words, variables that need to remain global (case sensitive) my @globals = ( "themelang","JacketImages","OPACAmazonCoverImages","GoogleJackets","BakerTaylorEnabled", "SyndeticsEnabled", "OpacRenewalAllowed", "item_level_itypes","noItemTypeImages", - "virtualshelves", "RequestOnOpac", "COinSinOPACResults", "OPACXSLTResultsDisplay", + "virtualshelves", "OPACHoldRequests", "COinSinOPACResults", "OPACXSLTResultsDisplay", "OPACItemsResultsDisplay", "LibraryThingForLibrariesID", "opacuserlogin", "TagsEnabled", "TagsShowOnList", "TagsInputOnList","loggedinusername","opacbookbag", "OPACAmazonEnabled", "SyndeticsCoverImages" ); 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 c3e793794c..253cec7a06 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 @@ -474,7 +474,7 @@ OPAC: 0: Hide - reviewer's avatar beside comments in OPAC. The avatar will be searched on Libravatar using the patron's e-mail address. - - - pref: RequestOnOpac + - pref: OPACHoldRequests choices: 1: Allow 0: "Don't allow" 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 a110d73a2a..09c4e49456 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 @@ -3,7 +3,7 @@
    [% UNLESS ( norequests ) %] [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] - [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %] + [% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %] [% IF ( ReservableItems ) %]
  • Place hold
  • [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc index 55ff553370..fb7312a17f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc @@ -1,5 +1,5 @@
    - [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %] + [% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %] [% UNLESS ( items.norequests ) %] [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] [% IF ( shelf AND op == 'view' ) # Lists view has more granular checking of hold availability %] @@ -15,7 +15,7 @@ [% END %] [% END # / IF opacuserlogin %] [% END # / UNLESS items.norequests %] - [% END # / RequestOnOpac %] + [% END # / OPACHoldRequests %] [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %] [% IF items.artreqpossible %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt index 3becf590f8..5c3e6beaa9 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -60,7 +60,7 @@ [% IF ( ( Koha.Preference( 'virtualshelves' ) == 1 ) && loggedinusername ) %] Add to a list [% END %] - [% IF ( Koha.Preference( 'RequestOnOpac' ) == 1 ) %] + [% IF ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) %] Place hold [% END %] [% IF ( TagsInputEnabled && loggedinusername ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt index 3d3ac81ed5..de69346dc4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt @@ -75,7 +75,7 @@ [% IF ( SEARCH_RESULT.size ) %] [% SEARCH_RESULT.size | html %]. [% END %] [% IF ( SEARCH_RESULT.isbn ) %] [% SEARCH_RESULT.isbn | html %][% END %]

    -[% IF Koha.Preference( 'RequestOnOpac' ) == 1 %] +[% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %]

    Place hold on [% SEARCH_RESULT.title | html %]

    [% END %] ]]> diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index c71015b2cd..28b4bdef6c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -272,7 +272,7 @@ [% END # /IF opacbookbag || virtualshelves %] - [% IF ( ( Koha.Preference( 'RequestOnOpac' ) == 1 ) && ( Koha.Preference( 'opacuserlogin' ) == 1 ) && DisplayMultiPlaceHold ) %] + [% IF ( ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) && ( Koha.Preference( 'opacuserlogin' ) == 1 ) && DisplayMultiPlaceHold ) %] @@ -318,12 +318,12 @@ [% IF Koha.Preference( 'virtualshelves' ) == 1 %] [% ELSE %] - [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %] + [% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %] [% UNLESS ( SEARCH_RESULT.norequests ) %] [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] [% END %] [% END %] - [% END # IF RequestOnOpac %] + [% END # IF OPACHoldRequests %] [% END # IF virtualshelves %] [% END # IF opacbookbag%] @@ -597,7 +597,7 @@ [% END %]