Bug 23547: Add column configuration to course reserves table in the OPAC
authorLucas Gass <lucas@bywatersolutions.com>
Wed, 19 Feb 2020 18:25:48 +0000 (18:25 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 2 Mar 2020 10:11:47 +0000 (10:11 +0000)
This patch adds opac-course-reserves to the column config tool
TEST PLAN:
1. Have some course reserves and go look at opac-course-reserves.pl
2. See all the unconfigurable columns
3. Apply patch
4. Browse to column config > OPAC > course_reserves_table
5. Try hiding each column and make sure the correct column is hidden on opac-course-reserves.pl

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

admin/columns_settings.yml
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-reserves.tt

index 2c45659..ede1cdf 100644 (file)
@@ -1115,6 +1115,22 @@ modules:
         -
           columnname: item_coursereserves
 
+      course_reserves_table:
+        -
+          columnname: coursename
+        -
+          columnname: department
+        -
+          columnname: course_number
+        -
+          columnname: section
+        -
+          columnname: term
+        -
+          columnname: instructor
+        -
+          columnname: notes
+
       subscriptionst:
         -
           columnname: serial_serialseq
index 9f3b430..751e2ec 100644 (file)
@@ -2,6 +2,7 @@
 [% USE Asset %]
 [% USE Koha %]
 [% USE AuthorisedValues %]
+[% USE ColumnsSettings %]
 
 [% INCLUDE 'doc-head-open.inc' %]
 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Courses</title>
 [% INCLUDE 'opac-bottom.inc' %]
 [% BLOCK jsinclude %]
     [% INCLUDE 'datatables.inc' %]
+    [% INCLUDE 'columns_settings.inc' %]
     <script>
+
     $(document).ready(function() {
-        $("#course_reserves_table").dataTable($.extend(true, {}, dataTablesDefaults, {
+        columns_settings = [% ColumnsSettings.GetColumns( 'opac', 'biblio-detail', 'course_reserves_table', 'json' ) | $raw %]
+
+        KohaTable("#course_reserves_table", {
             "dom": '<"top"flp>rt<"clear">',
-        }));
+            "sorting": [[ 1, "asc" ]],
+            "autoWidth": false,
+            "asColumnDefs": [
+                { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
+                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
+                { "aTargets": [ 1 ], "sType": "nsb-nse" },
+            ]
+        }, columns_settings );
     });
+
     </script>
 [% END %]