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 245-251 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
245
            } );
245
            } );
246
        },
246
        },
247
247
248
        ValidateRecord: function( frameworkcode, record ) {
248
        ValidateRecord: function( frameworkcode, record, options ) {
249
            options = options || {};
250
249
            var errors = [];
251
            var errors = [];
250
252
251
            var mandatoryTags = KohaBackend.GetTagsBy( '', 'mandatory', '1' );
253
            var mandatoryTags = KohaBackend.GetTagsBy( '', 'mandatory', '1' );
Lines 254-260 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
254
            var nonRepeatableSubfields = KohaBackend.GetSubfieldsBy( '', 'repeatable', '0' );
256
            var nonRepeatableSubfields = KohaBackend.GetSubfieldsBy( '', 'repeatable', '0' );
255
257
256
            $.each( mandatoryTags, function( tag ) {
258
            $.each( mandatoryTags, function( tag ) {
257
                if ( !record.hasField( tag ) ) errors.push( { type: 'missingTag', tag: tag } );
259
                if ( !record.hasField( tag ) && !options.override_warnings ) errors.push( { type: 'missingTag', tag: tag } );
258
            } );
260
            } );
259
261
260
            var seenTags = {};
262
            var seenTags = {};
Lines 267-273 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
267
                }
269
                }
268
270
269
                if ( seenTags[ field.tagnumber() ] && nonRepeatableTags[ field.tagnumber() ] ) {
271
                if ( seenTags[ field.tagnumber() ] && nonRepeatableTags[ field.tagnumber() ] ) {
270
                    errors.push( { type: 'unrepeatableTag', line: field.sourceLine, tag: field.tagnumber() } );
272
                    if ( !options.override_warnings ) errors.push( { type: 'unrepeatableTag', line: field.sourceLine, tag: field.tagnumber() } );
271
                    return;
273
                    return;
272
                }
274
                }
273
275
Lines 277-283 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
277
279
278
                $.each( field.subfields(), function( undef, subfield ) {
280
                $.each( field.subfields(), function( undef, subfield ) {
279
                    if ( seenSubfields[ subfield[0] ] != null && ( nonRepeatableSubfields[ field.tagnumber() ] || {} )[ subfield[0] ] ) {
281
                    if ( seenSubfields[ subfield[0] ] != null && ( nonRepeatableSubfields[ field.tagnumber() ] || {} )[ subfield[0] ] ) {
280
                        errors.push( { type: 'unrepeatableSubfield', subfield: subfield[0], line: field.sourceLine } );
282
                        if ( !options.override_warnings ) errors.push( { type: 'unrepeatableSubfield', subfield: subfield[0], line: field.sourceLine } );
281
                    } else {
283
                    } else {
282
                        seenSubfields[ subfield[0] ] = subfield[1];
284
                        seenSubfields[ subfield[0] ] = subfield[1];
283
                    }
285
                    }
Lines 285-291 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
285
287
286
                $.each( mandatorySubfields[ field.tagnumber() ] || {}, function( subfield ) {
288
                $.each( mandatorySubfields[ field.tagnumber() ] || {}, function( subfield ) {
287
                    if ( !seenSubfields[ subfield ] ) {
289
                    if ( !seenSubfields[ subfield ] ) {
288
                        errors.push( { type: 'missingSubfield', subfield: subfield[0], line: field.sourceLine } );
290
                        if ( !options.override_warnings ) errors.push( { type: 'missingSubfield', subfield: subfield[0], line: field.sourceLine } );
289
                    }
291
                    }
290
                } );
292
                } );
291
            } );
293
            } );
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc (-4 / +5 lines)
Lines 395-401 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
395
        $( 'title', document.head ).html( _("Koha › Cataloging › ") + backend.titleForRecord.format( parts[1] ) );
395
        $( 'title', document.head ).html( _("Koha › Cataloging › ") + backend.titleForRecord.format( parts[1] ) );
396
    }
396
    }
397
397
398
    function saveRecord( recid, editor, callback ) {
398
    function saveRecord( recid, editor, callback, options ) {
399
        var parts = recid.split('/');
399
        var parts = recid.split('/');
400
        if ( parts.length != 2 ) return false;
400
        if ( parts.length != 2 ) return false;
401
401
Lines 410-416 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
410
            return;
410
            return;
411
        }
411
        }
412
412
413
        var errors = KohaBackend.ValidateRecord( '', record );
413
        var errors = KohaBackend.ValidateRecord( '', record, options );
414
        if ( errors.length ) {
414
        if ( errors.length ) {
415
            state.saving = false;
415
            state.saving = false;
416
            callback( { error: 'invalid', errors: errors } );
416
            callback( { error: 'invalid', errors: errors } );
Lines 443-449 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
443
            }
443
            }
444
444
445
            if (callback) callback( data );
445
            if (callback) callback( data );
446
        } );
446
        }, options );
447
    }
447
    }
448
448
449
    function loadRecord( recid, editor, callback ) {
449
    function loadRecord( recid, editor, callback ) {
Lines 1151-1156 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
1151
                }
1151
                }
1152
            }
1152
            }
1153
1153
1154
            var options = { override_warnings: $(this).is('#save-with-override') }
1155
1154
            $.each( enabledTargets, function() {
1156
            $.each( enabledTargets, function() {
1155
                saveRecord( this.id, editor, finishCb, options );
1157
                saveRecord( this.id, editor, finishCb, options );
1156
            } );
1158
            } );
1157
- 

Return to bug 18823