[Evergreen-general] An action trigger for sending emails after bib records are created?

Linda Jansová linda.jansova at gmail.com
Wed Jul 6 04:49:16 EDT 2022


Hi everyone,

As we have not managed to find a solution yet, we have examined the 
documentation 
(https://docs.evergreen-ils.org/eg/docs/3.9/admin/actiontriggers.html) 
again and have found out that a JSON custom filters can be added:

--custom-filters=[filter_file]: File containing a JSON Object which 
describes any hooks that should use a user-defined filter to find their 
target objects. Defaults to: /openils/conf/action_trigger_filters.json

Should the default (example) file

https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/examples/action_trigger_filters.json.example;h=c56559f584c148b3a90808df6bb3c650fba0c3dd;hb=HEAD

be okay? Or should some changes be made to it so that the 
biblio.format.record_entry.email hook actually sends the emails?*
*

Anyway, we believe that the following line from our crontab should take 
care of sending out the emails resulting from the processing of the 
aforementioned hook:

*/5 * * * * . ~/.bashrc && $EG_BIN_DIR/action_trigger_runner.pl 
--osrf-config $SRF_CORE --run-pending

But maybe we are mistaken to assume that this trigger (without any 
granularity) is handled using this crontab command?

Any hints as to what and where check are much appreciated!

Linda


On 6/29/22 16:58, Linda Jansová wrote:
>
> Dear all,
>
> We are trying to make our action triggers work - we are on a 3.6 
> system and so far we have not found a working solution for a trigger 
> that would send an email after a bib record is created.
>
> As we suspect that there might be something wrong with our crontab, 
> attached is its current crontab setup.
>
> Bellow are two action triggers which we have (both unsuccessfully) 
> tried. The first one uses our original template code (which - for some 
> reason - had worked before we upgraded to 3.6 last year) and the 
> second one uses the template code from a 3.9 community demo system 
> (https://demo.evergreencatalog.com/eg2/en-US/staff/admin/local/action_trigger/event_definition/31). 
> I am well aware that there is a version mismatch in the second case 
> but we decided to at least give it a try before digging deeper.
>
> *Action trigger with original template code and settings (Evergreen 3.6):*
>
> *Owning Library: *CONS*
> Name:* biblio.record_entry.email*
> Hook: *biblio.format.record_entry.email*
> Enabled:* ticked*
> Processing Delay:* 00:00:00*
> Processing Delay Context Field:* empty*
> Processing Group Context Field:* owner*
> Reactor:* SendEmail*
> Validator:* NOOP_True*
> Event Repeatability Delay:* empty
>
> *Definition ID:* 165*
> Failure Cleanup:* DeleteTempBiblioBucket*
> Granularity:* empty*
> Max Event Validity Delay:* empty*
> Message Library Path:* empty*
> Message Template:* empty*
> Message Title:* empty*
> Message User Path:* empty*
> Opt-In Setting Type:* empty*
> Opt-In User Field:* empty*
> Retention Interval:* empty*
> Success Cleanup:* DeleteTempBiblioBucket*
> Template:*
>
> [%- SET user = target.0.owner -%]
>
> To: [%- params.recipient_email || user.email %]
>
> From: [%- params.sender_email || default_sender %]
>
> Subject: Informace o dokumentech v katalogu
>
>
> [% FOR cbreb IN target %][% title = '' %]
>
> [% FOR item IN cbreb.items;
>
> bre_id = item.target_biblio_record_entry;
>
>
> bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
>
> FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
>
> title = title _ part.textContent;
>
> END;
>
>
> author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
>
> item_type = 
> bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
>
> publisher = bibxml.findnodes('//*[@tag="260" or 
> @tag="264"]/*[@code="b"]').textContent;
>
> pubdate = bibxml.findnodes('//*[@tag="260" or 
> @tag="264"]/*[@code="c"]').textContent;
>
> isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
>
> issn = bibxml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
>
> upc = bibxml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
>
> %]
>
>
> Číslo záznamu [% bre_id %]
>
> [% title %] [% author %]
>
> [% publisher %] [% pubdate %]
>
> [% IF isbn %]ISBN: [% isbn %][% END %][% IF issn %]ISSN: [% issn %][% 
> END %]
>
> Odkaz na záznam ve Společném katalogu Evergreen: 
> http://spok.jabok.cuni.cz/eg/opac/record/[% bre_id %]
>
> [% END %]
>
> [% END %]
>
>
>
>
> -----------
>
> TIP: Odkaz na záznam(y) v katalogu vaší knihovny:
>
>
> Pokud chcete vytvořit odkaz na knihu/dokument přímo do katalogu vaší 
> knihovny, přidejte čísla záznamu na konec níže uvedeného URL vaší 
> knihovny (za poslední lomítko):
>
> - Knihovna Jabok: https://knihovna.jabok.cuni.cz/eg/opac/record/
>
> - Evangelikální teologický seminář: 
> https://ets.jabok.cuni.cz/eg/opac/record/
>
> - Jáchymka: https://jachymka.jabok.cuni.cz/eg/opac/record/
>
> - Katolický domov studujících: https://kds.jabok.cuni.cz/eg/opac/record/
>
> - Člověk v tísni: https://clovekvtisni.jabok.cuni.cz/eg/opac/record/
>
> - Hospic Dobrého Pastýře: 
> https://dobrypastyr.jabok.cuni.cz/eg/opac/record/
>
>
>
> *Action trigger with template code from the community demo server 
> (Evergreen 3.9):*
>
> *Owning Library:* CONS*
> Name:* BibliografickeZaznamyEmail*
> Hook:* biblio.format.record_email
>
> *Enabled:* ticked*
> Processing Delay:* 00:00:00*
> Processing Delay Context Field:* empty*
> Processing Group Context Field:* owner*
> Reactor: *SendEmail*
> Validator:* NOOP_True*
> Event Repeatability Delay:* empty*
> Definition ID:* 213*
> Failure Cleanup:* DeleteTempBiblioBucket*
> Granularity:* empty*
> Max Event Validity Delay:* empty*
> Message Library Path:* empty*
> Message Template:* empty*
> Message Title:* empty*
> Message User Path:* empty*
> Opt-In Setting Type:* empty*
> Opt-In User Field:* empty*
> Retention Interval:* empty*
> Success Cleanup:* DeleteTempBiblioBucket*
> Template:*
>
> [%- USE date -%]
>
> [%- SET user = target.0.owner -%]
>
> To: [%- params.recipient_email || user_data.0.email || user.email %]
>
> From: [%- params.sender_email || default_sender %]
>
> Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
>
> Subject: [%- user_data.0.subject || 'Bibliographic Records' %]
>
> Auto-Submitted: auto-generated
>
>
> [%- FOR cbreb IN target;
>
>
> flesh_list = '{mra';
>
> IF user_data.0.type == 'full';
>
> flesh_list = flesh_list _ ',holdings_xml,acp';
>
> IF params.holdings_limit;
>
> flimit = 'acn=>' _ params.holdings_limit _ ',acp=>' _ 
> params.holdings_limit;
>
> END;
>
> END;
>
> flesh_list = flesh_list _ '}';
>
>
> item_list = helpers.sort_bucket_unapi_bre(cbreb.items,{flesh => 
> flesh_list, site => user_data.0.context_org, flesh_limit => flimit}, 
> user_data.0.sort_by, user_data.0.sort_dir);
>
>
> FOR item IN item_list -%]
>
>
> [% loop.count %]/[% loop.size %]. Bib ID# [% item.id %]
>
> [% IF item.isbn %]ISBN: [% item.isbn _ "\n" %][% END -%]
>
> [% IF item.issn %]ISSN: [% item.issn _ "\n" %][% END -%]
>
> [% IF item.upc %]UPC: [% item.upc _ "\n" %][% END -%]
>
> Title: [% item.title %]
>
> [% IF item.author %]Author: [% item.author _ "\n" %][% END -%]
>
> Publication Info: [% item.publisher %] [% item.pubdate %]
>
> Item Type: [% item.item_type %]
>
> [% IF user_data.0.type == 'full' && item.holdings.size == 0 %]
>
> * No items for this record at the selected location
>
> [%- END %]
>
> [% FOR cp IN item.holdings -%]
>
> * Library: [% cp.circ_lib %]
>
> Location: [% cp.location %]
>
> Call Number: [% cp.prefix _ ' ' _ cp.callnumber _ ' ' _ cp.suffix %]
>
> [% IF cp.parts %] Parts: [% cp.parts _ "\n" %][% END -%]
>
> Status: [% cp.status_label %]
>
> Barcode: [% cp.barcode %]
>
>
> [% END -%]
>
> [%- END -%]
>
> [%- END -%]
>
>
> Do you have any idea about what might be preventing the trigger from 
> working properly? Or could you please share your working config?
>
> Or is there a way to switch on a debug mode in logging that could shed 
> more light on what is happening in our system when it comes to action 
> triggers and emails?
>
> Thank you very much for any hints!
>
> Linda
>
> **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.evergreen-ils.org/pipermail/evergreen-general/attachments/20220706/d568e42a/attachment-0001.htm>


More information about the Evergreen-general mailing list