From ac7c0cd48dda4e431e9d2849cd23f06854e88f3a Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 6 Mar 2019 08:43:18 +0100 Subject: [PATCH] Bug 21049: Fix value of material select for Rancor 007 widget The material type is selected in accordance with position 0 of 007 Test plan: 1. Create a new record using the advanced editor 2. Select a material type for field 007 and set at least the position 0 of this field 3. Save the record and reload the page 4. The material type should remain selected 5. Try with all available material types Signed-off-by: Liz Rea Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens (cherry picked from commit e85294a738da7cce2a4897998ffa795f977b4cd7) Signed-off-by: Martin Renvoize (cherry picked from commit d5aa7655a643a5a4868a47b8aae5371438993580) Signed-off-by: Lucas Gass (cherry picked from commit b25c4196b8174b375d8c13ccb8dee145c5d784b6) Signed-off-by: Fridolin Somers --- .../en/includes/cateditor-widgets-marc21.inc | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc index d01c885f76..fa7de562c5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc @@ -163,6 +163,26 @@ require( [ 'koha-backend', 'widget', 'text-marc' ], function( KohaBackend, Widge return $result[0]; }, + materialTypeMapping: { + a: 'MPS', + c: 'ER', + d: 'GL', + f: 'TM', + g: 'PG', + h: 'MF', + k: 'NG', + m: 'MP', + o: 'KT', + q: 'NM', + r: 'RI', + s: 'SR', + t: 'TC', + v: 'VR', + z: 'UN' + }, + getMaterial: function () { + return this.materialTypeMapping[this.text.substring(0, 1)]; + }, postCreate: function( node, mark ) { this.createFromXML( 'marc21/xml/007' ); } -- 2.39.5