From 9f4dcb9adaffd2ad4650bc87a52d43a21e43b17a Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 18 Jan 2008 20:15:49 +0000 Subject: [PATCH] added a method to retrieve picklist by name/owner git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8422 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Acq/Picklist.pm | 28 ++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm index 63e7e2230a..98d59bf0b4 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm @@ -83,15 +83,35 @@ __PACKAGE__->register_method( sub retrieve_picklist { my($self, $conn, $auth, $picklist_id, $options) = @_; my $e = new_editor(authtoken=>$auth); - return $e->die_event unless $e->checkauth; + return $e->event unless $e->checkauth; my $picklist = $e->retrieve_acq_picklist($picklist_id) - or return $e->die_event; + or return $e->event; return $BAD_PARAMS unless $e->requestor->id == $picklist->owner; return $picklist; } +__PACKAGE__->register_method( + method => 'retrieve_picklist_name', + api_name => 'open-ils.acq.picklist.name.retrieve', + signature => { + desc => 'Retrieves a picklist by name. Owner is implied by the caller', + params => [ + {desc => 'Authentication token', type => 'string'}, + {desc => 'Picklist name to retrieve', type => 'strin'}, + ], + return => {desc => 'Picklist object on success, null on not found'} + } +); + +sub retrieve_picklist_name { + my($self, $conn, $auth, $name) = @_; + my $e = new_editor(authtoken=>$auth); + return $e->event unless $e->checkauth; + return $e->search_acq_picklist( + {name => $name, owner => $e->requestor->id})->[0]; +} @@ -173,6 +193,10 @@ sub create_picklist_entry { or return $e->die_event; return $BAD_PARAMS unless $picklist->owner == $e->requestor->id; + # indicate the picklist was updated + $picklist->edit_time('now'); + $e->update_acq_picklist($picklist) or return $e->die_event; + $e->create_acq_picklist_entry($entry) or return $e->die_event; $e->commit; -- 2.11.0