[Koha-devel] Rancor/Advanced MARC Editor templates?

Andrew Fuerste-Henry andrew at bywatersolutions.com
Fri Jul 24 14:35:21 CEST 2020


Hi David,

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.

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:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25962

Macros have been moved from the browser cache to the database proper in
20.05, so they would be sharable as templates:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17268

Thanks!
Andrew


On Thu, Jul 23, 2020 at 6:52 PM <dcook at prosentient.com.au> wrote:

> Hi Andrew,
>
>
>
> I think that I’ve figured out how the editor works. The relevant code is
> at the bottom of my email.
>
>
>
> 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.
>
>
>
> 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.
>
>
>
> 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.
>
>
>
> 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.
>
>
>
> 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
> https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26055 to
> explore this further.
>
>
>
> --
>
> ./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 );
>
>                         }
>
>                     } );
>
>                 } );
>
>             } );
>
>         },
>
>
>
>
>
> David Cook
>
> Systems Librarian
>
> Prosentient Systems
>
> 72/330 Wattle St
>
> Ultimo, NSW 2007
>
> Australia
>
>
>
> Office: 02 9212 0899
>
> Online: 02 8005 0595
>
>
>
> *From:* dcook at prosentient.com.au <dcook at prosentient.com.au>
> *Sent:* Friday, 24 July 2020 9:24 AM
> *To:* 'Andrew Fuerste-Henry' <andrew at bywatersolutions.com>
> *Cc:* 'koha-devel' <koha-devel at lists.koha-community.org>
> *Subject:* RE: [Koha-devel] Rancor/Advanced MARC Editor templates?
>
>
>
> Hi Andrew,
>
>
>
> 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.
>
>
>
> But thanks for the suggestion. One of these days, I do need to examine the
> editor more closely.
>
>
>
> David Cook
>
> Systems Librarian
>
> Prosentient Systems
>
> 72/330 Wattle St
>
> Ultimo, NSW 2007
>
> Australia
>
>
>
> Office: 02 9212 0899
>
> Online: 02 8005 0595
>
>
>
> *From:* Andrew Fuerste-Henry <andrew at bywatersolutions.com>
> *Sent:* Thursday, 23 July 2020 11:56 PM
> *To:* dcook at prosentient.com.au
> *Cc:* koha-devel <koha-devel at lists.koha-community.org>
> *Subject:* Re: [Koha-devel] Rancor/Advanced MARC Editor templates?
>
>
>
> Hi David,
>
>
>
> 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?
>
>
>
> Andrew
>
>
>
> On Wed, Jul 22, 2020 at 11:37 PM <dcook at prosentient.com.au> wrote:
>
> Hi all,
>
>
>
> Is it possible to define templates for Rancor/Advanced MARC Editor?
>
>
>
> 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).
>
>
>
> 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.
>
>
>
> 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).
>
>
>
> 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?
>
>
>
> David Cook
>
> Systems Librarian
>
> Prosentient Systems
>
> 72/330 Wattle St
>
> Ultimo, NSW 2007
>
> Australia
>
>
>
> Office: 02 9212 0899
>
> Online: 02 8005 0595
>
>
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>
>
>
>
> --
>
> Andrew Fuerste-Henry
>
> Educator
>
> (he/him/his)
>
> ByWater Solutions
>
> bywatersolutions.com
>
> Phone:(888)900-8944 <(888)%20900-8944>
>
> What is Koha? <http://bywatersolutions.com/what-is-koha/>
>


-- 
Andrew Fuerste-Henry
Educator
(he/him/his)
ByWater Solutions
bywatersolutions.com
Phone:(888)900-8944 <(888)%20900-8944>

What is Koha? <http://bywatersolutions.com/what-is-koha/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20200724/78185e84/attachment-0001.htm>


More information about the Koha-devel mailing list