Bugzilla – Attachment 116114 Details for
Bug 17364
branchcode in BorrowerUnwantedField causes software error when saving patron record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17364: Add ability to exclude some columns from selection for system preferences
Bug-17364-Add-ability-to-exclude-some-columns-from.patch (text/plain), 5.26 KB, created by
Katrin Fischer
on 2021-01-31 14:27:29 UTC
(
hide
)
Description:
Bug 17364: Add ability to exclude some columns from selection for system preferences
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-01-31 14:27:29 UTC
Size:
5.26 KB
patch
obsolete
>From f11f49d6762ffd4745f8315d5e7c8e2b5f7495f9 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 6 Nov 2020 11:17:56 +0000 >Subject: [PATCH] Bug 17364: Add ability to exclude some columns from selection > for system preferences > >Bug 22844 Added the option to provide a modal for selecting database columns for system preferences > >Some system preferences are limited to a subset of the columns allowed. For instance, setting branchcode >in BorrowerUnwantedFields prevents adding new patrons > >This patch allows for defining exclusions in the .pref file > >To test: >1 - Alter BorroweUnwantedFields and select branchcode >2 - Attempt to add a new patron >3 - Get a message like "Something went wrong. Check the logs" >4 - Apply patches >5 - Alter the preference again >6 - Note that branchcode is unchecked and disabled >7 - Save the pref >8 - Add a patron >9 - It succeeds > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > admin/preferences.pl | 1 + > koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt | 2 +- > .../intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref | 1 + > koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js | 9 ++++++++- > 4 files changed, 11 insertions(+), 2 deletions(-) > >diff --git a/admin/preferences.pl b/admin/preferences.pl >index a39b6dd8f9..1353397b9b 100755 >--- a/admin/preferences.pl >+++ b/admin/preferences.pl >@@ -67,6 +67,7 @@ sub _get_chunk { > > if( $options{'type'} && $options{'type'} eq 'modalselect' ){ > $chunk->{'source'} = $options{'source'}; >+ $chunk->{'exclusions'} = $options{'exclusions'} // ""; > $chunk->{'type'} = 'modalselect'; > } > >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 54dfe5f951..d3d5e50203 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >@@ -112,7 +112,7 @@ > [% END %] > </select> > [% ELSIF ( CHUNK.type_modalselect ) %] >- <input type="text" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="modalselect preference preference-[% CHUNK.type | html %]" data-source="[% CHUNK.source | html %]" readonly="readonly" value="[% CHUNK.value | html %]"/> >+ <input type="text" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="modalselect preference preference-[% CHUNK.type | html %]" data-source="[% CHUNK.source | html %]" data-exclusions="[% CHUNK.exclusions %]" readonly="readonly" value="[% CHUNK.value | html %]"/> > [% ELSIF ( CHUNK.type_multiple ) %] > <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple"> > [% FOREACH CHOICE IN CHUNK.CHOICES %][% IF ( CHOICE.selected ) %]<option value="[% CHOICE.value | html %]" selected="selected">[% ELSE %]<option value="[% CHOICE.value | html %]">[% END %][% CHOICE.text | html %]</option>[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 1b3e386cc9..ab1935395f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -197,6 +197,7 @@ Patrons: > - pref: BorrowerUnwantedField > type: modalselect > source: borrowers >+ exclusions: branchcode > - > - "Borrowers can have the following titles:" > - pref: BorrowersTitles >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >index 2ff49b3f3b..b4d243cb2c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >@@ -225,6 +225,7 @@ $( document ).ready( function () { > > $(".modalselect").on("click", function(){ > var datasource = $(this).data("source"); >+ var exclusions = $(this).data("exclusions").split('|'); > var pref_name = this.id.replace(/pref_/, ''); > var pref_value = this.value; > var prefs = pref_value.split("|"); >@@ -238,7 +239,13 @@ $( document ).ready( function () { > } else { > checked = ""; > } >- items.push('<label><input class="dbcolumn_selection" type="checkbox" id="' + key + '"' + checked + ' name="pref" value="' + val + '" /> ' + key + '</label>'); >+ if( exclusions.indexOf( val ) >= 0 ){ >+ disabled = ' disabled="disabled" '; >+ checked = ""; >+ } else { >+ disabled = ""; >+ } >+ items.push('<label><input class="dbcolumn_selection" type="checkbox" id="' + key + '"' + checked + disabled + ' name="pref" value="' + val + '" /> ' + key + '</label>'); > }); > $("<div/>", { > "class": "columns-2", >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17364
:
113238
|
113239
|
114409
|
114470
|
114471
|
114472
|
114473
|
114475
| 116114 |
116115
|
116116