[Koha-patches] [PATCH 3/3] bug 3973: make auto-fill button work on budget planning form

Galen Charlton gmcharlt at gmail.com
Wed Feb 17 12:19:50 CET 2010


Also fixed a variety of XHTML validation errors.

Programming note: it is invalid XHTML and can break Javascript
to use element IDs and class names that start with digits.

Signed-off-by: Galen Charlton <gmcharlt at gmail.com>
---
 koha-tmpl/intranet-tmpl/prog/en/js/acq.js          |    6 ++--
 .../prog/en/modules/admin/aqplan.tmpl              |   21 ++++++++-----------
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js
index 0ec1460..4b65f82 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js
@@ -559,7 +559,7 @@ function calcTotalRow(cell) {
 
     var bud_id =  cell.className;
     var val1 =    cell.value;
-    var remainingTotal =   document.getElementById("budget_est_"+bud_id) ;
+    var remainingTotal =   document.getElementById("budget_est_"+bud_id).textContent;
     var remainingNew =0;
     var budgetTotal  =  document.getElementById("budget_tot_"+bud_id ).textContent;
     var arr =  getElementsByClass(bud_id);
@@ -594,10 +594,10 @@ function calcTotalRow(cell) {
 
 function autoFillRow(bud_id) {
 
-    var remainingTotal =   document.getElementById("budget_est_"+bud_id) ;
+    var remainingTotal =   document.getElementById("budget_est_"+bud_id).textContent;
     var remainingNew = new Number;
     var budgetTotal  =  document.getElementById("budget_tot_"+bud_id ).textContent;
-    var arr =  getElementsByClass(bud_id);
+    var arr =  getElementsByClass("plan_entry_" + bud_id);
 
     budgetTotal   =  budgetTotal.replace(/\,/, "");
     var qty = new Number;
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 37dc0c5..c2c6b55 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl
@@ -1,6 +1,6 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
 <title>
-Budget planning
+Budget &amp; fund planning
 </title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
@@ -13,11 +13,11 @@ Budget planning
 <script  src="<!-- TMPL_VAR NAME="yuipath" -->/event/event.js" type="text/javascript"></script>
 <script  src="<!-- TMPL_VAR NAME="yuipath" -->/dom/dom.js" type="text/javascript"></script>
 <script  src="<!-- TMPL_VAR NAME="yuipath" -->/menu/menu.js" type="text/javascript"></script>
-<script  src="<!-- TMPL_VAR NAME="yuipath" -->/container/menu.js" type="text/javascript"></script>
 <script  src="<!-- TMPL_VAR NAME="yuipath" -->/yahoo-dom-event/yahoo-dom-event.js"  type="text/javascript"></script>
 
 <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script>
 <script type="text/javascript">
+//<![CDATA[
 // ---------------------------------------------------------------------
 // Javascript
 // ---------------------------------------------------------------------
@@ -75,12 +75,9 @@ YAHOO.util.Event.onAvailable("popmenu", function () {
 // oMenu.removeItem(2);   // TODO.....
 
 });
-
+//]]>
 </script>
 
-<title>
-Budget & Fund Planning
-</title>
 </head>
 <body>
 <!-- TMPL_INCLUDE NAME="header.inc" -->
@@ -118,7 +115,7 @@ Budget & Fund Planning
     <label for="show_mine">Show my funds only</label>
     </td>
     <td>
-        <label for="authcat_dropbox"  > Select planning type:</label>
+        <label for="authcat"  > Select planning type:</label>
         <!-- TMPL_VAR NAME="authcat_dropbox" -->
         <input type="submit" name="option_submit" value="Select" />
     </td>
@@ -192,7 +189,7 @@ Budget & Fund Planning
             <!--/TMPL_IF -->
 
         <td align='left'><!-- TMPL_VAR NAME="budget_name_indent"--></td>
-        <td align='right'><span id='budget_tot_formatted" -->'><!-- TMPL_VAR NAME="budget_amount_formatted"-->&nbsp;</span>
+        <td align='right'><span id='budget_tot_formatted_<!-- TMPL_VAR NAME="budget_id" -->'><!-- TMPL_VAR NAME="budget_amount_formatted"-->&nbsp;</span>
 
         <!-- NEXT DIV ELEMENT IS USED BY JS FOR CALC-ING AUTO-FILL AND ESTIMATED AMOUNTS -->
         <div style="display:none;" id='budget_tot_<!-- TMPL_VAR NAME="budget_id" -->'><!-- TMPL_VAR NAME="budget_amount"--></div></td>
@@ -212,7 +209,7 @@ Budget & Fund Planning
                     <!-- TMPL_VAR NAME="estimated_amount" -->&nbsp;
                     <input type="hidden" style="text-align: right;"  name='<!-- TMPL_VAR NAME="cell_name"-->' value="<!-- TMPL_VAR NAME="estimated_amount" -->"   />
                 <!--TMPL_ELSE -->
-                    <input type="text" style="text-align: right;  width:90%; " size='6' name='<!-- TMPL_VAR NAME="cell_name"-->'  value="<!-- TMPL_VAR NAME="estimated_amount" -->"  id='<!-- TMPL_VAR NAME="budget_id"-->' class='<!-- TMPL_VAR NAME="budget_id"-->' onchange="calcTotalRow(this);" />
+                    <input type="text" style="text-align: right;  width:90%; " size='6' name='<!-- TMPL_VAR NAME="cell_name"-->'  value="<!-- TMPL_VAR NAME="estimated_amount" -->"  id='budget_<!-- TMPL_VAR NAME="budget_id"--><!-- TMPL_VAR NAME="colnum"-->' class='plan_entry_<!-- TMPL_VAR NAME="budget_id"-->' onchange="calcTotalRow(this);" />
                 <!--/TMPL_IF -->
 
                 </td></tr>
@@ -235,7 +232,7 @@ Budget & Fund Planning
             <td width="50%"    align="right"  
         <!-- TMPL_IF NAME="est_negative" --> style="color: red;" <!--/TMPL_IF --> 
         <!-- TMPL_IF NAME="est_positive" --> style="color: green;" <!--/TMPL_IF --> 
-        name="est_total" id='budget_est_<!-- TMPL_VAR NAME="budget_id"-->'>  <!-- TMPL_VAR NAME="budget_est_remain"-->&nbsp;    
+        id='budget_est_<!-- TMPL_VAR NAME="budget_id"-->'>  <!-- TMPL_VAR NAME="budget_est_remain"-->&nbsp;    
             </td>
             </tr>
         </table>
@@ -250,7 +247,7 @@ Budget & Fund Planning
         </td>
         </tr>
     <!-- /TMPL_LOOP -->
-    <tbody>
+    </tbody>
     </table>
 
     <!-- TMPL_IF NAME="show_actual" -->
@@ -281,7 +278,7 @@ Budget & Fund Planning
 <form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
 <fieldset class="rows">
     <ol>
-    <li><label for="outputfile">Output to a file named: </label><input type="text" name="basename" id="basename" value="Export" />
+    <li><label for="basename">Output to a file named: </label><input type="text" name="basename" id="basename" value="Export" />
     <label class="inline" for="MIME">Into an application
     </label><!-- TMPL_VAR NAME="CGIextChoice" -->
     <!-- TMPL_VAR NAME="CGIsepChoice" --> &nbsp;&nbsp;&nbsp;
-- 
1.6.3.3




More information about the Koha-patches mailing list