ACQ guarantee no PO re-activation
authorBill Erickson <berick@esilibrary.com>
Fri, 23 Mar 2012 19:17:50 +0000 (15:17 -0400)
committerDan Scott <dan@coffeecode.net>
Sat, 2 Jun 2012 22:31:06 +0000 (18:31 -0400)
Prevent the possibility of double PO activation by preventing it within
the API.  There have been reports in the wild of double-activation, even
though the UI is supposed to prevent it.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Michael Peters <mrpeters@library.in.gov>
Signed-off-by: Dan Scott <dan@coffeecode.net>
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm

index 7272f63..9e25668 100644 (file)
@@ -2328,6 +2328,10 @@ sub activate_purchase_order_impl {
 
     my $po = $e->retrieve_acq_purchase_order($po_id) or return $e->die_event;
     return $e->die_event unless $e->allowed('CREATE_PURCHASE_ORDER', $po->ordering_agency);
+
+    return $e->die_event(OpenILS::Event->new('PO_ALREADY_ACTIVATED'))
+        if $po->order_date; # PO cannot be re-activated
+
     my $provider = $e->retrieve_acq_provider($po->provider);
 
     # find lineitems and create assets for all