Bugzilla – Attachment 3654 Details for
Bug 5946
Acquisitions: Budget planning does not total correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
signed-off squashed patch
0001-Bug-5946-MT1177-aqplan.pl-fix-the-problem-of-calcula.patch (text/plain), 3.60 KB, created by
Paul Poulain
on 2011-04-05 09:23:05 UTC
(
hide
)
Description:
signed-off squashed patch
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2011-04-05 09:23:05 UTC
Size:
3.60 KB
patch
obsolete
>From 223ec7662b1f85d2ef1e427abe3a9fa3c6d62c22 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Fri, 14 May 2010 17:07:55 +0200 >Subject: [PATCH] Bug 5946 : (MT1177) aqplan.pl, fix the problem of calculating the total remaining. > >Bug 5946 followup : (MT1236) aqplan.pl - Fixe the problem of unrounded sums > >Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> >--- > koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 21 +++++++++++++------ > .../prog/en/modules/admin/aqplan.tmpl | 2 +- > 2 files changed, 15 insertions(+), 8 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js >index b5ec994..1b924a2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js >@@ -557,12 +557,14 @@ function getElementsByClass( searchClass, domNode, tagName) { > > function calcTotalRow(cell) { > >- var bud_id = cell.className; >+ var string = cell.name; >+ var pos = string.indexOf(",", 0); >+ var bud_id = string.substring(0, pos); > var val1 = cell.value; >- var remainingTotal = document.getElementById("budget_est_"+bud_id).textContent; >+ var remainingTotal = document.getElementById("budget_est_"+bud_id); > var remainingNew =0; > var budgetTotal = document.getElementById("budget_tot_"+bud_id ).textContent; >- var arr = getElementsByClass(bud_id); >+ var arr = getElementsByClass(cell.className); > > budgetTotal = budgetTotal.replace(/\,/, ""); > >@@ -594,7 +596,7 @@ function calcTotalRow(cell) { > > function autoFillRow(bud_id) { > >- var remainingTotal = document.getElementById("budget_est_"+bud_id).textContent; >+ var remainingTotal = document.getElementById("budget_est_"+bud_id); > var remainingNew = new Number; > var budgetTotal = document.getElementById("budget_tot_"+bud_id ).textContent; > var arr = getElementsByClass("plan_entry_" + bud_id); >@@ -602,20 +604,25 @@ function autoFillRow(bud_id) { > budgetTotal = budgetTotal.replace(/\,/, ""); > var qty = new Number; > // get the totals >+ var novalueArr = new Array(); > for ( var i=0, len=arr.length; i<len; ++i ) { > remainingNew += Math.abs (arr[i].value ); > > if ( arr[i].value == 0 ) { >+ novalueArr[qty] = arr[i]; > qty += 1; > } > } > > remainingNew = Math.abs( budgetTotal) - remainingNew ; > var newCell = new Number (remainingNew / qty); >+ var rest = new Number (remainingNew - (newCell.toFixed(2) * (novalueArr.length - 1))); > >- for ( var i=0, len=arr.length; i<len; ++i ) { >- if ( Math.abs(arr[i].value) == 0 ) { >- arr[i].value = newCell.toFixed(2) ; >+ for (var i = 0; i<novalueArr.length; ++i) { >+ if (i == novalueArr.length - 1) { >+ novalueArr[i].value = rest.toFixed(2); >+ }else { >+ novalueArr[i].value = newCell.toFixed(2); > } > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl >index 0472c5e..61048ce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl >@@ -88,7 +88,7 @@ YAHOO.util.Event.onAvailable("popmenu", function () { > > <form method="post" id="Aform" name="Aform" action="/cgi-bin/koha/admin/aqplan.pl"> > <h3>Planning for <!-- TMPL_VAR NAME="budget_period_description" --> by <!-- TMPL_VAR NAME="authcat" --></h3> >- >+<input type="hidden" name="authcat" value="<!-- TMPL_VAR NAME="authcat" -->" /> > <!-- Budget Lines --> > > <!-- TMPL_IF NAME="budget_lines" --> >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5946
:
3421
|
3422
|
3653
| 3654