Fix for Bug 5051, Renewal due date doesn't always show on patron Checkout tab
authorOwen Leonard <oleonard@myacpl.org>
Sat, 13 Nov 2010 03:00:26 +0000 (22:00 -0500)
committerChris Cormack <chrisc@catalyst.net.nz>
Mon, 29 Nov 2010 19:38:43 +0000 (08:38 +1300)
Display of the renewal date footer in the template was conditional upon
the existence of checkouts from today.

In order to fix this bug it was necessary to repeat the markup for the
table footer twice in the template, so I created an include file for it.
The same include file can now be used in moremember.tmpl.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc
new file mode 100644 (file)
index 0000000..5d05b94
--- /dev/null
@@ -0,0 +1,25 @@
+<tfoot>
+       <tr>
+               <td colspan="5" style="text-align: right; font-weight:bold;">Totals:</td>
+               <td><!-- TMPL_VAR NAME="totaldue" --></td>
+               <td><!-- TMPL_VAR NAME="totalprice" --></td>
+               <td colspan="2">
+                       <p>Renewal due date: <input type="text" size="8" id="newduedate" name="newduedate" value="<!-- TMPL_VAR Name="newduedate" -->" />
+                       <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="newduedate_button" alt="Show Calendar" />
+                       <script type="text/javascript"> //<![CDATA[
+                       //#TODO - ADD syspref (AllowPostDatedCheckouts).
+                        Calendar.setup(
+                             {
+                                inputField : "newduedate",
+                                ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+                                button : "newduedate_button",
+                                disableFunc : validate1,
+                                dateStatusFunc : validate1,
+                              }
+                           );
+                       //]]>
+                       </script></p>
+                       <p><label>Forgive fines on return: <input type="checkbox" name="exemptfine" value="1" /></label></p>
+               </td>
+       </tr>
+</tfoot>
\ No newline at end of file
index 46e2dc8..80def78 100644 (file)
@@ -167,7 +167,7 @@ function refocus(calendar) {
     </li>
     <!-- TMPL_IF NAME="canned_bor_notes_loop" -->
         <li>
-                <label for="canned_notes">Predefined notes: </label>
+                <label for="type">Predefined notes: </label>
                 <select name="type" id="type" onchange="this.form.borrower_message.value=this.options[this.selectedIndex].value;">
                     <option value="">Select Note</option>
                     <!-- TMPL_LOOP NAME="canned_bor_notes_loop" -->
@@ -184,7 +184,7 @@ function refocus(calendar) {
         <input type="submit" value="Save" /> <a href="#" class="cancel">Cancel</a>
     </fieldset>
 
-        <input type="hidden" name="borrowernumber" id="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
+        <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
         <input type="hidden" name="branchcode" value="<!-- TMPL_VAR NAME="branch" -->" />
 </fieldset>
 </form>
@@ -633,36 +633,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
         <th scope="col">Check in <p class="column-tool"><a href="#" id="CheckAllreturns">select all</a> | <a href="#" id="CheckNoreturns">none</a></p></th>
     </tr>
 <!-- TMPL_IF NAME="todayissues" --></thead>
-<tfoot>
-               <tr>
-            <td colspan="5" style="text-align: right; font-weight:bold;">Totals:</td>
-                       <td><!-- TMPL_VAR NAME="totaldue" --></td>
-            <td><!-- TMPL_VAR NAME="totalprice" --></td>
-            <td colspan="2">      
-                <p>
-                    Renewal due date: <input type="text" size="8" id="newduedate" name="newduedate" value="<!-- TMPL_VAR Name="newduedate" -->" />
-                    <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="newduedate_button" alt="Show Calendar" />
- <script type="text/javascript"> //<![CDATA[
-                               //#TODO - ADD syspref (AllowPostDatedCheckouts).
-                     Calendar.setup(
-                          {
-                             inputField : "newduedate",
-                             ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
-                             button : "newduedate_button",
-                             disableFunc : validate1,
-                             dateStatusFunc : validate1,
-                             onClose : refocus
-                           }
-                        );
-                               //]]>
-                                </script>
-                </p>
-                <p>
-                    <label>Forgive fines on return: <input type="checkbox" name="exemptfine" value="1" /></label>
-                </p>
-            </td>
-        </tr>
-               </tfoot>
+<!-- TMPL_INCLUDE NAME="checkouts-table-footer.inc" -->
        <tbody>
 
     <!-- TMPL_LOOP NAME="todayissues" -->
@@ -725,6 +696,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
 <!-- TMPL_IF NAME="previssues" -->
 <!-- TMPL_IF NAME="todayissues" --><tr><th colspan="10"><a name="previous" id="previous"></a>Previous checkouts</th></tr><!-- TMPL_ELSE -->
 <tr><th class="{sorter: false}" colspan="10"><a name="previous" id="previous"></a>Previous checkouts</th></tr></thead>
+<!-- TMPL_INCLUDE NAME="checkouts-table-footer.inc" -->
        <tbody>
 <!-- /TMPL_IF -->
     <!-- TMPL_LOOP NAME="previssues" -->
index 5f3bbba..d34fc62 100644 (file)
@@ -89,7 +89,14 @@ if (nodename =="barcodes[]"){
    }   
 }
 }
-
+function validate1(date) {
+    var today = new Date();
+    if ( date < today ) {
+        return true;
+     } else {
+        return false;
+     }
+};
 //]]>
 </script>
 
@@ -404,32 +411,7 @@ if (nodename =="barcodes[]"){
             <th scope="col">Renew <p class="column-tool"><a href="#" id="CheckAllitems">select all</a> | <a href="#" id="CheckNoitems">none</a></p></th>
             <th scope="col">Check in <p class="column-tool"><a href="#" id="CheckAllreturns">select all</a> | <a href="#" id="CheckNoreturns">none</a></p></th>
         </tr></thead>
-       <tfoot>
-               <tr>
-            <td colspan="5" style="text-align: right; font-weight:bold;">Totals:</td>
-                       <td><!-- TMPL_VAR NAME="totaldue" --></td>
-            <td><!-- TMPL_VAR NAME="totalprice" --></td>
-            <td colspan="2">      
-                <p>
-                    Renewal due date: <input type="text" size="8" id="newduedate" name="newduedate" value="<!-- TMPL_VAR Name="newduedate" -->" />
-                    <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="newduedate_button" alt="Show Calendar" />
-                    <script type="text/javascript">
-                        //<![CDATA[
-                        Calendar.setup({
-                            inputField : "newduedate",
-                            ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
-                            button : "newduedate_button"
-                        });
-                        //]]>
-                    </script>
-                               <span style="display:block;color:#666;font-weight:normal;font-size:90%;"><!-- TMPL_INCLUDE NAME="date-format.inc" --></span>
-                </p>
-                <p>
-                    <label>Forgive fines on return: <input type="checkbox" name="exemptfine" value="1" /></label>
-                </p>
-            </td>
-        </tr>
-               </tfoot>
+        <!-- TMPL_INCLUDE NAME="checkouts-table-footer.inc" -->
        <tbody>
        <!-- TMPL_LOOP name="issueloop" -->