<div dir="ltr">Hi David,<div><br></div><div>I put this on your bug as well, but Visibility for the regular editor is really determining whether or not a field is available at all. That's a pretty different question than whether or not you're offered a sort of stub/reminder tag on a blank record in Rancor. As you say, I think a lot of folks would find it quite disruptive to suddenly have everything marks as visible in editor suddenly show as a blank tag in a new Rancor record.</div><div><br></div><div>If you're poking around at marking tags and subfields mandatory in Rancor, you might want to be aware of bug 25962, subfields aren't enforced as mandatory unless the tag is also mandatory: <a href="https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25962">https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25962</a></div><div><br></div><div>Macros have been moved from the browser cache to the database proper in 20.05, so they would be sharable as templates: <a href="https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17268">https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17268</a></div><div><br></div><div>Thanks!</div><div>Andrew</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 23, 2020 at 6:52 PM <<a href="mailto:dcook@prosentient.com.au">dcook@prosentient.com.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-AU"><div class="gmail-m_3327634860788153974WordSection1"><p class="MsoNormal">Hi Andrew,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></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.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></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. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></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/<a href="http://editor.pl#new/" target="_blank">editor.pl#new/</a>). 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. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Using this path (/cgi-bin/koha/cataloguing/<a href="http://editor.pl#new-full/" target="_blank">editor.pl#new-full/</a>), absolutely everything in the framework gets shown in the editor, and that’s no good either. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></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. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></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" target="_blank">https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26055</a> to explore this further.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">--<u></u><u></u></p><p class="MsoNormal">./koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc<u></u><u></u></p><p class="MsoNormal">'new': {<u></u><u></u></p><p class="MsoNormal">            titleForRecord: _("Editing new record"),<u></u><u></u></p><p class="MsoNormal">            get: function( id, callback ) {<u></u><u></u></p><p class="MsoNormal">                record = new MARC.Record();<u></u><u></u></p><p class="MsoNormal">                KohaBackend.FillRecord( '', record );<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">                callback( record );<u></u><u></u></p><p class="MsoNormal">            },<u></u><u></u></p><p class="MsoNormal">        },<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">"koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js"<u></u><u></u></p><p class="MsoNormal">FillRecord: function( frameworkcode, record, allTags ) {<u></u><u></u></p><p class="MsoNormal">            $.each( _frameworks[frameworkcode], function( undef, tag ) {<u></u><u></u></p><p class="MsoNormal">                var tagnum = tag[0], taginfo = tag[1];<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">                if ( taginfo.mandatory != "1" && !allTags ) return;<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">                var fields = record.fields(tagnum);<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">                if ( fields.length == 0 ) {<u></u><u></u></p><p class="MsoNormal">                    var newField = new MARC.Field( tagnum, ' ', ' ', [] );<u></u><u></u></p><p class="MsoNormal">                    fields.push( newField );<u></u><u></u></p><p class="MsoNormal">                    record.addFieldGrouped( newField );<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">                    if ( tagnum < '010' ) {<u></u><u></u></p><p class="MsoNormal">                        newField.addSubfield( [ '@', (taginfo.subfields[0] ? taginfo.subfields[0][1].defaultvalue : null ) || '' ] );<u></u><u></u></p><p class="MsoNormal">                        return;<u></u><u></u></p><p class="MsoNormal">                    }<u></u><u></u></p><p class="MsoNormal">                }<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">                $.each( taginfo.subfields, function( undef, subfield ) {<u></u><u></u></p><p class="MsoNormal">                    var subfieldcode = subfield[0], subfieldinfo = subfield[1];<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">                    if ( subfieldinfo.mandatory != "1" && !subfieldinfo.defaultvalue && !allTags ) return;<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">                    $.each( fields, function( undef, field ) {<u></u><u></u></p><p class="MsoNormal">                        if ( !field.hasSubfield(subfieldcode) ) {<u></u><u></u></p><p class="MsoNormal">                            field.addSubfieldGrouped( [ subfieldcode, subfieldinfo.defaultvalue || '' ] );<u></u><u></u></p><p class="MsoNormal">                        } else if ( subfieldinfo.defaultvalue && field.subfield( subfieldcode ) === '' ) {<u></u><u></u></p><p class="MsoNormal">                            field.subfield( subfieldcode, subfieldinfo.defaultvalue );<u></u><u></u></p><p class="MsoNormal">                        }<u></u><u></u></p><p class="MsoNormal">                    } );<u></u><u></u></p><p class="MsoNormal">                } );<u></u><u></u></p><p class="MsoNormal">            } );<u></u><u></u></p><p class="MsoNormal">        },<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">David Cook<u></u><u></u></p><p class="MsoNormal">Systems Librarian<u></u><u></u></p><p class="MsoNormal">Prosentient Systems<u></u><u></u></p><p class="MsoNormal">72/330 Wattle St<u></u><u></u></p><p class="MsoNormal">Ultimo, NSW 2007<u></u><u></u></p><p class="MsoNormal">Australia<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Office: 02 9212 0899<u></u><u></u></p><p class="MsoNormal">Online: 02 8005 0595<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm"><p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> <a href="mailto:dcook@prosentient.com.au" target="_blank">dcook@prosentient.com.au</a> <<a href="mailto:dcook@prosentient.com.au" target="_blank">dcook@prosentient.com.au</a>> <br><b>Sent:</b> Friday, 24 July 2020 9:24 AM<br><b>To:</b> 'Andrew Fuerste-Henry' <<a href="mailto:andrew@bywatersolutions.com" target="_blank">andrew@bywatersolutions.com</a>><br><b>Cc:</b> 'koha-devel' <<a href="mailto:koha-devel@lists.koha-community.org" target="_blank">koha-devel@lists.koha-community.org</a>><br><b>Subject:</b> RE: [Koha-devel] Rancor/Advanced MARC Editor templates?<u></u><u></u></span></p></div></div><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Hi Andrew,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></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. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">But thanks for the suggestion. One of these days, I do need to examine the editor more closely. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">David Cook<u></u><u></u></p><p class="MsoNormal">Systems Librarian<u></u><u></u></p><p class="MsoNormal">Prosentient Systems<u></u><u></u></p><p class="MsoNormal">72/330 Wattle St<u></u><u></u></p><p class="MsoNormal">Ultimo, NSW 2007<u></u><u></u></p><p class="MsoNormal">Australia<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Office: 02 9212 0899<u></u><u></u></p><p class="MsoNormal">Online: 02 8005 0595<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 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" target="_blank">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" target="_blank">dcook@prosentient.com.au</a><br><b>Cc:</b> koha-devel <<a href="mailto:koha-devel@lists.koha-community.org" target="_blank">koha-devel@lists.koha-community.org</a>><br><b>Subject:</b> Re: [Koha-devel] Rancor/Advanced MARC Editor templates?<u></u><u></u></span></p></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Hi David,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></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?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Andrew<u></u><u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Wed, Jul 22, 2020 at 11:37 PM <<a href="mailto:dcook@prosentient.com.au" target="_blank">dcook@prosentient.com.au</a>> wrote:<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"><div><div><p class="MsoNormal">Hi all,<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Is it possible to define templates for Rancor/Advanced MARC Editor?<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">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). <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">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. <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">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).<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">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?<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">David Cook<u></u><u></u></p><p class="MsoNormal">Systems Librarian<u></u><u></u></p><p class="MsoNormal">Prosentient Systems<u></u><u></u></p><p class="MsoNormal">72/330 Wattle St<u></u><u></u></p><p class="MsoNormal">Ultimo, NSW 2007<u></u><u></u></p><p class="MsoNormal">Australia<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Office: 02 9212 0899<u></u><u></u></p><p class="MsoNormal">Online: 02 8005 0595<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></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><u></u><u></u></p></blockquote></div><p class="MsoNormal"><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><div><div><div><div><div><div><div><div><div><div><div><p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(117,117,117)">Andrew Fuerste-Henry</span><span style="font-size:9.5pt;color:rgb(80,0,80)"><u></u><u></u></span></p><div><p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(117,117,117)">Educator<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(117,117,117)">(he/him/his)<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(117,117,117)">ByWater Solutions<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(117,117,117)"><a href="http://bywatersolutions.com/" target="_blank"><span style="color:rgb(126,87,194)">bywatersolutions.com</span></a><u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(117,117,117)">Phone:<a href="tel:(888)%20900-8944" target="_blank"><span style="color:rgb(126,87,194)">(888)900-8944</span></a><u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(117,117,117)"><img border="0" width="163" height="60" style="width: 1.6979in; height: 0.625in;" id="gmail-m_3327634860788153974_x0000_i1025" src="https://drive.google.com/a/bywatersolutions.com/uc?id=1VVVFrey9XECr3VKtRsBrnaF0w5ESXYcA&export=download"></span><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(117,117,117)"><u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(117,117,117)"><a href="http://bywatersolutions.com/what-is-koha/" target="_blank"><span style="color:rgb(126,87,194)">What is Koha?</span></a><u></u><u></u></span></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="font-size:12.8px"><div dir="ltr"><span style="font-size:13px;color:rgb(117,117,117);font-family:sans-serif">Andrew Fuerste-Henry</span><span style="color:rgb(80,0,80)"><div style="font-size:13px;color:rgb(117,117,117);font-family:sans-serif">Educator</div><div style="font-size:13px;color:rgb(117,117,117);font-family:sans-serif">(he/him/his)</div><div style="font-size:13px;color:rgb(117,117,117);font-family:sans-serif">ByWater Solutions</div><div style="font-size:13px;color:rgb(117,117,117);font-family:sans-serif"><a href="http://bywatersolutions.com/" style="color:rgb(126,87,194)" target="_blank">bywatersolutions.com</a></div><div style="font-size:13px;color:rgb(117,117,117);font-family:sans-serif">Phone:<a href="tel:(888)%20900-8944" value="+18889008944" style="color:rgb(126,87,194)" target="_blank">(888)900-8944</a></div><div style="font-size:13px;color:rgb(117,117,117);font-family:sans-serif"><img src="https://drive.google.com/a/bywatersolutions.com/uc?id=1VVVFrey9XECr3VKtRsBrnaF0w5ESXYcA&export=download"><br></div></span><div style="font-size:13px;color:rgb(117,117,117);font-family:sans-serif"><a href="http://bywatersolutions.com/what-is-koha/" style="color:rgb(126,87,194)" target="_blank">What is Koha?</a></div></div></div></div></div></div></div></div></div></div></div></div></div>