[OPEN-ILS-GENERAL] ***SPAM*** Action / Trigger

David Busby david.busby at edoceo.com
Wed Dec 14 13:54:46 EST 2011


Greetings Star-fighters;

  My goal is to create process that will email my patrons their due
date information after checkout.  I'm hoping to originate one-email
per set of items checked-out. (not one email per copy).

  I have created a Trigger Event Definition:

evergreen=# select * from action_trigger.event_definition where id = 101;
-[ RECORD 1 ]---+----------------------------------------------------------------------------------------
id              | 101
active          | t
owner           | 1
name            | Circ Checkout Due Email
hook            | checkout
validator       | NOOP_True
reactor         | SendEmail
cleanup_success | NOOP_True
cleanup_failure | NOOP_True
delay           | 05:00:00
max_delay       |
usr_field       |
opt_in_setting  |
delay_field     | circ.create_time
group_field     | usr
template        | [%- USE date -%]
                | [%- user = target.0.usr -%]
                | To: [%- params.recipient_email || user.email %]
                | From: [%- params.sender_email || default_sender %]
                | Subject: [kcls.org] Item Due Reminder
                |
                | Dear [% user.family_name %], [% user.first_given_name %]
                |
                | A friendly reminder, these items you checked out
today are due at:
                |
                | [%- params.recipient_email || user.email %][%-
params.sender_email || default_sender %]
                |
                | [% FOR circ IN target %]
                |     Title: [%
circ.target_copy.call_number.record.simple_record.title %]
                |     Barcode: [% circ.target_copy.barcode %]
                |     Due: [%
date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
                |     Item Cost: [% helpers.get_copy_price(circ.target_copy) %]
                |     Total Owed For Transaction: [%
circ.billable_transaction.summary.total_owed %]
                |     Library: [% circ.circ_lib.name %]
                |
                | [% END %]
                |
granularity     | Hourly

  After creating this definition, I perform a checkout (which becomes
visible in the circulation view)
-[ RECORD 2 ]-------+------------------------------
id                  | 2
usr                 | 389
xact_start          | 2011-12-14 17:08:48.497165-08
xact_finish         |
unrecovered         |
target_copy         | 364
circ_lib            | 4
circ_staff          | 1
checkin_staff       |
checkin_lib         |
renewal_remaining   | 2
grace_period        | 1 day
due_date            | 2011-12-21 23:59:59-08
stop_fines_time     |
checkin_time        |
create_time         | 2011-12-14 17:08:48.497165-08
duration            | 7 days
fine_interval       | 1 day
recurring_fine      | 0.05
max_fine            | 5.00
phone_renewal       | f
desk_renewal        | f
opac_renewal        | f
duration_rule       | default
recurring_fine_rule | default
max_fine_rule       | default
stop_fines          |
workstation         | 1
checkin_workstation |
checkin_scan_time   |
parent_circ         |

  Then I run the processor as follows (manually for now, cron later)

./action_trigger_runner.pl \
  --debug-stdout \
  --osrf-config=/openils/etc/opensrf_core.xml \
   --process-hooks \
  --run-pending

This script never produces output, but I do see this kind of stuff in
my logs (orsfsys.log)

request en-US open-ils.cstore.direct.action_trigger.event.id_list
[{"+atevdef":{"granularity":null},"run_time":{"<":"now"},"state":"pending"},{"order_by":{"atev":["run_time","add_time"]},"join":"atevdef"}]
open-ils.cstore 2011-12-14 18:07:25
[INFO:19675:osrf_application.c:1040:] CALL: open-ils.cstore
open-ils.cstore.direct.action_trigger.event.id_list
{"+atevdef":{"granularity":null},"run_time":{"<":"now"},"state":"pending"},{"order_by":{"atev":["run_time","add_time"]},"join":"atevdef"}
open-ils.cstore 2011-12-14 18:07:25
[INFO:19675:osrf_app_session.c:991:] [open-ils.cstore] sent 175 bytes
of data to opensrf at private.localhost/open-ils.trigger_drone_at_localhost_19700
open-ils.cstore 2011-12-14 18:07:25 [INFO:19675:osrf_stack.c:159:]
Message processing duration 0.004140
[2011-12-14 18:07:25] open-ils.trigger
[INFO:19700:CStoreEditor.pm:109:] editor[1|0]
action_trigger.event.search : returned 0 result(s)
open-ils.cstore 2011-12-14 18:07:25 [INFO:19675:osrf_stack.c:159:]
Message processing duration 0.000019

  I am confused & using Evergreen 2.0.1a, PostgreSQL 9.1
  Also, many thanks to the IRC folks for helping me get this far.

--
David Busby
Managing Director
Edoceo, Inc.
http://edoceo.com/
206.282.6500


More information about the Open-ils-general mailing list