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

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Feb 8 22:22:28 EST 2010


Author: erickson
Date: 2010-02-08 22:22:26 -0500 (Mon, 08 Feb 2010)
New Revision: 15478

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
Log:
don't allow creation of PO's against inactive providers

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm	2010-02-09 01:44:42 UTC (rev 15477)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm	2010-02-09 03:22:26 UTC (rev 15478)
@@ -978,6 +978,14 @@
     }
 
     if($create_po) {
+
+        # verify the provider is still active
+        unless($U->is_true($provider->active)) {
+            $logger->error("provider is not active.  cannot create PO");
+            $e->rollback;
+            return OpenILS::Event->new('ACQ_PROVIDER_INACTIVE');
+        }
+
         $po = create_purchase_order($mgr, 
             ordering_agency => $ordering_agency,
             provider => $provider->id,
@@ -1290,6 +1298,14 @@
     return $e->die_event unless $e->allowed('CREATE_PURCHASE_ORDER', $po->ordering_agency);
     my $mgr = OpenILS::Application::Acq::BatchManager->new(editor => $e, conn => $conn);
 
+    # verify the provider is still active
+    my $provider = $e->retrieve_acq_provider($po->provider) or return $e->die_event;
+    unless($U->is_true($provider->active)) {
+        $logger->error("provider is not active.  cannot create PO");
+        $e->rollback;
+        return OpenILS::Event->new('ACQ_PROVIDER_INACTIVE');
+    }
+
     # create the PO
     my %pargs = (ordering_agency => $e->requestor->ws_ou); # default
     $pargs{provider} = $po->provider if $po->provider;



More information about the open-ils-commits mailing list