@@ -, +, @@ of this field --- .../lib/koha/cateditor/widget.js | 7 +++++++ .../en/includes/cateditor-widgets-marc21.inc | 20 +++++++++++++++++++ 2 files changed, 27 insertions(+) --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js +++ a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js @@ -121,6 +121,13 @@ define( [ 'resources' ], function( Resources ) { materialInfo[ $(this).attr('id') ] = this; } ); + if (widget.getMaterial) { + const material = widget.getMaterial(); + if (material) { + $matSelect.val(material); + } + } + $matSelect.change( function() { widget.loadXMLMaterial( materialInfo[ $matSelect.val() ] ); widget.nodeChanged(); --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc @@ -222,6 +222,26 @@ require( [ 'koha-backend', 'widget' ], function( KohaBackend, Widget ) { 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' ); } --