[open-ils-commits] r13410 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jun 19 10:33:50 EDT 2009


Author: erickson
Date: 2009-06-19 10:33:48 -0400 (Fri, 19 Jun 2009)
New Revision: 13410

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
fleshing hold notes on fleshed hold retrieval, added hold note CUD method

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2009-06-19 14:33:01 UTC (rev 13409)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2009-06-19 14:33:48 UTC (rev 13410)
@@ -666,8 +666,38 @@
         }
     }
 }
+__PACKAGE__->register_method(
+	method	=> "hold_note_CUD",
+	api_name	=> "open-ils.circ.hold_request.note.cud");
 
+sub hold_note_CUD {
+	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;
+
+    if($hold->usr ne $e->requestor->id) {
+        my $usr = $e->retrieve_actor_user($hold->usr);
+        return $e->die_event unless $e->allowed('UPDATE_HOLD', $usr->home_ou);
+    }
+
+    if($note->isnew) {
+        $e->create_action_hold_request_note($note) or return $e->die_event;
+    } elsif($note->ischanged) {
+        $e->update_action_hold_request_note($note) or return $e->die_event;
+    } elsif($note->isdeleted) {
+        $e->delete_action_hold_request_note($note) or return $e->die_event;
+    }
+
+    $e->commit;
+    return $note->id;
+}
+
+
+
 __PACKAGE__->register_method(
 	method	=> "retrieve_hold_status",
 	api_name	=> "open-ils.circ.hold.status.retrieve",
@@ -1117,7 +1147,7 @@
                     $hold_id->{id},
                     {
                         flesh => 1,
-                        flesh_fields => {ahr => ['notifications', 'transit']},
+                        flesh_fields => {ahr => ['notifications', 'transit', 'notes']},
                         order_by => {anh => 'notify_time desc'}
                     }
                 ])
@@ -1749,7 +1779,7 @@
 			$hold_id,
 			{
 				flesh => 1,
-				flesh_fields => { ahr => [ 'current_copy', 'usr' ] }
+				flesh_fields => { ahr => [ 'current_copy', 'usr', 'notes' ] }
 			}
 		]
 	) or return $e->event;



More information about the open-ils-commits mailing list