[Koha-bugs] [Bug 26055] Advanced Editor Rancor should use "visibility" and not "mandatory" for drawing new records

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jul 24 01:54:42 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26055

--- Comment #2 from David Cook <dcook at prosentient.com.au> ---
Relevant code:

./koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc
'new': {
            titleForRecord: _("Editing new record"),
            get: function( id, callback ) {
                record = new MARC.Record();
                KohaBackend.FillRecord( '', record );

                callback( record );
            },
        },

"koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js"
FillRecord: function( frameworkcode, record, allTags ) {
            $.each( _frameworks[frameworkcode], function( undef, tag ) {
                var tagnum = tag[0], taginfo = tag[1];

                if ( taginfo.mandatory != "1" && !allTags ) return;

                var fields = record.fields(tagnum);

                if ( fields.length == 0 ) {
                    var newField = new MARC.Field( tagnum, ' ', ' ', [] );
                    fields.push( newField );
                    record.addFieldGrouped( newField );

                    if ( tagnum < '010' ) {
                        newField.addSubfield( [ '@', (taginfo.subfields[0] ?
taginfo.subfields[0][1].defaultvalue : null ) || '' ] );
                        return;
                    }
                }

                $.each( taginfo.subfields, function( undef, subfield ) {
                    var subfieldcode = subfield[0], subfieldinfo = subfield[1];

                    if ( subfieldinfo.mandatory != "1" &&
!subfieldinfo.defaultvalue && !allTags ) return;

                    $.each( fields, function( undef, field ) {
                        if ( !field.hasSubfield(subfieldcode) ) {
                            field.addSubfieldGrouped( [ subfieldcode,
subfieldinfo.defaultvalue || '' ] );
                        } else if ( subfieldinfo.defaultvalue &&
field.subfield( subfieldcode ) === '' ) {
                            field.subfield( subfieldcode,
subfieldinfo.defaultvalue );
                        }
                    } );
                } );
            } );
        },

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list