From 8b27d55a88f11cf32fbe202a64940075b5ae09a3 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Tue, 7 Apr 2020 13:25:09 +0200
Subject: [PATCH] Bug 25038: Fix tabs on the OPAC reading history view

OPAC reading history table has three tabs for different checkout types: All, Checkouts, On-site checkouts.

However, all of your checkouts are visible every tab regardless of checkout type.

Test plan:
1. Enable OnSiteCheckouts system preference
2. Perform two checkouts: one normal checkout, one on-site checkout
3. Go to OPAC /cgi-bin/koha/opac-readingrecord.pl
4. Observe your checkouts all are visible in first tab
5. Select second tab and notice that the table is now filtered
6. Same with third tab

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>
---
 .../bootstrap/en/modules/opac-readingrecord.tt         | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt
index 91da402058..1f3dadcff5 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt
@@ -66,9 +66,9 @@
                             [% IF Koha.Preference( 'OnSiteCheckouts' ) == 1 %]
                             <div id="tabs" class="toptabs">
                                 <ul>
-                                    <li><a href="#tabs-container" id="tab_all">All</a></li>
-                                    <li><a href="#tabs-container" id="tab_checkout">Checkouts</a></li>
-                                    <li><a href="#tabs-container" id="tab_onsite_checkout">On-site checkouts</a></li>
+                                    <li id="tab_all"><a href="#tabs-container">All</a></li>
+                                    <li id="tab_checkout"><a href="#tabs-container">Checkouts</a></li>
+                                    <li id="tab_onsite_checkout"><a href="#tabs-container">On-site checkouts</a></li>
                                 </ul>
                             [% END %]
                                 <div id="tabs-container" style="overflow:hidden">
@@ -223,8 +223,8 @@
             ]
         }));
         var tabs = $("#tabs").tabs({
-            select: function(e, ui) {
-                var id = $(ui.tab).attr("id");
+            activate: function(e, ui) {
+                var id = $(ui.newTab).attr("id");
                 if ( id == "tab_checkout" ) {
                     table.fnFilter("standard_checkout", 0);
                 } else if ( id == "tab_onsite_checkout" ) {
-- 
2.17.1