From 2c9f7b9108c181e56ac1a7e25341c7a5a1dde074 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Thu, 3 Mar 2022 02:18:58 +0000 Subject: [PATCH] Bug 30200: Add custom tabs to View ILL requests page Prereqs: 1: Make sure you have enabled an ILL backend and enabled system preferecnce ILLModule. For more information see https://koha-community.org/manual/21.11/en/html/ILL_requests.html To test: 1: Note, the following branchcodes, statuses and backends depend on your test environment and which ILL backend you are using. This example is for Libris backend. Set system preference ILLRequestsTabs: - name: tab1 status: - IN_REM - name: tab2 status: - IN_UTEL - IN_LEV - name: tab3 status: - IN_ANK 2. Add at least 4 ILL requests with the following SQL: INSERT INTO `illrequests` (borrowernumber, branchcode, status, backend) VALUES (1, 'CPL', 'IN_REM', 'Libris'); INSERT INTO `illrequests` (borrowernumber, branchcode, status, backend) VALUES (1, 'CPL', 'IN_UTEL', 'Libris'); INSERT INTO `illrequests` (borrowernumber, branchcode, status, backend) VALUES (1, 'CPL', 'IN_LEV', 'Libris'); INSERT INTO `illrequests` (borrowernumber, branchcode, status, backend) VALUES (1, 'CPL', 'IN_ANK', 'Libris'); Note: Change values to whatever your test environment has set up. 3. Go to cgi-bin/koha/ill/ill-requests.pl 4. After the page loads, you should now see 4 different tabs: "All", "tab1", "tab2" and "tab3" 5. Confirm all ILL requests are present under "All" tab 6. Confirm only ILL requests with the statuses you defined in system preference ILLRequestsTabs are under tabs 1, 2 and 3 7. Go to cgi-bin/koha/members/ill-requests.pl?borrowernumber=1 8. Repeat steps 4-6 9. Clear system preference ILLRequestsTabs 10. Observe both ill/ill-requests.pl and members/ill-requests.pl now have only one tab "All" under which correct ILL requests are presented 11. Try some other status values in ILLRequestsTabs and observe expected behavior --- ill/ill-requests.pl | 1 + .../prog/en/includes/ill-list-table.inc | 6 ++-- .../prog/en/modules/ill/ill-requests.tt | 29 +++++++++++++++++-- .../prog/en/modules/members/ill-requests.tt | 29 ++++++++++++++++++- .../intranet-tmpl/prog/js/ill-list-table.js | 26 +++++++++++++++-- members/ill-requests.pl | 1 + 6 files changed, 84 insertions(+), 8 deletions(-) diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl index ea2305b3a4..298a619905 100755 --- a/ill/ill-requests.pl +++ b/ill/ill-requests.pl @@ -427,6 +427,7 @@ if ( $backends_available ) { $template->param( backends => $backends, + illreq_tabs => C4::Context->yaml_preference('ILLRequestsTabs'), types => [ "Book", "Article", "Journal" ], query_type => $op, branches => Koha::Libraries->search, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc index 35a8538ec7..273dab0a9f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc @@ -1,8 +1,8 @@
[% IF prefilters.length > 0 %] - +
[% ELSE %] -
+
[% END %] @@ -36,7 +36,7 @@ - +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt index 5029e5f858..64cef36c5a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt @@ -1,6 +1,7 @@ [% USE raw %] [% USE Asset %] [% USE Branches %] +[% USE JSON.Escape %] [% USE Koha %] [% USE KohaDates %] [% SET footerjs = 1 %] @@ -779,9 +780,27 @@ [% ELSIF query_type == 'illlist' %]

View ILL requests

-
-

Details for all requests

+
+
    +
  • + All +
  • + [% illreq_tab_regex = '' %] + [% FOREACH illreq_tab IN illreq_tabs %] +
  • + [% illreq_tab.name %] +
  • + [% END %] +
+
[% INCLUDE 'ill-list-table.inc' %] +
+ [% FOREACH illreq_tab IN illreq_tabs %] + [% SET illreq_custom_tab_id = "-illreq_tab-" _ loop.index %] +
+ [% INCLUDE 'ill-list-table.inc' %] +
+ [% END %]
[% ELSIF query_type == 'availability' %] @@ -858,6 +877,12 @@ } }); + [% INCLUDE 'ill-list-table-strings.inc' %] [% Asset.js("js/ill-list-table.js") | $raw %] [% IF (query_type == 'availability' || query_type == 'generic_confirm') && Koha.Preference('ILLCheckAvailability') %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/ill-requests.tt index 59028e88df..f409c3246d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/ill-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/ill-requests.tt @@ -1,6 +1,7 @@ [% USE raw %] [% USE Asset %] [% USE Branches %] +[% USE JSON.Escape %] [% USE Koha %] [% USE KohaDates %] [% SET footerjs = 1 %] @@ -39,7 +40,27 @@
[% INCLUDE 'members-toolbar.inc' %]

ILL requests history

- [% INCLUDE 'ill-list-table.inc' %] +
+
    +
  • + All +
  • + [% illreq_tab_regex = '' %] + [% FOREACH illreq_tab IN illreq_tabs %] +
  • + [% illreq_tab.name %] +
  • + [% END %] +
+
+ [% INCLUDE 'ill-list-table.inc' %] +
+ [% FOREACH illreq_tab IN illreq_tabs %] + [% SET illreq_custom_tab_id = "-illreq_tab-" _ loop.index %] +
+ [% INCLUDE 'ill-list-table.inc' %] +
+ [% END %]
@@ -61,6 +82,12 @@ // Set column settings var columns_settings = [% TablesSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %]; + [% INCLUDE 'ill-list-table-strings.inc' %] [% Asset.js("js/ill-list-table.js") | $raw %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js index 414bcf8f22..55c978a8b3 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js +++ b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js @@ -176,6 +176,16 @@ $(document).ready(function() { }; //END Expand + var spliceTabData = function(tab_data, tab_i) { + for (var j=0; tab_i>=0 && j<"table_controls"B>>tr<"bottom pager"ip>', 'columns': colData, 'originalData': data, // Enable render functions to access @@ -495,6 +516,7 @@ $(document).ready(function() { } }, columns_settings); + } // Custom date range filtering $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) { diff --git a/members/ill-requests.pl b/members/ill-requests.pl index f2b23844c0..da348080fd 100755 --- a/members/ill-requests.pl +++ b/members/ill-requests.pl @@ -42,6 +42,7 @@ my $patron = Koha::Patrons->find( $borrowernumber ); output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); $template->param( + illreq_tabs => C4::Context->yaml_preference('ILLRequestsTabs'), prefilters => "borrowernumber=$borrowernumber", patron => $patron, illview => 1, -- 2.25.1