From 461cd346985b5e26669438469dcb917aa4ef3aff Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 5 Feb 2021 11:08:37 +0100 Subject: [PATCH] Bug 27634: Add the ability to exclude fields from "modal" sysprefs Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- admin/preferences.pl | 1 + .../intranet-tmpl/prog/en/modules/admin/preferences.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/admin/preferences.pl b/admin/preferences.pl index 8d6fd096cd..20a187e3f1 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -63,6 +63,7 @@ sub _get_chunk { if ( $options{'type'} eq 'modalselect' ) { $chunk->{'source'} = $options{'source'}; $chunk->{'exclusions'} = $options{'exclusions'} // ""; + $chunk->{'inclusions'} = $options{'inclusions'} // ""; $chunk->{'required'} = $options{'required'} // ""; $chunk->{'type'} = 'modalselect'; } elsif ( $options{'type'} eq 'modaljs' ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt index 3c9680195d..4c8f1cefc9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt @@ -134,7 +134,7 @@ [% END %] [% ELSIF ( CHUNK.type_modalselect ) %] - + [% ELSIF ( CHUNK.type_modaljs ) %] [% ELSIF ( CHUNK.type_multiple ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js index da5ffcc466..02bddb896c 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js @@ -281,6 +281,7 @@ $( document ).ready( function () { $(".modalselect").on("click", function(){ var datasource = $(this).data("source"); var exclusions = $(this).data("exclusions").split('|'); + var inclusions = $(this).data("inclusions").split('|'); var required = $(this).data("required").split('|'); var pref_name = this.id.replace(/pref_/, ''); var pref_value = this.value; @@ -305,10 +306,15 @@ $( document ).ready( function () { style = "disabled"; disabled = ' disabled="disabled" '; checked = ""; + } else if( inclusions.indexOf( key ) >= 0 ){ + style = "disabled"; + disabled = ' disabled="disabled" '; + checked = ' checked="checked" '; } else { style = ""; disabled = ""; } + items.push(''); }); $("
", { -- 2.39.5