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 <andrew@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2021-09-30 08:56:36 +02:00 committed by Kyle Hall
parent 7d13ba8bfb
commit 4aaf9847c9
7 changed files with 40 additions and 4 deletions

View file

@ -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')
});
},
}

View file

@ -142,6 +142,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'), ('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'), ('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
('ConsiderOnSiteCheckoutsAsNormalCheckouts','1',NULL,'Consider on-site checkouts as normal checkouts','YesNo'), ('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'), ('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
('CumulativeRestrictionPeriods',0,NULL,'Cumulate the restriction periods instead of keeping the highest','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'), ('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'),

View file

@ -35,6 +35,14 @@ Cataloging:
controlnumber: "control number" controlnumber: "control number"
biblionumber: "bibliographic record number" biblionumber: "bibliographic record number"
- "in the file name." - "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: Spine labels:
- -
- When using the quick spine label printer, - When using the quick spine label printer,

View file

@ -6,7 +6,11 @@
[% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'doc-head-close.inc' %]
[% Asset.js("lib/hc-sticky.js") | $raw %] [% Asset.js("lib/hc-sticky.js") | $raw %]
<script> <script>
var CAN_user_parameters_manage_auth_values = "[% CAN_user_parameters_manage_auth_values | html %]"; [% IF Koha.Preference('CreateAVFromCataloguing') && CAN_user_parameters_manage_auth_values %]
var auth_values_creation = 1;
[% ELSE %]
var auth_values_creation = 0;
[% END %]
</script> </script>
[% INCLUDE 'select2.inc' %] [% INCLUDE 'select2.inc' %]
[% Asset.js("js/cataloging.js") | $raw %] [% Asset.js("js/cataloging.js") | $raw %]

View file

@ -7,7 +7,11 @@
[% Asset.js("lib/hc-sticky.js") | $raw %] [% Asset.js("lib/hc-sticky.js") | $raw %]
[% INCLUDE 'select2.inc' %] [% INCLUDE 'select2.inc' %]
<script> <script>
var CAN_user_parameters_manage_auth_values = "[% CAN_user_parameters_manage_auth_values | html %]"; [% IF Koha.Preference('CreateAVFromCataloguing') && CAN_user_parameters_manage_auth_values %]
var auth_values_creation = 1;
[% ELSE %]
var auth_values_creation = 0;
[% END %]
$.fn.select2.defaults.set("width", "100%" ); $.fn.select2.defaults.set("width", "100%" );
</script> </script>
[% Asset.js("js/cataloging.js") | $raw %] [% Asset.js("js/cataloging.js") | $raw %]

View file

@ -9,7 +9,11 @@
[% Asset.css("css/addbiblio.css") | $raw %] [% Asset.css("css/addbiblio.css") | $raw %]
[% INCLUDE 'datatables.inc' %] [% INCLUDE 'datatables.inc' %]
<script> <script>
var CAN_user_parameters_manage_auth_values = "[% CAN_user_parameters_manage_auth_values | html %]"; [% IF Koha.Preference('CreateAVFromCataloguing') && CAN_user_parameters_manage_auth_values %]
var auth_values_creation = 1;
[% ELSE %]
var auth_values_creation = 0;
[% END %]
</script> </script>
[% INCLUDE 'select2.inc' %] [% INCLUDE 'select2.inc' %]
[% Asset.js("js/cataloging.js") | $raw %] [% Asset.js("js/cataloging.js") | $raw %]

View file

@ -89,7 +89,7 @@ var Select2Utils = {
initSelect2: function(selects) { initSelect2: function(selects) {
if ($.fn.select2) { 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 () { $(selects).select2().on("select2:clear", function () {
$(this).on("select2:opening.cancelOpen", function (evt) { $(this).on("select2:opening.cancelOpen", function (evt) {
evt.preventDefault(); evt.preventDefault();