From ba3757751f66803866e781ae4c8c4f8dbdc94a9f Mon Sep 17 00:00:00 2001 From: Nick Clemens <nick@bywatersolutions.com> Date: Wed, 19 Oct 2022 14:37:34 +0000 Subject: [PATCH] Bug 19361: Fix advanced cataloging editor dropdowns --- .../intranet-tmpl/prog/en/includes/cateditor-ui.inc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc index 18cafecbb2..8f1ea839eb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -99,8 +99,8 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr return $result[0]; }, postCreate: function() { - var value = defaultvalue; var widget = this; + var value = widget.text || defaultvalue; $.each( authvals, function() { if ( this.value == widget.text ) { @@ -112,9 +112,18 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr $( '<select></select>' ).appendTo( this.node ); var $node = $( this.node ).find( 'select' ); + var matched = false; $.each( authvals, function( undef, authval ) { - $node.append( '<option value="' + authval.value + '"' + (authval.value == value ? ' selected="selected"' : '') + '>' + authval.lib + '</option>' ); + selected = ''; + if (authval.value == value){ + matched=true; + selected = ' selected="selected" '; + }; + $node.append( '<option value="' + authval.value + '"' + selected + '>' + authval.lib + '</option>' ); } ); + if( !matched ){ + $node.append( '<option value="' + value + '" selected="selected">' + value + _(' (Not in authorised values list) ') + '</option>' ); + } $node.val( this.text ); $node.change( $.proxy( function() { -- 2.30.2