View | Details | Raw Unified | Return to bug 16251
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js (+7 lines)
Lines 121-126 define( [ 'resources' ], function( Resources ) { Link Here
121
                        materialInfo[ $(this).attr('id') ] = this;
121
                        materialInfo[ $(this).attr('id') ] = this;
122
                    } );
122
                    } );
123
123
124
                    if (widget.getMaterial) {
125
                        const material = widget.getMaterial();
126
                        if (material) {
127
                            $matSelect.val(material);
128
                        }
129
                    }
130
124
                    $matSelect.change( function() {
131
                    $matSelect.change( function() {
125
                        widget.loadXMLMaterial( materialInfo[ $matSelect.val() ] );
132
                        widget.loadXMLMaterial( materialInfo[ $matSelect.val() ] );
126
                        widget.nodeChanged();
133
                        widget.nodeChanged();
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc (-2 / +25 lines)
Lines 85-91 Link Here
85
 * single subfield, '@'.
85
 * single subfield, '@'.
86
 */
86
 */
87
87
88
require( [ 'koha-backend', 'widget' ], function( KohaBackend, Widget ) {
88
require( [ 'koha-backend', 'widget', 'text-marc' ], function( KohaBackend, Widget, TextMarc ) {
89
    Widget.Register( '000@', {
89
    Widget.Register( '000@', {
90
        makeTemplate: function() {
90
        makeTemplate: function() {
91
            return '     nam a22     7a 4500';
91
            return '     nam a22     7a 4500';
Lines 237-242 require( [ 'koha-backend', 'widget' ], function( KohaBackend, Widget ) { Link Here
237
237
238
            return $result[0];
238
            return $result[0];
239
        },
239
        },
240
        materialTypeMapping: {
241
            a: {
242
                a: 'BKS', c: 'BKS', d: 'BKS', m: 'BKS',
243
                b: 'CR', i: 'CR', s: 'CR',
244
            },
245
            t: 'BKS',
246
            c: 'MU', d: 'MU', i: 'MU', j: 'MU',
247
            e: 'MP', f: 'MP',
248
            g: 'VM', k: 'VM', o: 'VM', r: 'VM',
249
            m: 'CF',
250
            p: 'MX',
251
        },
252
        getMaterial: function () {
253
            const record = TextMarc.TextToRecord(this.editor.cm.getValue());
254
            const leader = record.leader();
255
            const leader6 = leader.substring(6, 7);
256
            let materialType = this.materialTypeMapping[leader6];
257
            if (typeof materialType === 'object') {
258
                const leader7 = leader.substring(7, 8);
259
                materialType = materialType[leader7];
260
            }
261
262
            return materialType;
263
        },
240
        postCreate: function( node, mark ) {
264
        postCreate: function( node, mark ) {
241
            this.createFromXML( 'marc21/xml/008' );
265
            this.createFromXML( 'marc21/xml/008' );
242
        }
266
        }
243
- 

Return to bug 16251