From: erickson Date: Tue, 9 Feb 2010 03:22:26 +0000 (+0000) Subject: don't allow creation of PO's against inactive providers X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2ca3a5fdb79122f0f0bff2829b98ad845b7a8e60;p=evergreen%2Fpines.git don't allow creation of PO's against inactive providers git-svn-id: svn://svn.open-ils.org/ILS/trunk@15478 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm index c8d0986bf1..1b7cbebecd 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm @@ -978,6 +978,14 @@ sub upload_records { } 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 @@ sub create_purchase_order_api { 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;