Fix LP1177916, Cannot activate PO which contains only direct charges collab/dyrcona/lp1177916
authorSteven Chan <schan@sitka.bclibraries.ca>
Sat, 15 Jun 2013 17:06:43 +0000 (13:06 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Sat, 15 Jun 2013 17:24:25 +0000 (13:24 -0400)
We add a safety check in the function
Application/Acq/Order.pm/create_lineitem_list_assets(), which is called
by create_po_assets(), which is the service call initiated by the user
trying to activate a PO.

The safety check prevents the function from processing if there are no
line items specified in the arguments.

P.S. It would be better to stop the sequence of events earlier in the
client, but that will need more coding, which can been done in another
fix.

Signed-off-by: Steven Chan <schan@sitka.bclibraries.ca>
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm

index 7313471..b141a23 100644 (file)
@@ -299,6 +299,9 @@ sub delete_lineitem {
 sub create_lineitem_list_assets {
     my($mgr, $li_ids, $vandelay, $bib_only) = @_;
 
+    # Do not create line items if none are specified
+    return {} unless (scalar(@$li_ids));
+
     if (check_import_li_marc_perms($mgr, $li_ids)) { # event on error
         $logger->error("acq-vl: user does not have permission to import acq records");
         return undef;