From fc4056c80293fddc68f439b472ecec8d3fc68f52 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 22 Nov 2022 14:05:08 +0000 Subject: [PATCH] Bug 32321: Pre-populate material type for 006 in advanced cataloging editor To test" 1 - Edit a record in advanced cataloging editor with field helpers enabled 2 - Choose a material type, not BKS, from dropdown 3 - Set the first position to something 4 - Save the record 5 - 006 shows 'BKS' 6 - Apply patch 7 - Reload 8 - Record should show correct value 9 - Edit 006 and confirm the first position correctly determines material type Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 7818717f3c69bcaf5953d6139f6a104dfb1c4ee7) Signed-off-by: Matt Blenkinsop (cherry picked from commit 8a28f6e2595997604e11355b49bffb5b90979113) Signed-off-by: Lucas Gass --- .../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 340c2a2487..a1d9d55263 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 @@ -208,6 +208,26 @@ require( [ 'koha-backend', 'widget', 'text-marc' ], function( KohaBackend, Widge return $result[0]; }, + materialTypeMapping: { + a: 'BKS', + c: 'MU', + d: 'MU', + e: 'MPS', + f: 'MPS', + g: 'VM', + i: 'MU', + j: 'MU', + k: 'VM', + m: 'CF', + o: 'VM', + p: 'MX', + r: 'VM', + s: 'CR', + t: 'BKS', + }, + getMaterial: function () { + return this.materialTypeMapping[this.text.substring(0, 1)]; + }, postCreate: function( node, mark ) { this.createFromXML( 'marc21/xml/006' ); } -- 2.39.5