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

(-)a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js (-5 / +7 lines)
Lines 287-293 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
287
            } );
287
            } );
288
        },
288
        },
289
289
290
        ValidateRecord: function( frameworkcode, record ) {
290
        ValidateRecord: function( frameworkcode, record, options ) {
291
            options = options || {};
292
291
            var errors = [];
293
            var errors = [];
292
294
293
            var mandatoryTags = KohaBackend.GetTagsBy( record.frameworkcode, 'mandatory', '1' );
295
            var mandatoryTags = KohaBackend.GetTagsBy( record.frameworkcode, 'mandatory', '1' );
Lines 296-302 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
296
            var nonRepeatableSubfields = KohaBackend.GetSubfieldsBy( record.frameworkcode, 'repeatable', '0' );
298
            var nonRepeatableSubfields = KohaBackend.GetSubfieldsBy( record.frameworkcode, 'repeatable', '0' );
297
299
298
            $.each( mandatoryTags, function( tag ) {
300
            $.each( mandatoryTags, function( tag ) {
299
                if ( !record.hasField( tag ) ) errors.push( { type: 'missingTag', tag: tag } );
301
                if ( !record.hasField( tag ) && !options.override_warnings ) errors.push( { type: 'missingTag', tag: tag } );
300
            } );
302
            } );
301
303
302
            var seenTags = {};
304
            var seenTags = {};
Lines 309-315 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
309
                }
311
                }
310
312
311
                if ( seenTags[ field.tagnumber() ] && nonRepeatableTags[ field.tagnumber() ] ) {
313
                if ( seenTags[ field.tagnumber() ] && nonRepeatableTags[ field.tagnumber() ] ) {
312
                    errors.push( { type: 'unrepeatableTag', line: field.sourceLine, tag: field.tagnumber() } );
314
                    if ( !options.override_warnings ) errors.push( { type: 'unrepeatableTag', line: field.sourceLine, tag: field.tagnumber() } );
313
                    return;
315
                    return;
314
                }
316
                }
315
317
Lines 319-325 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
319
321
320
                $.each( field.subfields(), function( undef, subfield ) {
322
                $.each( field.subfields(), function( undef, subfield ) {
321
                    if ( seenSubfields[ subfield[0] ] != null && ( nonRepeatableSubfields[ field.tagnumber() ] || {} )[ subfield[0] ] ) {
323
                    if ( seenSubfields[ subfield[0] ] != null && ( nonRepeatableSubfields[ field.tagnumber() ] || {} )[ subfield[0] ] ) {
322
                        errors.push( { type: 'unrepeatableSubfield', subfield: subfield[0], line: field.sourceLine } );
324
                        if ( !options.override_warnings ) errors.push( { type: 'unrepeatableSubfield', subfield: subfield[0], line: field.sourceLine } );
323
                    } else {
325
                    } else {
324
                        seenSubfields[ subfield[0] ] = subfield[1];
326
                        seenSubfields[ subfield[0] ] = subfield[1];
325
                    }
327
                    }
Lines 327-333 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
327
329
328
                $.each( mandatorySubfields[ field.tagnumber() ] || {}, function( subfield ) {
330
                $.each( mandatorySubfields[ field.tagnumber() ] || {}, function( subfield ) {
329
                    if ( !seenSubfields[ subfield ] ) {
331
                    if ( !seenSubfields[ subfield ] ) {
330
                        errors.push( { type: 'missingSubfield', subfield: subfield[0], line: field.sourceLine } );
332
                        if ( !options.override_warnings ) errors.push( { type: 'missingSubfield', subfield: subfield[0], line: field.sourceLine } );
331
                    }
333
                    }
332
                } );
334
                } );
333
            } );
335
            } );
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc (-4 / +5 lines)
Lines 424-430 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
424
        $( 'title', document.head ).html( _("Koha › Cataloging › ") + backend.titleForRecord.format( parts[1] ) );
424
        $( 'title', document.head ).html( _("Koha › Cataloging › ") + backend.titleForRecord.format( parts[1] ) );
425
    }
425
    }
426
426
427
    function saveRecord( recid, editor, callback ) {
427
    function saveRecord( recid, editor, callback, options ) {
428
        var parts = recid.split('/');
428
        var parts = recid.split('/');
429
        if ( parts.length != 2 ) return false;
429
        if ( parts.length != 2 ) return false;
430
430
Lines 439-445 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
439
            return;
439
            return;
440
        }
440
        }
441
441
442
        var errors = KohaBackend.ValidateRecord( '', record );
442
        var errors = KohaBackend.ValidateRecord( '', record, options );
443
        if ( errors.length ) {
443
        if ( errors.length ) {
444
            state.saving = false;
444
            state.saving = false;
445
            callback( { error: 'invalid', errors: errors } );
445
            callback( { error: 'invalid', errors: errors } );
Lines 473-479 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
473
            }
473
            }
474
474
475
            if (callback) callback( data );
475
            if (callback) callback( data );
476
        } );
476
        }, options );
477
    }
477
    }
478
478
479
    function loadRecord( recid, editor, callback ) {
479
    function loadRecord( recid, editor, callback ) {
Lines 1182-1187 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
1182
                }
1182
                }
1183
            }
1183
            }
1184
1184
1185
            var options = { override_warnings: $(this).is('#save-with-override') }
1186
1185
            $.each( enabledTargets, function() {
1187
            $.each( enabledTargets, function() {
1186
                saveRecord( this.id, editor, finishCb, options );
1188
                saveRecord( this.id, editor, finishCb, options );
1187
            } );
1189
            } );
1188
- 

Return to bug 18823