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

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 12 09:53:58 EST 2008


Author: erickson
Date: 2008-02-12 09:24:38 -0500 (Tue, 12 Feb 2008)
New Revision: 8727

Modified:
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
Log:
added entry updating method

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-02-12 02:41:11 UTC (rev 8726)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm	2008-02-12 14:24:38 UTC (rev 8727)
@@ -276,6 +276,40 @@
 
 
 __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 => {



More information about the open-ils-commits mailing list