From f8ecc6b7007f6d1dde499c4ea32f9f3fcfc718b7 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 --- installer/data/mysql/atomicupdate/bug_29137.pl | 15 +++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../en/modules/admin/preferences/cataloguing.pref | 8 ++++++++ .../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, 40 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 716f17a407..d797c074ae 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -145,6 +145,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 5ffd9a22f3..cde654c9fd 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 @@ -35,6 +35,14 @@ Cataloging: controlnumber: "control number" biblionumber: "bibliographic record number" - "in the file name." + - + - 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 40923f1726..56e38dbddc 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 7cc0a94afd..a31b2e0d1c 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 7a800079af..6f1eb7a13f 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 e037f6ff82..b50e9fac44 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js @@ -90,7 +90,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