From: erickson Date: Tue, 19 Feb 2008 16:12:55 +0000 (+0000) Subject: now requiring piclist_entry option, copying over picklist entry attrs at line item... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3830f712828e281a016aecc0fcc27f0c013f771d;p=Evergreen.git now requiring piclist_entry option, copying over picklist entry attrs at line item create time git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8775 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm index 7755fc147f..f932264a02 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm @@ -568,13 +568,14 @@ sub create_po_lineitem { $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 @@ -589,6 +590,17 @@ sub create_po_lineitem { 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; }