flip sense of spending limit check
authorgmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 3 Nov 2010 19:56:43 +0000 (19:56 +0000)
committergmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 3 Nov 2010 19:56:43 +0000 (19:56 +0000)
Testing showed users expecting that the limit would
be based on amount spent, not the amount available
to send.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18591 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm

index c8db485..6b5777f 100644 (file)
@@ -768,8 +768,7 @@ sub fund_exceeds_balance_percent {
 
         if ( 
             $allocations == 0 || # if no allocations were ever made, assume we have hit the stop percent
-            ((($balance - $debit_amount) / $allocations) * 100) <
-                $fund->$method_name
+            (($allocations - $balance + $debit_amount) / $allocations) * 100) > $fund->$method_name
         ) {
             $logger->info("fund would hit a limit: " . $fund->id . ", $balance, $debit_amount, $allocations, $method_name");
             $e->event(