[open-ils-commits] r8775 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Feb 19 11:43:12 EST 2008
Author: erickson
Date: 2008-02-19 11:12:55 -0500 (Tue, 19 Feb 2008)
New Revision: 8775
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
Log:
now requiring piclist_entry option, copying over picklist entry attrs at line item create time
Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2008-02-19 15:45:18 UTC (rev 8774)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2008-02-19 16:12:55 UTC (rev 8775)
@@ -568,14 +568,15 @@
$e->allowed('MANAGE_PURCHASE_ORDER', undef, $po);
}
- if($$options{picklist_entry}) {
- # if a picklist_entry ID is provided, use that as the basis for this item
- my $ple = $e->retrieve_acq_picklist_entry($$options{picklist_entry})
- or return $e->die_event;
- $po_li->marc($ple->marc);
- $po_li->eg_bib_id($ple->eg_bib_id);
- }
+ # if a picklist_entry ID is provided, use that as the basis for this item
+ my $ple = $e->retrieve_acq_picklist_entry([
+ $$options{picklist_entry},
+ {flesh => 1, flesh_fields => {acqple => ['attributes']}}
+ ]) or return $e->die_event;
+ $po_li->marc($ple->marc);
+ $po_li->eg_bib_id($ple->eg_bib_id);
+
if($po_li->fund) {
# check fund perms if using the non-default fund
my $fund = $e->retrieve_acq_fund($po_li->fund)
@@ -589,6 +590,17 @@
return $e->die_event unless $e->allowed('MANAGE_PROVIDER', $provider->owner, $provider);
$e->create_acq_po_lineitem($po_li) or return $e->die_event;
+
+ for my $plea (@{$ple->attributes}) {
+ # now that we have the line item, copy the attributes over from the picklist entry
+ my $attr = Fieldmapper::acq::po_li_attr->new;
+ $attr->attr_type($plea->attr_type);
+ $attr->attr_value($plea->attr_value);
+ $attr->attr_name($plea->attr_name);
+ $attr->po_lineitem($po_li->id);
+ $e->create_acq_po_li_attr($attr) or return $e->die_event;
+ }
+
$e->commit;
return $po_li->id;
}
More information about the open-ils-commits
mailing list