http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=4438

Fred P <fred.pie...@smfpl.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |fred.pie...@smfpl.org
         Resolution|FIXED                       |

--- Comment #10 from Fred P <fred.pie...@smfpl.org> 2012-01-12 21:35:10 UTC ---
This bug remained unresolved for us, and we traced the problem to an error in
the floating point calculation. We are using Koha 3.5. The process is the same
as that described in the initial filing:

We edit a fund, in our case, changing the fund name. Even though we did not
change the fund total, we get a "budget total exceeds period allocation" error. 

aqbudgets.pl pulls totals from the acq.js script, that in turn calls on the
check_parent_total.pl script. 

check_parent_total.pl runs a comparison between the fund total that is
submitted in the aqbudgets.pl edit screen, and the unallocated amount left from
the budget_period_total. They will usually be equivalent.

However somewhere in the process a floating point error is being generated,
making the total a tiny bit greater than the unallocated amount, locking the
budget fund for editing by generating the error (returncode=2), as listed
above.

A simple solution is to multiply the values on both sides of the comparison by
100, and truncate the decimal places. Here is our suggested solution that
solves the problem:

File: check_parent_total.pl
Line around 103

if ( $parent_id) {
   if ( ($total > $sub_unalloc ) && $sub_unalloc )  {
       $returncode = 1;
   }
} elsif ( ( floor($total*100) > floor($budget_period_unalloc*100)) &&
$budget_period_unalloc ) {
   $returncode = 2;

} else {
   $returncode = 0;
}

-- 
Configure bugmail: 
http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to