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 (-3 / +5 lines)
Lines 386-392 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
386
        $( 'title', document.head ).html( _("Koha › Cataloging › ") + backend.titleForRecord.format( parts[1] ) );
386
        $( 'title', document.head ).html( _("Koha › Cataloging › ") + backend.titleForRecord.format( parts[1] ) );
387
    }
387
    }
388
388
389
    function saveRecord( recid, editor, callback ) {
389
    function saveRecord( recid, editor, callback, options ) {
390
        var parts = recid.split('/');
390
        var parts = recid.split('/');
391
        if ( parts.length != 2 ) return false;
391
        if ( parts.length != 2 ) return false;
392
392
Lines 401-407 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
401
            return;
401
            return;
402
        }
402
        }
403
403
404
        var errors = KohaBackend.ValidateRecord( '', record );
404
        var errors = KohaBackend.ValidateRecord( '', record, options );
405
        if ( errors.length ) {
405
        if ( errors.length ) {
406
            state.saving = false;
406
            state.saving = false;
407
            callback( { error: 'invalid', errors: errors } );
407
            callback( { error: 'invalid', errors: errors } );
Lines 434-440 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
434
            }
434
            }
435
435
436
            if (callback) callback( data );
436
            if (callback) callback( data );
437
        } );
437
        }, options );
438
    }
438
    }
439
439
440
    function loadRecord( recid, editor, callback ) {
440
    function loadRecord( recid, editor, callback ) {
Lines 1142-1147 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
1142
                }
1142
                }
1143
            }
1143
            }
1144
1144
1145
            var options = { override_warnings: $(this).is('#save-with-override') }
1146
1145
            $.each( enabledTargets, function() {
1147
            $.each( enabledTargets, function() {
1146
                saveRecord( this.id, editor, finishCb, options );
1148
                saveRecord( this.id, editor, finishCb, options );
1147
            } );
1149
            } );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt (-6 / +4 lines)
Lines 32-42 Link Here
32
    <div id="toolbar" class="btn-toolbar">
32
    <div id="toolbar" class="btn-toolbar">
33
        <button class="btn btn-default btn-sm" id="new-record" title="Open fresh record"><i class="fa fa-plus"></i> <span>New record</span></button>
33
        <button class="btn btn-default btn-sm" id="new-record" title="Open fresh record"><i class="fa fa-plus"></i> <span>New record</span></button>
34
        <div class="btn-group">
34
        <div class="btn-group">
35
            <button class="btn btn-default btn-sm" id="save-record" title="Save current record (Ctrl-S)"><i class="fa fa-hdd-o"></i> <span>Save</span></button>
35
            <button class="btn btn-small" id="save-record" title="Save current record (Ctrl-S)"><i class="fa fa-hdd-o"></i> <span>Save</span></button>
36
            <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
36
            <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
37
            <span class="caret"></span>
37
            <ul id="save-dropdown" class="dropdown-menu">
38
            </button>
38
                <li><a id="save-with-override" href="#">Save overriding warnings</a></li>
39
            <ul class="dropdown-menu" id="save-dropdown">
40
            </ul>
39
            </ul>
41
        </div>
40
        </div>
42
        <button class="btn btn-default btn-sm" id="import-records" title="Import an ISO2709 or MARCXML record"><i class="fa fa-download"></i> <span>Import record...</span></button>
41
        <button class="btn btn-default btn-sm" id="import-records" title="Import an ISO2709 or MARCXML record"><i class="fa fa-download"></i> <span>Import record...</span></button>
43
- 

Return to bug 18823