From 7c211dfe3f703d9f4f84a8650958c0044dde7d77 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 30 Sep 2021 08:56:36 +0200 Subject: [PATCH] Bug 29137: Add new syspref to disable AV creation within the cataloguing module "I don't like this patch at all!" "We will see a cataloger revolt if we do not find a way to make this optional for catalogers." I imagined a hord of catalogers running behind me and I got scared. This patch will allow to turn the new feature added by bug 25728 off. Test plan: Confirm that the new CreateAVFromCataloguing will permit to turn the feature off. Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit 4aaf9847c9c9e1a71345da6c691d30c9ba246f23) Signed-off-by: Fridolin Somers --- installer/data/mysql/atomicupdate/bug_29137.pl | 15 +++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../en/modules/admin/preferences/cataloguing.pref | 7 +++++++ .../prog/en/modules/authorities/authorities.tt | 6 +++++- .../prog/en/modules/cataloguing/addbiblio.tt | 6 +++++- .../prog/en/modules/cataloguing/additem.tt | 6 +++++- koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 2 +- 7 files changed, 39 insertions(+), 4 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_29137.pl diff --git a/installer/data/mysql/atomicupdate/bug_29137.pl b/installer/data/mysql/atomicupdate/bug_29137.pl new file mode 100755 index 0000000000..f56e5fdc8e --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_29137.pl @@ -0,0 +1,15 @@ +use Modern::Perl; + +return { + bug_number => "29137", + description => "Add system preference CreateAVFromCataloguing", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do( q{ + INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) + VALUES ('CreateAVFromCataloguing', '1', '', 'Ability to create authorized values from the cataloguing module', 'YesNo') + }); + }, +} diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index c9832fd5c5..8d86f2d47a 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -139,6 +139,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('CollapseFieldsPatronAddForm','',NULL,'Collapse these fields by default when adding a new patron. These fields can still be expanded.','Multiple'), ('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'), ('ConsiderOnSiteCheckoutsAsNormalCheckouts','1',NULL,'Consider on-site checkouts as normal checkouts','YesNo'), +('CreateAVFromCataloguing', '1', '', 'Ability to create authorized values from the cataloguing module', 'YesNo'), ('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'), ('CumulativeRestrictionPeriods',0,NULL,'Cumulate the restriction periods instead of keeping the highest','YesNo'), ('CurrencyFormat','US','US|FR|CH','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\' in \'FR\' or \'360,000.00\' in \'US\'.','Choice'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index 254ddd9474..03b6976d4a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -27,6 +27,13 @@ Cataloging: - the advanced cataloging editor. - "
NOTE:" - Currently does not include support for UNIMARC or NORMARC fixed fields. + - + - pref: CreateAVFromCataloguing + default: 1 + choices: + 1: "Allow" + 0: "Don't allow" + - authorized values to be created within the cataloguing module. Librarien will need the manage_auth_values subpermission. Spine labels: - - When using the quick spine label printer, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index 7a7be9c844..2b9b46f1b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -6,7 +6,11 @@ [% INCLUDE 'doc-head-close.inc' %] [% Asset.js("lib/hc-sticky.js") | $raw %] [% INCLUDE 'select2.inc' %] [% Asset.js("js/cataloging.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 3278a6a123..8792a594aa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -7,7 +7,11 @@ [% Asset.js("lib/hc-sticky.js") | $raw %] [% INCLUDE 'select2.inc' %] [% Asset.js("js/cataloging.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index 4e56b557b4..c68e28afed 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -9,7 +9,11 @@ [% Asset.css("css/addbiblio.css") | $raw %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'select2.inc' %] [% Asset.js("js/cataloging.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js index d390c8732f..7aa50983da 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js @@ -89,7 +89,7 @@ var Select2Utils = { initSelect2: function(selects) { if ($.fn.select2) { - if ( window.CAN_user_parameters_manage_auth_values === undefined || ! CAN_user_parameters_manage_auth_values ) { + if ( window.auth_values_creation === undefined || ! auth_values_creation ) { $(selects).select2().on("select2:clear", function () { $(this).on("select2:opening.cancelOpen", function (evt) { evt.preventDefault(); -- 2.39.5