Summary: | incorrect "Budget total exceeds period allocation" error when editing fund | ||
---|---|---|---|
Product: | Koha | Reporter: | Galen Charlton <gmcharlt> |
Component: | Acquisitions | Assignee: | dev_patches |
Status: | CLOSED FIXED | QA Contact: | Bugs List <koha-bugs> |
Severity: | major | ||
Priority: | PATCH-Sent (DO NOT USE) | CC: | chris, dev_patches, fred.pierre, julian.maurice, robin |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
URL: | admin/check_parent_total.pl | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
fix the ajax calculation
patch proposed should work for 3.2. patch appliable for master followup proposed |
Description
Chris Cormack
2010-05-21 01:27:11 UTC
You are still prevented from editing funds in Koha version 3.01.00.142. I think this is a big problem, as libraries will want to change amounts, expenditure, encumbrance, etc. After you start ordering you can't just delete your fund structure and start over to make such a correction. Created attachment 2981 [details] [review] fix the ajax calculation Created attachment 2982 [details] [review] patch proposed should work for 3.2. Created attachment 2983 [details] [review] patch appliable for master Pushed, please test This bug is mentioned in: Bug 4438: incorrect "Budget total exceeds period allocation" error when editing fund http://lists.koha-community.org/pipermail/koha-patches/2011-January/013592.html Bug 4438: incorrect "Budget total exceeds period allocation" error when editing fund http://lists.koha-community.org/pipermail/koha-patches/2011-January/013593.html Bug 4438: incorrect "Budget total exceeds period allocation" error when editing fund http://lists.koha-community.org/pipermail/koha-patches/2011-January/013594.html Bug 4438: incorrect "Budget total exceeds period allocation" error when editing fund http://lists.koha-community.org/pipermail/koha-patches/2011-January/013595.html Created attachment 3184 [details] [review] followup proposed Follow up patch needs signoff Follow up patch pushed, please test and mark resolved 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; } Hi Fred, can you give me a test plan to reproduce the problem? I checked the lines you mention on current master and they seem unchanged. But I am not sure the problem is still there. 99 if ( $parent_id) { 100 if ( ($total > $sub_unalloc ) && $sub_unalloc ) { 101 $returncode = 1; 102 } 103 } elsif ( ( $total > $budget_period_unalloc ) && $budget_period_unalloc ) { 104 $returncode = 2; 105 106 } else { 107 $returncode = 0; 108 } There have been no further reports of problems so I am marking this bug resolved. |