<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi Andrew,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I think that I’ve figured out how the editor works. The relevant code is at the bottom of my email.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>For new record, it looks like the advanced editor includes the tag if it’s marked as “mandatory” or if the “allTags” parameter is true. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I did a little test and marking 500 as “mandatory” made it appear in the editor (with this path /cgi-bin/koha/cataloguing/editor.pl#new/). However, you get an error “Incorrect syntax, cannot save” “Tag has no subfields” if you try to save the record without putting in any subfields for the 500 field. This is problematic since it’s normal for a template to have show optional fields, which act as prompts to the cataloguer. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Using this path (/cgi-bin/koha/cataloguing/editor.pl#new-full/), absolutely everything in the framework gets shown in the editor, and that’s no good either. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Really we should be using the “Editor” “visibility” instead of “mandatory” for this FillRecord function. Of course, that is defined at the subfield level, which makes the logic a bit trickier. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Moreover, if we change the behaviour now, users might be shocked to see their new record view change dramatically after upgrading Koha. Something to think about. I’ve opened <a href="https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26055">https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26055</a> to explore this further.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>--<o:p></o:p></p><p class=MsoNormal>./koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc<o:p></o:p></p><p class=MsoNormal>'new': {<o:p></o:p></p><p class=MsoNormal>            titleForRecord: _("Editing new record"),<o:p></o:p></p><p class=MsoNormal>            get: function( id, callback ) {<o:p></o:p></p><p class=MsoNormal>                record = new MARC.Record();<o:p></o:p></p><p class=MsoNormal>                KohaBackend.FillRecord( '', record );<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                callback( record );<o:p></o:p></p><p class=MsoNormal>            },<o:p></o:p></p><p class=MsoNormal>        },<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>"koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js"<o:p></o:p></p><p class=MsoNormal>FillRecord: function( frameworkcode, record, allTags ) {<o:p></o:p></p><p class=MsoNormal>            $.each( _frameworks[frameworkcode], function( undef, tag ) {<o:p></o:p></p><p class=MsoNormal>                var tagnum = tag[0], taginfo = tag[1];<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                if ( taginfo.mandatory != "1" && !allTags ) return;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                var fields = record.fields(tagnum);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                if ( fields.length == 0 ) {<o:p></o:p></p><p class=MsoNormal>                    var newField = new MARC.Field( tagnum, ' ', ' ', [] );<o:p></o:p></p><p class=MsoNormal>                    fields.push( newField );<o:p></o:p></p><p class=MsoNormal>                    record.addFieldGrouped( newField );<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                    if ( tagnum < '010' ) {<o:p></o:p></p><p class=MsoNormal>                        newField.addSubfield( [ '@', (taginfo.subfields[0] ? taginfo.subfields[0][1].defaultvalue : null ) || '' ] );<o:p></o:p></p><p class=MsoNormal>                        return;<o:p></o:p></p><p class=MsoNormal>                    }<o:p></o:p></p><p class=MsoNormal>                }<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                $.each( taginfo.subfields, function( undef, subfield ) {<o:p></o:p></p><p class=MsoNormal>                    var subfieldcode = subfield[0], subfieldinfo = subfield[1];<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                    if ( subfieldinfo.mandatory != "1" && !subfieldinfo.defaultvalue && !allTags ) return;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                    $.each( fields, function( undef, field ) {<o:p></o:p></p><p class=MsoNormal>                        if ( !field.hasSubfield(subfieldcode) ) {<o:p></o:p></p><p class=MsoNormal>                            field.addSubfieldGrouped( [ subfieldcode, subfieldinfo.defaultvalue || '' ] );<o:p></o:p></p><p class=MsoNormal>                        } else if ( subfieldinfo.defaultvalue && field.subfield( subfieldcode ) === '' ) {<o:p></o:p></p><p class=MsoNormal>                            field.subfield( subfieldcode, subfieldinfo.defaultvalue );<o:p></o:p></p><p class=MsoNormal>                        }<o:p></o:p></p><p class=MsoNormal>                    } );<o:p></o:p></p><p class=MsoNormal>                } );<o:p></o:p></p><p class=MsoNormal>            } );<o:p></o:p></p><p class=MsoNormal>        },<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>David Cook<o:p></o:p></p><p class=MsoNormal>Systems Librarian<o:p></o:p></p><p class=MsoNormal>Prosentient Systems<o:p></o:p></p><p class=MsoNormal>72/330 Wattle St<o:p></o:p></p><p class=MsoNormal>Ultimo, NSW 2007<o:p></o:p></p><p class=MsoNormal>Australia<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Office: 02 9212 0899<o:p></o:p></p><p class=MsoNormal>Online: 02 8005 0595<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> dcook@prosentient.com.au <dcook@prosentient.com.au> <br><b>Sent:</b> Friday, 24 July 2020 9:24 AM<br><b>To:</b> 'Andrew Fuerste-Henry' <andrew@bywatersolutions.com><br><b>Cc:</b> 'koha-devel' <koha-devel@lists.koha-community.org><br><b>Subject:</b> RE: [Koha-devel] Rancor/Advanced MARC Editor templates?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hi Andrew,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’m not sure as I haven’t investigated macros very closely. At a glance, it looks like they’re stored in the browser’s local storage ("koha-tmpl/intranet-tmpl/lib/koha/cateditor/preferences.js"), so there would be no way to push macros out to users. The cataloguers would have to set them up themselves. It might work for 1 library I have in mind, but it seems more like a workaround, and probably wouldn’t be suitable for many other libraries. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>But thanks for the suggestion. One of these days, I do need to examine the editor more closely. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>David Cook<o:p></o:p></p><p class=MsoNormal>Systems Librarian<o:p></o:p></p><p class=MsoNormal>Prosentient Systems<o:p></o:p></p><p class=MsoNormal>72/330 Wattle St<o:p></o:p></p><p class=MsoNormal>Ultimo, NSW 2007<o:p></o:p></p><p class=MsoNormal>Australia<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Office: 02 9212 0899<o:p></o:p></p><p class=MsoNormal>Online: 02 8005 0595<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Andrew Fuerste-Henry <<a href="mailto:andrew@bywatersolutions.com">andrew@bywatersolutions.com</a>> <br><b>Sent:</b> Thursday, 23 July 2020 11:56 PM<br><b>To:</b> <a href="mailto:dcook@prosentient.com.au">dcook@prosentient.com.au</a><br><b>Cc:</b> koha-devel <<a href="mailto:koha-devel@lists.koha-community.org">koha-devel@lists.koha-community.org</a>><br><b>Subject:</b> Re: [Koha-devel] Rancor/Advanced MARC Editor templates?<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Hi David,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Could macros do what you're looking for here? Create a macro for each type of record that inserts all of the blank fields you need for that type?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Andrew<o:p></o:p></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Wed, Jul 22, 2020 at 11:37 PM <<a href="mailto:dcook@prosentient.com.au">dcook@prosentient.com.au</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hi all,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Is it possible to define templates for Rancor/Advanced MARC Editor?<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>On systems like Horizon, it’s possible to have different templates, so cataloguers can at a glance see what fields they need to fill in for a particular type of record (e.g. book vs journal vs dvd). <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>If it’s not possible, I want to make it possible, but I’m not sure if we should use the “Editor” setting in MARC Bibliographic Frameworks, or create a new feature for providing Rancor Templates. <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Personally, I’ve always hated how MARC Bibliographic Frameworks act as both Editor templates (for rendering HTML) and data filters (ie if the field is not in the framework, it gets stripped out of the record at save time).<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>In my ideal world, editor templates and data filters would be 2 separate features. For Rancor, I think MARC Bibliographic Frameworks already act as data filters, and it would be backwards incompatible to use them for templates as well, so adding a new feature for Rancor templates is probably the logical conclusion?<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>David Cook<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Systems Librarian<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Prosentient Systems<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>72/330 Wattle St<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Ultimo, NSW 2007<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Australia<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Office: 02 9212 0899<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Online: 02 8005 0595<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div></div><p class=MsoNormal>_______________________________________________<br>Koha-devel mailing list<br><a href="mailto:Koha-devel@lists.koha-community.org" target="_blank">Koha-devel@lists.koha-community.org</a><br><a href="https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" target="_blank">https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>website : <a href="http://www.koha-community.org/" target="_blank">http://www.koha-community.org/</a><br>git : <a href="http://git.koha-community.org/" target="_blank">http://git.koha-community.org/</a><br>bugs : <a href="http://bugs.koha-community.org/" target="_blank">http://bugs.koha-community.org/</a><o:p></o:p></p></blockquote></div><p class=MsoNormal><br clear=all><o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>-- <o:p></o:p></p><div><div><div><div><div><div><div><div><div><div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#757575'>Andrew Fuerste-Henry</span><span style='font-size:9.5pt;color:#500050'><o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#757575'>Educator<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#757575'>(he/him/his)<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#757575'>ByWater Solutions<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#757575'><a href="http://bywatersolutions.com/" target="_blank"><span style='color:#7E57C2'>bywatersolutions.com</span></a><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#757575'>Phone:<a href="tel:(888)%20900-8944" target="_blank"><span style='color:#7E57C2'>(888)900-8944</span></a><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#757575'><img border=0 width=163 height=60 style='width:1.6979in;height:.625in' id="_x0000_i1025" src="https://drive.google.com/a/bywatersolutions.com/uc?id=1VVVFrey9XECr3VKtRsBrnaF0w5ESXYcA&export=download"></span><span style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#757575'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#757575'><a href="http://bywatersolutions.com/what-is-koha/" target="_blank"><span style='color:#7E57C2'>What is Koha?</span></a><o:p></o:p></span></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></body></html>