From bc6d38d258706189c38979501a780f12266430b9 Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Wed, 20 Jul 2016 16:51:45 -0600 Subject: [PATCH] Bug 15974: Rancor: Correctly select existing authorized value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit b01aa596abb91f8679c64e89197fbb2b3d9309cc) Signed-off-by: Frédéric Demians (cherry picked from commit 90dbfef3295130d62adf61b0e9d1dab44a4e0d4f) Signed-off-by: Julian Maurice --- .../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 2f2a1c23e6..0e4c279c66 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -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 ); $( '' ).appendTo( this.node ); var $node = $( this.node ).find( 'select' ); $.each( authvals, function( undef, authval ) { - $node.append( '' ); + $node.append( '' ); } ); $node.val( this.text ); -- 2.39.5