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>
(cherry picked from commit b01aa596ab)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
Jesse Weaver 2016-07-20 16:51:45 -06:00 committed by Frédéric Demians
parent 830242e905
commit 90dbfef329
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 );