my $po = $e->retrieve_acq_purchase_order($po_id) or return $e->event;
return $e->event unless $e->allowed('VIEW_PURCHASE_ORDER', $po->ordering_agency);
+ # KCLS ---
+ # Add a note to each printed lineitem.
+ $e->xact_begin;
+ my $li_ids = $e->search_acq_lineitem(
+ {purchase_order => $po_id}, {idlist => 1});
+ for my $li_id (@$li_ids) {
+ my $note = Fieldmapper::acq::lineitem_note->new;
+ $note->lineitem($li_id);
+ $note->creator($e->requestor->id);
+ $note->editor($e->requestor->id);
+ $note->value('printed: ' . $e->requestor->usrname);
+ $e->create_acq_lineitem_note($note) or return $e->die_event;
+ }
+ $e->commit;
+ # ---
+
my $hook = "format.po.$format";
return $U->fire_object_event(undef, $hook, $po, $po->ordering_agency);
}
if ($entry->isnew) {
$e->create_acq_invoice_entry($entry) or return $e->die_event;
+ return $evt if $evt = create_li_invoice_note($e, $entry);
return $evt if $evt = uncancel_copies_as_needed($e, $entry);
return $evt if $evt = update_entry_debits(
$e, $entry, 'unlinked', $inv_closing, $inv_reopening);
return undef;
}
+# adds a note to the lineitem linked to the selected entry
+# indicating the lineitem was invoiced.
+sub create_li_invoice_note {
+ my ($e, $entry) = @_;
+ my $note = Fieldmapper::acq::lineitem_note->new;
+ $note->lineitem($entry->lineitem);
+ $note->creator($e->requestor->id);
+ $note->editor($e->requestor->id);
+ $note->value('invoiced: ' . $e->requestor->usrname);
+ $e->create_acq_lineitem_note($note) or return $e->die_event;
+ return undef;
+}
+
# This was originally done only for EDI invoices, but needs added to the
# manual invoice-entering process for consistency's sake.
sub uncancel_copies_as_needed {