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

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jan 7 15:04:39 EST 2011


Author: senator
Date: 2011-01-07 15:04:34 -0500 (Fri, 07 Jan 2011)
New Revision: 19134

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Invoice.pm
Log:
Acq: fix prorating bug

When prorating, the system decides what funds to target by looking at what
funds have already been spent against.  Previously, the system only looked at
acqie objects, but an invoice can also be composed of acqii objects.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Invoice.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Invoice.pm	2011-01-07 14:00:14 UTC (rev 19133)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Invoice.pm	2011-01-07 20:04:34 UTC (rev 19134)
@@ -392,9 +392,16 @@
     my @lid_debits;
     push(@lid_debits, @{find_entry_debits($e, $_, 'f', entry_amount_per_item($_))}) for @{$invoice->entries};
 
+    my $inv_items = $e->search_acq_invoice_item([
+        {"invoice" => $invoice_id, "fund_debit" => {"!=" => undef}},
+        {"flesh" => 1, "flesh_fields" => {"acqii" => ["fund_debit"]}}
+    ]) or return $e->die_event;
+
+    my @item_debits = map { $_->fund_debit } @$inv_items;
+
     my %fund_totals;
     my $total_entry_paid = 0;
-    for my $debit (@lid_debits) {
+    for my $debit (@lid_debits, @item_debits) {
         $fund_totals{$debit->fund} = 0 unless $fund_totals{$debit->fund};
         $fund_totals{$debit->fund} += $debit->amount;
         $total_entry_paid += $debit->amount;



More information about the open-ils-commits mailing list