Important
The documtation below still holds, but the latest version of the code running at KCLS (as of 2024-09-12, where this code originated) lives at https://github.com/kcls/evergreen-pub/tree/release/3.11/KCLS/utility-scripts/xml-notices
XML Notice File Generator For Evergreen
Generate and send XML files for Evergreen Action/Trigger event definitions. Files are sent to configured 3rd party for generating print/email/phone/etc. notices.
- Use the NOOP_True reactor.
- The purpose of the event definition is only to collect target (e.g. circulation ID) information.
- No template is nececessary
- It should NOT have a group_field value.
- Grouping is done by the script.
- Give it a unique granularity
- No environment data will be needed, unless one of the other modules (e.g. validator) requires it.
INSERT INTO action_trigger.event_definition (
id, owner, active, name, hook, validator, reactor, delay, max_delay,
usr_field, opt_in_setting, delay_field, granularity, retention_interval
) VALUES (
500,
1,
TRUE,
'Hold Expired On Hold Shelf Email Notice (UMS)',
'hold_request.cancel.expire_holds_shelf',
'HoldIsCancelled',
'NOOP_True',
'00:00:30', -- delay
NULL, -- max delay
'usr', -- usr field
'notification.hold.cancel.email', -- opt in
NULL, -- delay field
'Hold-Shelf-Expire-Email', -- granularity
'1 year'
);
- Set the required value for the SCP_DEST variable.
- Comment-out the KCLS notifications configured within the "case $GRANULARITY in" block. I left the KCLS notices for reference, since Different notice types use different options.
- Add your new notice to the file to the same block
case $GRANULARITY in
'Hold-Shelf-Expire-Email')
export FOR_EMAIL="--for-email"
export EVENT_DEF=500
export NOTICE_TAG=hold-shelf-expire
export NOTICE_TYPE="hold shelf expire email"
;;
# Other notices here...
esac
- Create the XML file output directory
sudo -u opensrf mkdir -p /openils/var/data/xml-notices
- Remove --send-email to generate the XML file without sending it.
./generate-notices.sh --granularity Hold-Shelf-Expire-Email --send-xml
By default, the script processes events whose run_time occurred yesterday, but this can be modified via the --end-date and --window variables.
This example would be executed hourly to process events whose run time fell within the previous hour.
./generate-notices.sh --send-xml --window "1 hour" \
--end-date "$(date +'%FT%H:00:00')" --granularity Hold-Ready-Locker-Phone