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 427-433 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
427
        $( 'title', document.head ).html( _("Koha › Cataloging › ") + backend.titleForRecord.format( parts[1] ) );
427
        $( 'title', document.head ).html( _("Koha › Cataloging › ") + backend.titleForRecord.format( parts[1] ) );
428
    }
428
    }
429
429
430
    function saveRecord( recid, editor, callback ) {
430
    function saveRecord( recid, editor, callback, options ) {
431
        var parts = recid.split('/');
431
        var parts = recid.split('/');
432
        if ( parts.length != 2 ) return false;
432
        if ( parts.length != 2 ) return false;
433
433
Lines 442-448 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
442
            return;
442
            return;
443
        }
443
        }
444
444
445
        var errors = KohaBackend.ValidateRecord( '', record );
445
        var errors = KohaBackend.ValidateRecord( '', record, options );
446
        if ( errors.length ) {
446
        if ( errors.length ) {
447
            state.saving = false;
447
            state.saving = false;
448
            callback( { error: 'invalid', errors: errors } );
448
            callback( { error: 'invalid', errors: errors } );
Lines 476-482 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
476
            }
476
            }
477
477
478
            if (callback) callback( data );
478
            if (callback) callback( data );
479
        } );
479
        }, options );
480
    }
480
    }
481
481
482
    function loadRecord( recid, editor, callback ) {
482
    function loadRecord( recid, editor, callback ) {
Lines 1185-1190 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
1185
                }
1185
                }
1186
            }
1186
            }
1187
1187
1188
            var options = { override_warnings: $(this).is('#save-with-override') }
1189
1188
            $.each( enabledTargets, function() {
1190
            $.each( enabledTargets, function() {
1189
                saveRecord( this.id, editor, finishCb, options );
1191
                saveRecord( this.id, editor, finishCb, options );
1190
            } );
1192
            } );
1191
- 

Return to bug 18823