updated manual hold notification to use the editor+transaction
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 2 Jan 2007 19:03:17 +0000 (19:03 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 2 Jan 2007 19:03:17 +0000 (19:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6714 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm

index 58890b1..7dbf550 100644 (file)
@@ -670,7 +670,8 @@ __PACKAGE__->register_method (
                @return ID of the new object on success, Event on error
                /
 );
-sub create_hold_notify {
+=head old
+sub __create_hold_notify {
        my( $self, $conn, $authtoken, $notification ) = @_;
        my( $requestor, $evt ) = $U->checkses($authtoken);
        return $evt if $evt;
@@ -692,6 +693,26 @@ sub create_hold_notify {
        $logger->info("User ".$requestor->id." successfully created new hold notification $id");
        return $id;
 }
+=cut
+
+sub create_hold_notify {
+   my( $self, $conn, $auth, $note ) = @_;
+   my $e = new_editor(authtoken=>$auth, xact=>1);
+   return $e->die_event unless $e->checkauth;
+
+   my $hold = $e->retrieve_action_hold_request($note->hold)
+      or return $e->die_event;
+   my $patron = $e->retrieve_actor_user($hold->usr) 
+      or return $e->die_event;
+
+   return $e->die_event unless 
+      $e->allowed('CREATE_HOLD_NOTIFICATION', $patron->home_ou);
+
+       $note->notify_staff($e->requestor->id);
+   $e->create_action_hold_notification($note) or return $e->die_event;
+   $e->commit;
+   return $note->id;
+}
 
 
 __PACKAGE__->register_method(