From 732f55f8ea0355a32fe1ef93005f782f04d4fa4f Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 29 Mar 2010 20:36:06 +0000 Subject: [PATCH] create acq.created and acq.rejected events git-svn-id: svn://svn.open-ils.org/ILS/trunk@16041 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm index 4aac65da1..b9091140a 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm @@ -2639,6 +2639,7 @@ sub update_user_request { if ( $cancel_reason ) { $aur_obj->cancel_reason( $cancel_reason ); $e->update_acq_user_request($aur_obj) or return $e->die_event; + create_user_request_events( [ $aur_obj ], 'aur.rejected' ); } else { $e->delete_acq_user_request($aur_obj); } @@ -2707,9 +2708,26 @@ sub new_user_request { $e->commit; + create_user_request_events( [ $aur_obj ], 'aur.created' ); + return $aur_obj; } +sub create_user_request_events { + my($user_reqs, $hook) = @_; + + my $ses = OpenSRF::AppSession->create('open-ils.trigger'); + $ses->connect; + + for my $user_req (@$user_reqs) { + my $req = $ses->request('open-ils.trigger.event.autocreate', $hook, $user_req, $user_req->usr->home_ou); + $req->recv; + } + + $ses->disconnect; + return undef; +} + __PACKAGE__->register_method( method => "po_note_CUD_batch", -- 2.11.0