Lines 99-106
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
99 |
return $result[0]; |
99 |
return $result[0]; |
100 |
}, |
100 |
}, |
101 |
postCreate: function() { |
101 |
postCreate: function() { |
102 |
var value = defaultvalue; |
|
|
103 |
var widget = this; |
102 |
var widget = this; |
|
|
103 |
var value = widget.text || defaultvalue; |
104 |
|
104 |
|
105 |
$.each( authvals, function() { |
105 |
$.each( authvals, function() { |
106 |
if ( this.value == widget.text ) { |
106 |
if ( this.value == widget.text ) { |
Lines 112-120
require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
Link Here
|
112 |
|
112 |
|
113 |
$( '<select></select>' ).appendTo( this.node ); |
113 |
$( '<select></select>' ).appendTo( this.node ); |
114 |
var $node = $( this.node ).find( 'select' ); |
114 |
var $node = $( this.node ).find( 'select' ); |
|
|
115 |
var matched = false; |
115 |
$.each( authvals, function( undef, authval ) { |
116 |
$.each( authvals, function( undef, authval ) { |
116 |
$node.append( '<option value="' + authval.value + '"' + (authval.value == value ? ' selected="selected"' : '') + '>' + authval.lib + '</option>' ); |
117 |
selected = ''; |
|
|
118 |
if (authval.value == value){ |
119 |
matched=true; |
120 |
selected = ' selected="selected" '; |
121 |
}; |
122 |
$node.append( '<option value="' + authval.value + '"' + selected + '>' + authval.lib + '</option>' ); |
117 |
} ); |
123 |
} ); |
|
|
124 |
if( !matched ){ |
125 |
$node.append( '<option value="' + value + '" selected="selected">' + value + _(' (Not in authorised values list) ') + '</option>' ); |
126 |
} |
118 |
$node.val( this.text ); |
127 |
$node.val( this.text ); |
119 |
|
128 |
|
120 |
$node.change( $.proxy( function() { |
129 |
$node.change( $.proxy( function() { |
121 |
- |
|
|