diff --git a/installer/data/mysql/atomicupdate/bug_37221.pl b/installer/data/mysql/atomicupdate/bug_37221.pl new file mode 100755 index 0000000000..37bd4a49bd --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_37221.pl @@ -0,0 +1,31 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); + +return { + bug_number => "37221", + description => "Add new system preference OPACOverDrive", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + my $count_sql = + q{SELECT count( value ) AS count FROM systempreferences WHERE variable IN ('OverDriveLibraryID', 'OverDriveClientKey', 'OverDriveClientSecret') AND value IS NOT NULL AND value != ''}; + my ($count) = $dbh->selectrow_array($count_sql); + my $enabled = + $count == 3 ? 1 : 0; # If all 3 preferences are enabled OverDrive content has been previously enabled + + my $sth = $dbh->prepare( + q{ + INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) + VALUES ('OPACOverDrive', ?, 'Enable OverDrive integration in the OPAC', '', 'YesNo') + } + ); + $sth->execute($enabled); + + if ($enabled) { + say_success( $out, "Added and enabled new system preference 'OPACOverDrive'" ); + } else { + say_success( $out, "Added new system preference 'OPACOverDrive'" ); + } + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 34ada9d837..7f5aad3553 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -526,6 +526,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACnumSearchResults','20',NULL,'Specify the maximum number of results to display on a page of results','Integer'), ('OPACnumSearchResultsDropdown', 0, NULL, 'Enable option list of number of results per page to show in OPAC search results','YesNo'), ('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'), +('OPACOverDrive','0',NULL,'Enable OverDrive integration in the OPAC','YesNo'), ('OpacPasswordChange','1',NULL,'If ON, enables patron-initiated password change in OPAC (disable it when using LDAP auth)','YesNo'), ('OPACPatronDetails','1','','If OFF the patron details tab in the OPAC is disabled.','YesNo'), ('OPACpatronimages','0',NULL,'Enable patron images in the OPAC','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref index e463f1657c..d9cde00fbe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref @@ -339,6 +339,12 @@ Enhanced content: 0: "Don't embed" - YouTube links as videos. OverDrive: + - + - pref: OPACOverDrive + choices: + 1: Enable + 0: "Don't enable" + - "OverDrive integration in the OPAC" - - Include OverDrive availability information with the client key - pref: OverDriveClientKey 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 46bc94ff14..a7f87af6d3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -29,6 +29,7 @@ [% SET OPACCustomCoverImages = ( Koha.Preference('OPACCustomCoverImages') && Koha.Preference('CustomCoverImagesURL') ) %] [% SET OverDriveEnabled = Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') %] [% END %] +[% SET OverDriveEnabled = ( Koha.Preference( "OPACOverDrive" ) && Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') ) %] [% INCLUDE 'doc-head-open.inc' %]
