[open-ils-commits] r17263 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Aug 19 10:22:30 EDT 2010
Author: erickson
Date: 2010-08-19 10:22:28 -0400 (Thu, 19 Aug 2010)
New Revision: 17263
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
Log:
automatically create lineitem assets (i.e. load bibs and items) during po activation when necessary since activation requires it; only do this during non-dry-run calls
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm 2010-08-19 14:22:27 UTC (rev 17262)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm 2010-08-19 14:22:28 UTC (rev 17263)
@@ -2191,11 +2191,24 @@
update_purchase_order($mgr, $po) or return $e->die_event;
my $query = [
- {purchase_order => $po_id, state => 'pending-order'},
+ {
+ purchase_order => $po_id,
+ '-or' => [{state => 'pending-order'}, {state => 'new'}]
+ },
{limit => 1}
];
- while( my $li = $e->search_acq_lineitem($query)->[0] ) {
+ while( my $li_id = $e->search_acq_lineitem($query, {idlist => 1})->[0] ) {
+
+ my $li;
+ if($dry_run) {
+ $li = $e->retrieve_acq_lineitem($li_id);
+ } else {
+ # can't activate a PO w/o assets. Create lineitem assets as necessary
+ my $data = create_lineitem_assets($mgr, $li_id) or return $e->die_event;
+ $li = $data->{li};
+ }
+
$li->state('on-order');
create_lineitem_debits($mgr, $li, $dry_run) or return $e->die_event;
update_lineitem($mgr, $li) or return $e->die_event;
More information about the open-ils-commits
mailing list