Bug 8715: Receive all serials for a year.
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 3 Sep 2012 09:44:21 +0000 (11:44 +0200)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Fri, 30 Nov 2012 12:13:57 +0000 (07:13 -0500)
This patch adds
- 2 links in the table header (select all and clear all).
- Datatable on these tables

Test plan:
Try to select all serials for a year and receive them.
Test there is no regression (ergonomic) on this page

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Bug 8715 [Follow-up] Receiving all serials for a year

Follow-up: For consistency, I would prefer to have the
column of checkboxes at the beginning of the table and the
select/clear links above.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Bug 8715: Force the default sort order to desc

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt
serials/serials-collection.pl

index 3d2e690..94b10cc 100644 (file)
@@ -1,6 +1,10 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Serials &rsaquo; Serial collection information for [% bibliotitle %]</title>
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
 [% INCLUDE 'doc-head-close.inc' %]
+<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" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
 
 <script type="text/javascript">
 //<![CDATA[
@@ -45,10 +49,31 @@ function generateNext(subscriptionid) {
        }
 }
 
+function CheckAll( node ) {
+    $("#"+node).checkCheckboxes();
+    return false;
+}
+function CheckNone( node ) {
+    $("#"+node).unCheckCheckboxes();
+    return false;
+}
 $(document).ready(function() {
     $('#subscription_years').tabs();
+    [% IF dateformatmetric %]
+      dt_add_type_uk_date();
+    [% END %]
+
+    $(".subscription-year-table").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "aoColumnDefs": [
+            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
+        ],
+        "aaSorting": [[0, 'desc']],
+        "bAutoWidth": false,
+        "bPaginate": false,
+        "bInfo": false,
+        "bFilter": false,
+    } ));
 });
 
 //]]>
 </script>
@@ -198,9 +223,16 @@ $(document).ready(function() {
             [% IF ( subscriptions.size == 1 and !serialsadditems ) %]&nbsp;<input type="button" value="Multi receiving" onclick="javascript:generateReceive([% subscriptionidlist %])" />[% END %]
         </p>
     [% END %]
-
-        <table>
-         <tr>
+      <span class="checkall">
+        <a class="CheckAll" href="#" onclick="CheckAll('subscription-year-[% year.year %]'); return false;">Select all</a>
+      </span> |
+      <span class="clearall">
+        <a class="CheckNone" href="#" onclick="CheckNone('subscription-year-[% year.year %]'); return false;">Clear all</a>
+      </span>
+        <table class="subscription-year-table">
+          <thead>
+            <tr>
+                [% IF ( CAN_user_serials_receive_serials ) %]<th>Edit</th>[% END %]
 [% IF ( subscriptions.size > 1 ) %]
                 <th># Subs</th>
 [% END %]
@@ -217,10 +249,28 @@ $(document).ready(function() {
                 <th>Library
                 </th>
                 [% IF ( routing ) %]<th>Routing</th>[% END %]
-                [% IF ( CAN_user_serials_receive_serials ) %]<th>Edit</th>[% END %]
             </tr>
+          </thead>
+          <tbody>
       [% FOREACH serial IN year.serials %]
     [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
+            [% IF ( CAN_user_serials_receive_serials ) %]
+                <td>
+                  [% IF ( serial.cannotedit ) %]
+                    disabled
+                  [% ELSE %]
+                    [% IF ( serial.subscriptionexpired ) %]
+                    <input type="checkbox" name="serialid" value="[% serial.serialid %]" disabled="disabled" />
+                    [% ELSE %]
+                      [% IF ( serial.checked ) %]
+                    <input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid %]" />
+                      [% ELSE %]
+                    <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid %]" />
+                      [% END %]
+                    [% END %]
+                  [% END %]
+                </td>
+            [% END %]
 [% IF ( subscriptions.size > 1 ) %]
                  <td><a href="serials-collection.pl?subscriptionid=[% serial.subscriptionid %]">[% serial.subscriptionid %]</a></td>
 [% END %]
@@ -247,26 +297,10 @@ $(document).ready(function() {
                     <a href="" onclick="print_slip([% serial.subscriptionid |html %], '[% serial.serialseq |html %] ([% serial.planneddate %])'); return false" >Print list</a>
                 </td>
                 [% END %]
-            [% IF ( CAN_user_serials_receive_serials ) %]
-                <td>
-                  [% IF ( serial.cannotedit ) %]
-                    disabled
-                  [% ELSE %]
-                    [% IF ( serial.subscriptionexpired ) %]
-                    <input type="checkbox" name="serialid" value="[% serial.serialid %]" disabled="disabled" />
-                    [% ELSE %]
-                      [% IF ( serial.checked ) %]
-                    <input type="checkbox" name="serialid" checked="checked" value="[% serial.serialid %]" />
-                      [% ELSE %]
-                    <input type="checkbox" name="serialid" value="[% serial.serialid %]" />
-                      [% END %]           
-                    [% END %]
-                  [% END %]
-                </td>
-            [% END %]
             </tr>
-      [% END %]
-        </table>
+          [% END %]
+        </tbody>
+      </table>
     </div>
     [% END %]
   <input type="hidden" name="subscriptionid" value="[% subscriptionidlist %]" />
index 4393546..470e10d 100755 (executable)
@@ -169,6 +169,7 @@ $template->param(
           callnumber          => $callnumber,
           uc(C4::Context->preference("marcflavour")) => 1,
           serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
+          dateformatmetric   => C4::Context->preference("dateformat") eq "metric" ? 1 : 0,
           );
 
 output_html_with_http_headers $query, $cookie, $template->output;