[Evergreen-general] Setting up a trigger for overdue items notification

Linda Jansová linda.jansova at gmail.com
Tue Jun 21 07:28:58 EDT 2022


Dear Terran and everyone else interested in the topic :-),

We have spent some time testing our trigger (actually, more of them but 
especially the one which we mentioned below ;-) and - as a result - have 
found out two things:

1) The granularity in crontab and in the staff client interface must use 
the same case, meaning "daily" and "Daily" are treated as two different 
values.

2) Without the parameter "--run-pending" triggers do not appear to work.

What is a bit confusing in this respect is the relevant description in 
documentation:

https://docs.evergreen-ils.org/eg/docs/3.8/admin/actiontriggers.html

vs. the actual values included in sample crontab:

https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/examples/crontab.example;hb=2678ee1dfcc448968ba8e8ae7fd0da1bc69eeecf

E.g., the documentation mentions "Hourly" (with the "H" - an uppercase 
letter):

"Options are Hourly, Daily, Weekly, Monthly, Yearly, but you may also 
create new values."

But the sample crontab includes the value "hourly" (all lowercase letters):

0 * * * *   . ~/.bashrc && $EG_BIN_DIR/action_trigger_runner.pl 
--osrf-config $SRF_CORE --process-hooks --granularity hourly

Also, the crontab example commands under the heading "Passive A/T event 
generation." do not include -run--pending parameter but it seems that 
without it the triggers do not do what one expect them to.

Maybe this observation would be useful to some of you who may also 
struggle to make some triggers work :-).

Linda


On 5/3/22 21:31, Linda Jansová wrote:
> Dear Terran,
>
> Thank you very much for the hints and especially for sharing your 
> working config for this type of notification! We will compare it with 
> ours and hopefully find out what has not been set up properly in our 
> installation :-).
>
> Linda
>
> On 5/3/22 21:23, Terran McCanna wrote:
>> My first thought was perhaps the "Daily" granularity isn't set up in 
>> your cron jobs properly.
>>
>> Also, you may want to check the Trigger Event Environment (by 
>> clicking on the action trigger title rather than on the row) to make 
>> sure it has all the field paths you need.
>>
>> This is how we have our 10-day notice set up:
>>
>> *Trigger Event Environment:*
>> billable_transaction.summary
>> circ_lib
>> circ_lib.billing_address
>> target_copy.call_number
>> usr
>> usr.card
>> usr.home_ou
>> usr.home_ou.billing_address
>> usr.home_ou.hours_of_operation
>> usr.home_ou.mailing_address
>> usr.home_ou.parent_ou
>>
>> *Settings:*
>> Owning Library: PINES
>> Name: 10 Day Overdue Email Notification
>> Hook: checkout.due
>> Enabled: (checked)
>> Processing Delay: 10 days
>> Processing Delay Content Field: due_date
>> Processing Group Context Field: usr
>> Reactor: SendEmail
>> Validator: CircIsOverdue
>> Context Bib Path: target_copy.call_number.record
>> Context Item Path: target_copy
>> Context Library Path: circ_lib
>> Context User Path: usr
>> Granularity: overdue-notices
>> Max Event Validity Delay: 11 days
>> Retention Interval: 6 mons
>>
>> *Template: *
>> [%- USE date -%]
>> [%- user = target.0.usr -%]
>> [%- homelib = user.home_ou -%]
>> To: [%- params.recipient_email || user.email %]
>> From: [%- helpers.get_org_setting(homelib.id <http://homelib.id>, 
>> 'org.bounced_emails') || homelib.email || params.sender_email || 
>> default_sender %]
>> Reply-To: [%- helpers.get_org_setting(homelib.id <http://homelib.id>, 
>> 'org.bounced_emails') || homelib.email || params.sender_email || 
>> default_sender %]
>> Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
>> Subject: [PINES] Overdue Library Materials
>>
>> Attention:   [% user.first_given_name %] [% user.family_name %]
>> Card Number: [% user.card.barcode %]
>>
>> Our records indicate the following items are 10 days or more overdue.
>>
>> [% FOR circ IN target %]
>>      [%- copy_details = 
>> helpers.get_copy_bib_basics(circ.target_copy.id 
>> <http://circ.target_copy.id>) -%]
>>      Title:    [% copy_details.title FILTER ucfirst %]
>>      Author:   [% copy_details.author FILTER ucfirst %]
>>      Call No:  [% circ.target_copy.call_number.label %]
>>      Barcode:  [% circ.target_copy.barcode %]
>>      Checked Out At: [% circ.circ_lib.name <http://circ.circ_lib.name> %]
>>      Due Date: [% date.format(helpers.format_date(circ.due_date), 
>> '%m-%d-%Y') %]
>>
>> [% END %]
>>
>> Overdue fines will continue to accrue until items are returned. Items 
>> may be returned and fines paid at any PINES member library. Some 
>> libraries also accept online payments at: https://gapines.org/login
>>
>> If you have any questions, please contact your home library at:
>>
>>      [% homelib.parent_ou.name <http://homelib.parent_ou.name> %]
>>      [% homelib.name <http://homelib.name> %]
>>      [%- SET addr = homelib.mailing_address -%]
>>      [%- IF !addr -%] [%- SET addr = homelib.billing_address -%] [%- 
>> END %]
>>      [% addr.street1 %] [% addr.street2 %]
>>      [% addr.city %], [% addr.state %] [% addr.post_code %]
>>      [% homelib.phone %]
>>      [% homelib.email %]
>>
>>      [%- SET liburl = helpers.get_org_setting(homelib.id 
>> <http://homelib.id>, 'lib.info_url') -%]
>>      [% liburl %]
>>
>>      (Please have your library card number available.)
>>
>>
>> You may also access your account online at: https://gapines.org/login
>>
>> ---------------------------------------------------------------
>>
>> This is an automatically generated message. Please do not reply. If 
>> you believe you have received this message in error, please contact 
>> the library listed above.
>>
>>
>>
>>
>>
>>
>> 	
>>
>> Terran McCanna, PINES Program Manager
>>
>> ------------------------------------------------------------------------
>>
>> Georgia Public Library Service | University System of Georgia
>>
>> 2872 Woodcock Blvd, Suite 250 l Atlanta, GA 30341
>>
>> (404) 235-7138| tmccanna at georgialibraries.org
>>
>> http://help.georgialibraries.org | help at georgialibraries.org
>>
>>
>> <https://www.facebook.com/georgialibraries><https://www.twitter.com/georgialibs><https://www.instagram.com/georgialibraries/><https://www.twitter.com/georgialibs>
>>
>> Join our email list <http://georgialibraries.org>for stories of 
>> Georgia libraries making an impact in our communities.
>>
>>
>>
>>
>> On Mon, May 2, 2022 at 2:26 AM Linda Jansová via Evergreen-general 
>> <evergreen-general at list.evergreen-ils.org> wrote:
>>
>>     Dear all,
>>
>>     We are on Evergreen 3.6.4 and are trying to make the following
>>     trigger (notification email) work. We have some other
>>     notification emails working correctly, so I suppose we probably
>>     have something wrong with the trigger configuration itself rather
>>     than with the email server.
>>
>>     This notification is supposed to send an email to users who have
>>     not returned their checked-out item(s) in time - it should send
>>     the message one day after the due date.
>>
>>     Currently, we have the following setup:
>>
>>     *Owning Library*: JAB
>>
>>     *Name: *1 Day Overdue Email Notification - Jabok
>>
>>     *Hook:* checkout.due
>>
>>     *Enabled:* True
>>
>>     *Processing Delay:* 1 day
>>
>>     *Processing Delay Context Field:* due_date
>>
>>     *Processing Group Context Field:* usr
>>
>>     *Reactor: *SendEmail
>>
>>     *Validator:* CircIsOverdue
>>
>>     *Granularity:* Daily
>>
>>     *Max Event Validity Delay:* 2 days
>>
>>     *Template:*
>>
>>     [%- USE date -%]
>>     [%- user = target.0.usr -%]
>>     To: [%- params.recipient_email || user.email %]
>>     From: [%- params.sender_email || default_sender %]
>>     Subject: Nevracene knihy
>>
>>     Ctenar: [% user.family_name %], [% user.first_given_name %]
>>
>>     Dovolujeme si Vas  upozornit, ze uplynula vypujcni lhuta u
>>     nekterych vypujcentych knihovnich jednotek. Na Vasem konte zacalo
>>     nabyvat zpozdne ve vysi 2 Kc za knihovni jednotku a den.
>>
>>     Vypujcky s uplynulou vypujcni lhutou jiz NELZE PRODLOUZIT a proto
>>     je nutne je prinest k vraceni do knihovny (pokud nejsou
>>     rezervovane jinym ctenarem, je pote eventualne mozne jejich
>>     opetovne pujceni).
>>     Dokud nebudou vraceny (a zaroven dokud nebudou zaplaceny poplatky
>>     za zpozdne), je ctenarske konto blokovano a NENI MOZNE
>>     PRODLUZOVAT VYPUJCNI LHUTU zadnych vypujcenych knihovnich
>>     jednotek ani PUJCOVAT NEBO REZERVOVAT ZADNE DOKUMENTY. Je take
>>     pozastavena moznost splneni drive zadanych rezervaci nebo blokaci.
>>
>>
>>     Seznam knihovnich jednotech, u kterych jiz uplynula vypujcni lhuta:
>>
>>     [% FOR circ IN target %]
>>         [%- copy_details =
>>     helpers.get_copy_bib_basics(circ.target_copy.id
>>     <http://circ.target_copy.id>) -%]
>>         Nazev: [% copy_details.title %]
>>         Autor: [% copy_details.author %]
>>         Carovy kon: [% circ.target_copy.barcode %]
>>         K vraceni dne: [%
>>     date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
>>
>>
>>     [% END %]
>>
>>     All other available fields are empty in our setup.
>>
>>     Compared to 7 Day Overdue Email Notification from
>>     https://demo.evergreencatalog.com/eg/staff/admin/local/action_trigger/event_definition
>>     (which is Evergreen 3.8.0), fields Context Bib Path, Context Item
>>     Path and Context Library Path are missing from our interface.
>>     Have they been added to the interface in some of the more recent
>>     Evergreen versions? Or is it something we have lost along the way
>>     when migrating from older Evergreen versions (during the upgrade
>>     process)? This installation of ours is actually more than a
>>     decade old and keeps being upgraded each year...
>>
>>     Also, I have noticed that our template actually does not include:
>>
>>     Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
>>
>>     Auto-Submitted: auto-generated
>>
>>     However, we have another one that seems to be working fine where
>>     these two lines are also omitted...
>>
>>     The aforementioned 3.8.0 Evergreen demo also has - compared to
>>     what we have:
>>
>>     *Opt-In Setting Type*: circ.default_overdue_notices_enabled
>>
>>     *Opt-In User**Field:* usr
>>
>>     What is also different is that we have a daily granularity while
>>     the demo installation does not have any. Also, the demo server
>>     has a longer Max Event Validity Delay - 8 days - while we only
>>     have two (maybe two days are not sufficient in this case?).
>>
>>     (I understand that the demo server may not include the pristine
>>     setup of this trigger as anybody could change it so - probably in
>>     theory rather than in practice - some non-default values might
>>     have been inserted since it was last replaced with the original
>>     demo/default data. However, I think it may be a good starting
>>     point for making the comparisons anyway.)
>>
>>     Does anyone have any idea what should be wrong in our
>>     configuration? Or where else should we look (like library opening
>>     hours, granularity values accepted by the cron job or something
>>     else entirely)?
>>
>>     Thank you in advance for sharing any tips!
>>
>>     Linda
>>
>>     _______________________________________________
>>     Evergreen-general mailing list
>>     Evergreen-general at list.evergreen-ils.org
>>     http://list.evergreen-ils.org/cgi-bin/mailman/listinfo/evergreen-general
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.evergreen-ils.org/pipermail/evergreen-general/attachments/20220621/d3e5f677/attachment-0001.htm>


More information about the Evergreen-general mailing list