LP#1198465 fine generator billing sort repairs. collab/dbwells/1198465_cstore_fines_gen_rebase
authorBill Erickson <berickxx@gmail.com>
Fri, 20 Feb 2015 20:33:35 +0000 (15:33 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 20 Feb 2015 20:35:54 +0000 (15:35 -0500)
1. cstore expects order_by's to be delineated by object class

2. CStoreEditor requires all params that are passed through to cstore to
be contained within the first parameter to a search_*, etc. calls, so
wrap the query and order_by clauses in an array.

Without these changes, the fine generator would generate duplicate
billings when voided billings were present.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm

index 2c47c4c..19b2787 100644 (file)
@@ -451,12 +451,12 @@ sub generate_fines {
                 " (user ".$c->usr.").\n".
                 "\tItem was due on or before: ".localtime($due)."\n") if $conn;
     
-            my @fines = @{$e->search_money_billing(
+            my @fines = @{$e->search_money_billing([
                 { xact => $c->id,
                   btype => 1,
                   billing_ts => { '>' => $c->$due_date_method } },
-                { order_by => 'billing_ts DESC'}
-            )};
+                { order_by => {mb => 'billing_ts DESC'}}
+            ])};
 
             my $f_idx = 0;
             my $fine = $fines[$f_idx] if (@fines);