From 5fd7a8094f53c8fa1e3a78d4bd4d883f02661c65 Mon Sep 17 00:00:00 2001 From: Nick Clemens <nick@bywatersolutions.com> Date: Wed, 19 Oct 2022 13:56:51 +0000 Subject: [PATCH] Bug 19361: Display unauthorized values when cataloging and add a warning This patch adds a warning and tool tip when an unauthorised vlaue is encountered during item or biblio editing, and adds the value to the list to allow preserving the value (in case the librarian is only editing another part of the record, or there is some reason to retain) To test: 1 - Edit a record in advanced cataloging editor 2 - Under settings click 'Show fields verbatim' 3 - Edit 942$c to 'HAM' or some other invalid itemtype 4 - Save record 5 - sudo koha-mysql kohadev UPDATE items SET location = 'HAM' WHERE biblionumber = {biblionumber from above} 6 - Edit the biblio and items, confirm the HAM value shows in dropdowns Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> --- .../intranet-tmpl/prog/en/includes/html_helpers.inc | 11 ++++++++++- .../prog/en/modules/cataloguing/addbiblio.tt | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index 786e644a5d..8353980000 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -109,8 +109,10 @@ <select name="[% kohafield | html %]" id="[%- mv.id | html -%]" class="input_marceditor select2 [% kohafield | html %]" data-category="[% mv.category | html %]" data-width="50%"> [% END %] + [% SET matched = 0 %] [% FOREACH aval IN mv.values %] [% IF aval == mv.default %] + [% SET matched = 1 %] <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option> [% ELSE %] [% IF subfield.IS_LOST_AV && Koha.Preference("ClaimReturnedLostValue") && aval == Koha.Preference("ClaimReturnedLostValue") %] @@ -122,7 +124,14 @@ [% END %] [% END %] [% END %] - </select> + [% UNLESS matched || ( ( kohafield == 'items.damaged' || kohafield == 'items.itemlost' || kohafield == 'items.withdrawn' || kohafield == 'items.notforloan' ) && mv.default == '0' ) %] + [%# If the current value is not in the authorised list and is not a field where 0 means unset #%] + <option value="[%- mv.default | html -%]" selected="selected">[%- mv.default | html -%]</option> + </select> + <span style="float:right;" title="The current value [% mv.default | html %] is not in the authorised value list"><i class="fa fa-exclamation-circle" aria-hidden="true"></i></span> + [% ELSE %] + </select> + [% END %] [% ELSIF ( mv.type == 'text_auth' ) %] [% IF mv.readonly %] <input type="text" id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %]" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" readonly="readonly" /> 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 8dd7e58409..d27ee41700 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -1149,14 +1149,25 @@ function PopupMARCFieldDoc(field) { [% ELSE %] <select name="[%- mv.name | html -%]" tabindex="1" class="input_marceditor select2" id="[%- mv.id | html -%]"> [% END %] + [% SET matched = 0 %] [% FOREACH aval IN mv.values %] [% IF aval == mv.default %] + [% SET matched = 1 %] <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option> [% ELSE %] <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option> [% END %] + [% END %] + [% UNLESS matched # If the current value is not in the authorised list %] + <option value="[%- mv.default | html -%]" selected="selected">[%- mv.default | html -%]</option> + </select> + <span style="float:right;" title="The current value [% mv.default | html %] is not in the authorised value list"><i class="fa fa-exclamation-circle" aria-hidden="true"></i></span> + [% ELSE %] </select> + [% END %] + [% UNLESS matched # If the current value is not in the authorised list %] + [% END %] [% END # /IF (mv.type...) %] </div> [% IF ( subfield_loo.mandatory ) %] -- 2.30.2