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 402-408 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
402
        $( 'title', document.head ).html( _("Koha › Cataloging › ") + backend.titleForRecord.format( parts[1] ) );
402
        $( 'title', document.head ).html( _("Koha › Cataloging › ") + backend.titleForRecord.format( parts[1] ) );
403
    }
403
    }
404
404
405
    function saveRecord( recid, editor, callback ) {
405
    function saveRecord( recid, editor, callback, options ) {
406
        var parts = recid.split('/');
406
        var parts = recid.split('/');
407
        if ( parts.length != 2 ) return false;
407
        if ( parts.length != 2 ) return false;
408
408
Lines 417-423 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
417
            return;
417
            return;
418
        }
418
        }
419
419
420
        var errors = KohaBackend.ValidateRecord( '', record );
420
        var errors = KohaBackend.ValidateRecord( '', record, options );
421
        if ( errors.length ) {
421
        if ( errors.length ) {
422
            state.saving = false;
422
            state.saving = false;
423
            callback( { error: 'invalid', errors: errors } );
423
            callback( { error: 'invalid', errors: errors } );
Lines 451-457 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
451
            }
451
            }
452
452
453
            if (callback) callback( data );
453
            if (callback) callback( data );
454
        } );
454
        }, options );
455
    }
455
    }
456
456
457
    function loadRecord( recid, editor, callback ) {
457
    function loadRecord( recid, editor, callback ) {
Lines 1160-1165 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
1160
                }
1160
                }
1161
            }
1161
            }
1162
1162
1163
            var options = { override_warnings: $(this).is('#save-with-override') }
1164
1163
            $.each( enabledTargets, function() {
1165
            $.each( enabledTargets, function() {
1164
                saveRecord( this.id, editor, finishCb, options );
1166
                saveRecord( this.id, editor, finishCb, options );
1165
            } );
1167
            } );
1166
- 

Return to bug 18823