[open-ils-commits] r12530 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Mar 15 22:41:11 EDT 2009


Author: erickson
Date: 2009-03-15 22:41:09 -0400 (Sun, 15 Mar 2009)
New Revision: 12530

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
Log:
provide option to return new lineitems and associated attrs from search call

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm	2009-03-15 14:11:06 UTC (rev 12529)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm	2009-03-16 02:41:09 UTC (rev 12530)
@@ -288,7 +288,7 @@
     }
 
     # remove any picklist-specific object perms
-    my $ops = $e->search_permission_usr_object_perm_map({object_type => 'acqpl', object_id => $picklist->id});
+    my $ops = $e->search_permission_usr_object_perm_map({object_type => 'acqpl', object_id => "".$picklist->id});
     for my $op (@$ops) {
         $e->delete_usr_object_perm_map($op) or return $e->die_event;
     }
@@ -409,12 +409,13 @@
 );
 
 sub zsearch {
-    my($self, $conn, $auth, $search, $name) = @_;
+    my($self, $conn, $auth, $search, $name, $options) = @_;
     my $e = new_editor(authtoken=>$auth, xact=>1);
     return $e->die_event unless $e->checkauth;
     return $e->die_event unless $e->allowed('CREATE_PICKLIST');
 
     $search->{limit} ||= 10;
+    $options ||= {};
 
     $name ||= '';
     my $picklist = $e->search_acq_picklist({owner=>$e->requestor->id, name=>$name})->[0];
@@ -453,7 +454,17 @@
             $li->marc($rec->{marcxml});
             $li->eg_bib_id($rec->{bibid}) if $rec->{bibid};
             $e->create_acq_lineitem($li) or return $e->die_event;
-            $conn->respond({total=>$total, progress=>++$ctr});
+
+            my $response = {total => $total, progress => ++$ctr};
+
+            if($$options{respond_li}) {
+                $response->{lineitem} = $li;
+                $li->attributes($e->search_acq_lineitem_attr({lineitem => $li->id}))
+                    if $$options{flesh_attrs};
+                $li->clear_marc if $$options{clear_marc};
+            }
+
+            $conn->respond($response);
         }
     }
 



More information about the open-ils-commits mailing list