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

2022-07-06 Thread Linda Jansová via Evergreen-general

Dear Michele,

Thank you for highlighting this bug!

I have summed up your observation and added it as a comment to the bug 
so that it is easier for others to figure this out (and look forward for 
the patch to be included in the future releases :-)!


Linda

On 7/6/22 17:24, Morgan, Michele wrote:

Hi Linda,

Since the purpose of a custom filter is to further limit events that 
are being created, adding one would not help if no events are 
currently succeeding.


Perhaps you are running into this launchpad bug:

https://bugs.launchpad.net/evergreen/+bug/1955079

Since your triggers are using the same hook and reactor as the one 
that emails records from the catalog, I would suspect yours would also 
be affected by this bug.


Hope this is helpful,
Michele

--
Michele M. Morgan, Technical Support Analyst
North of Boston Library Exchange, Danvers Massachusetts
mmor...@noblenet.org



On Wed, Jul 6, 2022 at 4:49 AM Linda Jansová via Evergreen-general 
 wrote:


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"]/*

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

2022-07-06 Thread Morgan, Michele via Evergreen-general
Hi Linda,

Since the purpose of a custom filter is to further limit events that are
being created, adding one would not help if no events are currently
succeeding.

Perhaps you are running into this launchpad bug:

https://bugs.launchpad.net/evergreen/+bug/1955079

Since your triggers are using the same hook and reactor as the one that
emails records from the catalog, I would suspect yours would also be
affected by this bug.

Hope this is helpful,
Michele

--
Michele M. Morgan, Technical Support Analyst
North of Boston Library Exchange, Danvers Massachusetts
mmor...@noblenet.org



On Wed, Jul 6, 2022 at 4:49 AM Linda Jansová via Evergreen-general <
evergreen-general@list.evergreen-ils.org> wrote:

> 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
> %]

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

2022-07-06 Thread Linda Jansová via Evergreen-general

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:* CON

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

2022-06-29 Thread Linda Jansová via Evergreen-general

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 -', 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 = he