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

svn at svn.open-ils.org svn at svn.open-ils.org
Mon May 4 17:32:44 EDT 2009


Author: erickson
Date: 2009-05-04 17:32:39 -0400 (Mon, 04 May 2009)
New Revision: 13064

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
Log:
check explicit perm on importing on-order record and only when necessary

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm	2009-05-04 21:30:14 UTC (rev 13063)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm	2009-05-04 21:32:39 UTC (rev 13064)
@@ -218,6 +218,8 @@
 # begins and commit transactions as it goes
 sub create_lineitem_list_assets {
     my($mgr, $li_ids) = @_;
+    return undef if check_asset_create_perms($mgr, $li_ids);
+
     # create the bibs/volumes/copies and ingest the records
     for my $li_id (@$li_ids) {
         $mgr->editor->xact_begin;
@@ -230,6 +232,24 @@
     return 1;
 }
 
+# returns event on error, undef on success
+sub check_import_marc_perms {
+    my($mgr, $li_ids) = @_;
+
+    # if there are any order records that are not linked to 
+    # in-db bib records, verify staff has perms to import order records
+    my $order_li = $mgr->editor->search_acq_lineitem(
+        [{id => $li_ids, eg_bib_id => undef}, {limit => 1}], {idlist => 1})->[0];
+
+    if($order_li) {
+        return $mgr->editor->die_event unless 
+            $mgr->editor->allowed('IMPORT_ACQ_LINEITEM_BIB_RECORD');
+    }
+
+    return undef;
+}
+
+
 # ----------------------------------------------------------------------------
 # if all of the lineitem details for this lineitem have 
 # been received, mark the lineitem as received
@@ -1213,7 +1233,6 @@
     my $mgr = OpenILS::Application::Acq::BatchManager->new(editor => $e, conn => $conn);
 
     my $po = $e->retrieve_acq_purchase_order($po_id) or return $e->die_event;
-    return $e->die_event unless $e->allowed('IMPORT_PURCHASE_ORDER_ASSETS', $po->ordering_agency);
 
     my $li_ids = $e->search_acq_lineitem({purchase_order => $po_id}, {idlist => 1});
 



More information about the open-ils-commits mailing list