Bug 14790 - Add OPAC view link to items editor
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / pendingreserves.tt
index c79a231..7bb77c8 100644 (file)
@@ -1,24 +1,46 @@
+[% USE KohaDates %]
+[% USE AuthorisedValues %]
+[%- USE Branches -%]
+[%- USE ItemTypes -%]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Circulation &rsaquo; Holds to pull</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<!-- Additions to enable Calendar system -->
-<link rel="stylesheet" type="text/css" href="[% themelang %]/lib/calendar/calendar-system.css" />
-<!-- End of additions --><!-- Additions to enable Calendar system -->
-<script type="text/javascript" src="[% themelang %]/lib/calendar/calendar.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/calendar/calendar-en.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/calendar/calendar-setup.js"></script>
+[% INCLUDE 'calendar.inc' %]
 <!-- Plugin datatables -->
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
-<script type="text/JavaScript" language="JavaScript">
+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
+[% INCLUDE 'datatables.inc' %]
+<script type="text/JavaScript">
 //<![CDATA[
 $(document).ready(function() {
   var holdst = $("#holdst").dataTable($.extend(true, {}, dataTablesDefaults, {
+    "aoColumnDefs": [
+        { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
+        { "sType": "title-string", "aTargets" : [ "title-string" ] },
+        { "sType": "string", "aTargets": [ "string-sort" ] } //Target columns that use <br> separators and pull-down menus.
+    ],
+    "sPaginationType": "full_numbers"
   }));
   holdst.fnAddFilters("filter");
+  [%# add separateData function to cleanse jQuery select lists by breaking apart strings glued with BR tags and then de-duplicating any repeated library codes %]
+  function separateData ( ColumnData ){
+    var cD = ColumnData;
+    var new_array = new Array();
+    for ( j=0 ; j<cD.length ; j++ ) {
+        var split_array = cD[j].split(/<br>/gi);
+        for ( k=0 ; k<split_array.length ; k++ ){
+            var str = $.trim(split_array[k].replace(/[\n\r]/g, ''));
+            if ($.inArray(str, new_array) == -1 && str.length > 0 ) {
+                new_array.push(str);
+            }
+        }
+    }
+    new_array.sort();
+    return new_array;
+  }
+  [%# add SeparateData function into createSelect function, so that it does the createSelect on clean data %]
   function createSelect( data ) {
-      var r='<select style="width:99%"><option value="">None</option>', i, len=data.length;
+      data = separateData(data);
+      var r='<select style="width:99%"><option value="">' + _("None") + '</option>', i, len=data.length;
       for ( i=0 ; i<len ; i++ ) {
           r += '<option value="'+data[i]+'">'+data[i]+'</option>';
       }
@@ -27,7 +49,8 @@ $(document).ready(function() {
   $("#homebranchfilter").each( function () {
       $(this).html( createSelect( holdst.fnGetColumnData(4) ) );
       $('select', this).change( function () {
-          holdst.fnFilter( $(this).val(), 4 );
+          var filter_value = $(this).val();
+          holdst.fnFilter( filter_value, 4, true );
       } );
   } );
   $("#itypefilter").each( function () {
@@ -59,9 +82,9 @@ $(document).ready(function() {
     <div id="yui-main">
     <div class="yui-b">
 
-<h2>Holds to pull[% IF ( run_report ) %] placed between [% from %] and [% to %][% END %]</h2>
+<h2>Holds to pull[% IF ( run_report ) %] placed between [% from | $KohaDates %] and [% to | $KohaDates %][% END %]</h2>
 [% IF ( run_report ) %]
-<h3>Reported on [% todaysdate %]</h3>
+<h3>Reported on [% todaysdate | $KohaDates %]</h3>
 <p>The following holds have not been filled. Please retrieve them and check them in.</p>
 <div class="searchresults">
     [% IF ( reserveloop ) %]
@@ -71,14 +94,14 @@ $(document).ready(function() {
         <th>Pull this many items</th>
         <th>Items available</th>
         <th>Patrons with holds</th>
-        <th>Title</th>
-        <th>Libraries</th>
+        <th class="anti-the">Title</th>
+        <th class="string-sort">Libraries</th>
         <th>Available call numbers</th>
-        <th>Available copy No</th>
+        <th>Available copy numbers</th>
         <th>Available enumeration</th>
-        <th>Available itypes</th>
-        <th>Available locations</th>
-        <th>Earliest hold date</th>
+        <th class="string-sort">Available itypes</th>
+        <th class="string-sort">Available locations</th>
+        <th class="title-string">Earliest hold date</th>
         </tr>
     </thead>
     <tbody>
@@ -90,10 +113,9 @@ $(document).ready(function() {
             <td>[% reserveloo.rcount %]</td>
             <td>
             <p>
-        [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
-                    [% reserveloo.title |html %]
-                </a> [% IF ( reserveloo.author ) %]<p> by [% reserveloo.author %]</p>[% END %]
-            </p>
+                [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
+                [% reserveloo.title |html %]</a></p>
+                [% IF ( reserveloo.author ) %]<p> by [% reserveloo.author %]</p>[% END %]
             </td>
         [% ELSE %]
             <td>"</td>
@@ -101,16 +123,27 @@ $(document).ready(function() {
             <td>"</td>
             <td>"</td>
         [% END %]
-        <td>[% reserveloo.holdingbranch %]</td>
+        <td>
+            [% FOREACH holdingbranch IN reserveloo.holdingbranches %]
+                [% Branches.GetName ( holdingbranch ) %]<br>
+            [% END %]
+        </td>
         <td><p>[% reserveloo.itemcallnumber %]</p></td>
         <td><p>[% reserveloo.copyno %]</p></td>
         <td><p>[% reserveloo.enumchron %]</p></td>
-        <td>[% reserveloo.itype %]</td>
-        <td>[% reserveloo.location %]</td>
-        <td width="15%">
-            <p>[% reserveloo.reservedate %]</p>
-            <p>in [% reserveloo.branch %]</p>
-            [% IF ( reserveloo.statusw ) %]<p>Waiting</p>[% END %][% IF ( reserveloo.statusf ) %]<p>Fullfilled</p>[% END %]
+        <td>
+        [% FOREACH itype IN reserveloo.itypes %]
+            [% ItemTypes.GetDescription( itype ) %]
+        [% END %]
+        </td>
+        <td>
+        [% FOREACH loc IN reserveloo.locations %]
+            [% AuthorisedValues.GetByCode('LOC', loc) %]<br>
+        [% END %]
+        </td>
+        <td>
+            <span title="[% reserveloo.reservedate %]">[% reserveloo.reservedate | $KohaDates %] in [% Branches.GetName ( reserveloo.branch ) %]</span>
+            [% IF ( reserveloo.statusw ) %]<p>Waiting</p>[% END %][% IF ( reserveloo.statusf ) %]<p>Fulfilled</p>[% END %]
         </td>
         </tr>
         [% END %]
@@ -150,68 +183,15 @@ $(document).ready(function() {
 <label for="from">
     Start date:
 </label>
-<input type="text" size="10" id="from" name="from" value="[% from %]" />
-<img src="[% themelang %]/lib/calendar/cal.gif"  border="0" id="openCalendarFrom" style="cursor: pointer;" alt="" />
-<script language="JavaScript" type="text/javascript">
-function validate1(date) {
-    var day = date.getDate();
-    var month = date.getMonth() + 1;
-    var year = date.getFullYear();
-    var weekDay = date.getDay();
-    var dayMonth = month + '-' + day;
-    var dateString = year + '-' + month + '-' + day;
-    var dateTo = document.getElementById('to').value.split("-");
-    var limitDate = new Date(dateTo[0], (dateTo[1] - 1), dateTo[2]);
-    if (date > limitDate) {
-            return true;
-    } else {
-            return false;
-    }
-}
-Calendar.setup(
-        {
-        inputField : "from",
-        ifFormat : "[% DHTMLcalendar_dateformat %]",
-        button : "openCalendarFrom",
-        disableFunc : validate1,
-        dateStatusFunc : validate1
-        }
-);
-</script></li>
+<input type="text" size="10" id="from" name="from" value="[% from | $KohaDates %]" class="datepickerfrom" />
+</li>
 <li><label for="to">
     End date:
 </label>
-<input size="10" id="to" name="to" value="[% to %]" type="text" />
-<img src="[% themelang %]/lib/calendar/cal.gif" alt="" id="openCalendarTo" style="cursor: pointer;" border="0" />
-<script type="text/javascript">
-        function validate2(date) {
-            var day = date.getDate();
-            var month = date.getMonth() + 1;
-            var year = date.getFullYear();
-            var weekDay = date.getDay();
-            var dayMonth = month + '-' + day;
-            var dateString = year + '-' + month + '-' + day;
-            var dateFrom = document.getElementById('from').value.split("-");
-            var limitDate = new Date(dateFrom[0], (dateFrom[1] - 1), dateFrom[2]);
-            if (limitDate > date) {
-                    return true;
-            } else {
-                    return false;
-            }
-        }
-
-        Calendar.setup(
-                {
-                    inputField : "to",
-                    ifFormat : "[% DHTMLcalendar_dateformat %]",
-                    button : "openCalendarTo",
-                    disableFunc : validate2,
-                    dateStatusFunc : validate2
-                }
-        );
-</script></li>
+<input type="text" size="10" id="to" name="to" value="[% to | $KohaDates %]" class="datepickerto" />
+</li>
 </ol>
-<p><i>(Inclusive, default is two days ago to today, set other date ranges as needed. )</i></p>
+<p><i>(Inclusive, default is [% HoldsToPullStartDate %] days ago to [% IF ( HoldsToPullEndDate ) %][% HoldsToPullEndDate %] days ahead[% ELSE %]today[% END %], set other date ranges as needed. )</i></p>
 <fieldset class="action"><input type="submit" name="run_report" value="Submit" class="submit"/></fieldset>
 </fieldset>
 </form>