From 2b2d480213a7a8a62a456596b9df5629d690fa7c Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 26 May 2009 14:03:52 +0000 Subject: [PATCH] created hooks and drop points for damaged and checkout.damaged, the latter occuring when a patron is 'linked' to a damaged item (aka charged fines) by virtue of the most recent circulation git-svn-id: svn://svn.open-ils.org/ILS/trunk@13230 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Circ.pm | 8 ++++++++ Open-ILS/src/sql/Pg/400.schema.action_trigger.sql | 2 ++ 2 files changed, 10 insertions(+) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm index a1f0975da3..e9867b1dd4 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm @@ -19,6 +19,7 @@ use DateTime::Format::ISO8601; use OpenILS::Application::AppUtils; use OpenSRF::Utils qw/:datetime/; +use OpenSRF::AppSession; use OpenILS::Utils::ModsParser; use OpenILS::Event; use OpenSRF::EX qw(:try); @@ -881,6 +882,9 @@ sub mark_item { my $evt = handle_mark_damaged($e, $copy, $owning_lib, $args); return $evt if $evt; + my $ses = OpenSRF::AppSession->create('open-ils.trigger'); + $ses->request('open-ils.trigger.event.autocreate', 'damaged', $copy, $owning_lib); + } elsif ( $self->api_name =~ /bindery/ ) { $perm = 'MARK_ITEM_BINDERY'; $stat = OILS_COPY_STATUS_BINDERY; @@ -969,6 +973,10 @@ sub handle_mark_damaged { my $evt = OpenILS::Application::Circ::CircCommon->reopen_xact($e, $circ->id); return $evt if $evt; + + my $ses = OpenSRF::AppSession->create('open-ils.trigger'); + $ses->request('open-ils.trigger.event.autocreate', 'checkout.damaged', $circ, $circ->circ_lib); + return undef; } else { diff --git a/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql b/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql index bdd9b0b145..5c52c0cf14 100644 --- a/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql +++ b/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql @@ -51,6 +51,8 @@ INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('penalty.PAT INSERT INTO action_trigger.hook (key,core_type,description,passive) VALUES ('format.po.jedi','acqpo','Formats a Purchase Order as a JEDI document',TRUE); INSERT INTO action_trigger.hook (key,core_type,description,passive) VALUES ('format.po.html','acqpo','Formats a Purchase Order as an HTML document',TRUE); INSERT INTO action_trigger.hook (key,core_type,description,passive) VALUES ('format.po.pdf','acqpo','Formats a Purchase Order as a PDF document',TRUE); +INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('damaged','acp','Item marked damaged'); +INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('checkout.damaged','circ','A circulating item is marked damaged and the patron is fined'); -- and much more, I'm sure -- Specialized collection modules. Given an FM object, gather some info and return a scalar or ref. -- 2.11.0