From 08f6b56e457fa870a3d63c2fefbe8b511a0ba3a3 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 19 Jun 2009 14:33:48 +0000 Subject: [PATCH] fleshing hold notes on fleshed hold retrieval, added hold note CUD method git-svn-id: svn://svn.open-ils.org/ILS/trunk@13410 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Circ/Holds.pm | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index ed3d9cdb0c..e9f0511f27 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -666,6 +666,36 @@ sub update_hold_if_frozen { } } } +__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( @@ -1117,7 +1147,7 @@ sub fetch_captured_holds { $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 @@ sub uber_hold { $hold_id, { flesh => 1, - flesh_fields => { ahr => [ 'current_copy', 'usr' ] } + flesh_fields => { ahr => [ 'current_copy', 'usr', 'notes' ] } } ] ) or return $e->event; -- 2.11.0