From: erickson Date: Tue, 12 Feb 2008 14:24:38 +0000 (+0000) Subject: added entry updating method X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ee8bd4d86cd98bc88780fb68679246d74f248ea1;p=Evergreen.git added entry updating method git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8727 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm index c7d6b836b8..16955de8fd 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm @@ -276,6 +276,40 @@ sub delete_picklist_entry { __PACKAGE__->register_method( + method => 'update_picklist_entry', + api_name => 'open-ils.acq.picklist_entry.update', + signature => { + desc => 'Update a picklist_entry', + params => [ + {desc => 'Authentication token', type => 'string'}, + {desc => 'Picklist entry object update', type => 'object'} + ], + return => {desc => '1 on success, Event on error'} + } +); + +sub update_picklist_entry { + my($self, $conn, $auth, $pl_entry) = @_; + my $e = new_editor(xact=>1, authtoken=>$auth); + return $e->die_event unless $e->checkauth; + + my $orig_entry = $e->retrieve_acq_picklist_entry([ + $pl_entry->id, + { + flesh => 1, # grab the picklist_entry with picklist attached + flesh_fields => {acqple => ['picklist']} + } + ]) or return $e->die_event; + + # don't let anyone update someone else's picklist entry + return $BAD_PARAMS if $orig_entry->picklist->owner != $e->requestor->id; + + $e->update_acq_picklist_entry($pl_entry) or return $e->die_event; + $e->commit; + return 1; +} + +__PACKAGE__->register_method( method => 'retrieve_pl_picklist_entry', api_name => 'open-ils.acq.picklist_entry.picklist.retrieve', signature => {