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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2022-10-19 13:56:51 +00:00 committed by Tomas Cohen Arazi
parent faf4ad9edf
commit 1dc022513c
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 21 additions and 1 deletions

View file

@ -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" />

View file

@ -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 ) %]