[open-ils-commits] r8422 - branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jan 18 15:41:40 EST 2008


Author: erickson
Date: 2008-01-18 15:15:49 -0500 (Fri, 18 Jan 2008)
New Revision: 8422

Modified:
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
Log:
added a method to retrieve picklist by name/owner

Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm	2008-01-18 20:15:01 UTC (rev 8421)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm	2008-01-18 20:15:49 UTC (rev 8422)
@@ -83,18 +83,38 @@
 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];
+}
 
 
+
 __PACKAGE__->register_method(
 	method => 'retrieve_user_picklist',
 	api_name	=> 'open-ils.acq.picklist.user.retrieve',
@@ -173,6 +193,10 @@
         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;



More information about the open-ils-commits mailing list