Bug 15974: Rancor: Correctly select existing authorized value

Test plan:
  1) Open up a record in Rancor with an itemtype besides the first in
     the list ('BK' in the sample itemtypes).
  2) It will show "Book" instead of the correct itemtype.
  3) Apply patch, reload the page.
  4) The correct itemtype should now show.

NOTE: The scope is only 942$c. This corrects that.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jesse Weaver 2016-07-20 16:51:45 -06:00 committed by Kyle M Hall
parent d7754b70a2
commit b01aa596ab
1 changed files with 11 additions and 2 deletions

View File

@ -77,12 +77,21 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
return $result[0];
},
postCreate: function() {
this.setText( defaultvalue );
var value = defaultvalue;
var widget = this;
$.each( authvals, function() {
if ( this.value == widget.text ) {
value = this.value;
}
} );
this.setText( value );
$( '<select></select>' ).appendTo( this.node );
var $node = $( this.node ).find( 'select' );
$.each( authvals, function( undef, authval ) {
$node.append( '<option value="' + authval.value + '"' + (authval.value == defaultvalue ? ' selected="selected"' : '') + '>' + authval.lib + '</option>' );
$node.append( '<option value="' + authval.value + '"' + (authval.value == value ? ' selected="selected"' : '') + '>' + authval.lib + '</option>' );
} );
$node.val( this.text );