Bug 19361: Fix advanced cataloging editor 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>
(cherry picked from commit fdc82e6c6d)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2022-10-19 14:37:34 +00:00 committed by Matt Blenkinsop
parent eac6eee593
commit 13b2ec0378
1 changed files with 11 additions and 2 deletions

View File

@ -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() {