From dd75682f7741c7adeb037f1116d4d9aa4bacb824 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 7 Apr 2022 10:54:38 +0000 Subject: [PATCH] Bug 30487: Convert checkout and patron details page tabs to Bootstrap This patch updates the checkout and patron details pages, updating jQueryUI tabs to Bootstrap tabs. To test, apply the patch and rebuild the staff interface CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). Go to Circulation -> Check out and load a patron record for checkout. Ideally the patron record should have a variet of data associated with it: - Checkouts - Relative's checkouts (if patron is a guarantor or guarantee to another patron with checkouts) - Holds - Article requests - Claims - Restrictions - Clubs On the patron's checkout page, test the various tabs corresponding to the features listed above. Having data to display in those tabs helps confirm that any table functionality triggered by the tab activation is working correctly. The checkouts tab should work correctly whether you have "Always show checkouts immediately" checked or not. Test that you can pre-select any tab by appending its anchor to the URL, e.g.: /cgi-bin/koha/circ/circulation.pl?borrowernumber=123#reserves Perform the same checks on the patron details page. Signed-off-by: Lucas Gass Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- .../prog/css/src/staff-global.scss | 5 - .../prog/en/includes/blocked-fines.inc | 2 +- .../prog/en/includes/borrower_debarments.inc | 2 +- .../prog/en/includes/checkouts-table.inc | 2 +- .../en/includes/patron-article-requests.inc | 2 +- .../prog/en/includes/patron-return-claims.inc | 2 +- .../en/includes/relatives-issues-table.inc | 2 +- .../prog/en/modules/circ/circulation.tt | 211 +++++++-------- .../prog/en/modules/members/moremember.tt | 242 +++++++++--------- koha-tmpl/intranet-tmpl/prog/js/holds.js | 2 +- .../prog/js/pages/circulation.js | 12 +- 11 files changed, 239 insertions(+), 245 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 790b43662c..b9f4ec04ff 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -1245,11 +1245,6 @@ div { } } -#reserves, -#checkouts { - padding: 1em; -} - #sales { display: none; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc index 7625708ecf..b53f98d2f6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc @@ -9,7 +9,7 @@ [% END %] [% IF CAN_user_updatecharges_remaining_permissions %] Make payment - Pay all charges + Pay all charges [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc index c70073db7a..c6b7dff63e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc @@ -1,7 +1,7 @@ [% USE raw %] [% USE Koha %] [% PROCESS 'patron_restrictions.inc' %] -
+
[% IF ( not debarments.defined || debarments.size < 1 ) %]

Patron is currently unrestricted.

[% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc index ab75568e52..68e43464f2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc @@ -1,7 +1,7 @@ [% USE Koha %] [% PROCESS 'modal-claims.inc' %] [% INCLUDE 'format_price.inc' %] -
+
[% IF ( issuecount ) %]

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-article-requests.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-article-requests.inc index d326859f18..efde7d0dd9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-article-requests.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-article-requests.inc @@ -1,6 +1,6 @@ [% USE Context %] [% SET current_article_requests = Context.Scalar( Context.Scalar( patron, 'article_requests' ), 'filter_by_current' ) %] -

+
[% IF current_article_requests.count > 0 %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-return-claims.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-return-claims.inc index b2ad9700a9..4aee20ccab 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-return-claims.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-return-claims.inc @@ -1,4 +1,4 @@ -
+

[% IF ( patron.return_claims.resolved.count > 0 || patron.return_claims.unresolved.count > 0 ) %] Show all [% patron.return_claims.count | html %] claim(s) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/relatives-issues-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/relatives-issues-table.inc index f3ad849562..5c8956397c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/relatives-issues-table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/relatives-issues-table.inc @@ -1,6 +1,6 @@ [% USE Koha %] [% IF ( relatives_issues_count ) %] -

+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 8e51ac2088..00cd8d5c20 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -815,38 +815,38 @@
-
- - - - - - - - - - - - - - - -
Hold dateTitleCall numberItem typeBarcodePickup atExpirationPriorityCancel?Suspend?Status
- -
- - - [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] - [% IF hold_cancellation.count %] - - [% END %] -
- + [% INCLUDE borrower_debarments.inc %] + +
+ [% IF ( holds_count ) %] +
+ + + + + + + + + + + + + + + + + +
Hold dateTitleCall numberItem typeBarcodePickup atExpirationPriorityCancel?Suspend?Status
+ +
+ + + [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] + [% IF hold_cancellation.count %] + + [% END %] +
+
- [% IF Koha.Preference('SuspendHoldsIntranet') %] -
-
- - - - - [% IF Koha.Preference('AutoResumeSuspendedHolds') %] - - - Specify date on which to resume [% INCLUDE 'date-format.inc' %]: - [% END %] -
-
- -
-
- - - - -
-
- [% END # /IF SuspendHoldsIntranet %] - - [% ELSE # IF holds_count %] -

Patron has nothing on hold.

- [% END # /IF holds_count %] -
- - [% IF Koha.Preference('UseRecalls') %] -
- [% INCLUDE 'recalls.inc' %] -
- [% END %] + [% IF Koha.Preference('SuspendHoldsIntranet') %] +
+
+ + + + + [% IF Koha.Preference('AutoResumeSuspendedHolds') %] + + + Specify date on which to resume [% INCLUDE 'date-format.inc' %]: + [% END %] +
+
+ +
+
+ + + + +
+
+ [% END # /IF SuspendHoldsIntranet %] + + [% ELSE # IF holds_count %] +

Patron has nothing on hold.

+ [% END # /IF holds_count %] +
- [% IF Koha.Preference('ClaimReturnedLostValue') || Koha.Preference('BundleLostValue') %] - [% INCLUDE 'patron-return-claims.inc' %] - [% END %] + [% IF Koha.Preference('UseRecalls') %] +
+ [% INCLUDE 'recalls.inc' %] +
+ [% END %] - [% IF Koha.Preference('ArticleRequests') %] - [% INCLUDE 'patron-article-requests.inc' %] - [% END %] + [% IF Koha.Preference('ClaimReturnedLostValue') || Koha.Preference('BundleLostValue') %] + [% INCLUDE 'patron-return-claims.inc' %] + [% END %] + [% IF Koha.Preference('ArticleRequests') %] + [% INCLUDE 'patron-article-requests.inc' %] + [% END %] +
[% ELSIF borrowernumber # IF patron %]
Patron not found. Return to search
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index d7f5bc2ab2..43071d2bf2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -653,43 +653,43 @@
-
    -
  • - Checkouts ([% issuecount || 0 | html %]) + - [% INCLUDE "checkouts-table.inc" %] +
    + [% INCLUDE "checkouts-table.inc" %] - [% INCLUDE "relatives-issues-table.inc" %] + [% INCLUDE "relatives-issues-table.inc" %] - [% IF ( fines ) %] -
    - [% IF ( fines ) %] -

    Total due: [% fines | $Price %]

    - [% ELSE %] -

    No outstanding charges

    - [% END %] -
    - [% END %] + [% IF ( fines ) %] +
    + [% IF ( fines ) %] +

    Total due: [% fines | $Price %]

    + [% ELSE %] +

    No outstanding charges

    + [% END %] +
    + [% END %] - [% IF CAN_user_clubs && ( enrollments.count || enrollable.count ) %] -
    - Loading... -
    - [% END %] + [% IF CAN_user_clubs && ( enrollments.count || enrollable.count ) %] +
    + Loading... +
    + [% END %] - [% INCLUDE borrower_debarments.inc %] - - [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] -
    - [% IF ( holds_count ) %] -
    - - - - - - - - - - - - - - - - - -
    Hold dateTitleCall numberItem typeBarcodePickup atExpirationPriorityDelete?Suspend?Status
    - -
    - - - [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] - [% IF hold_cancellation.count %] - - - [% END %] -
    -
    + [% INCLUDE borrower_debarments.inc %] - [% IF Koha.Preference('SuspendHoldsIntranet') %] -
    -
    - - - - - [% IF Koha.Preference('AutoResumeSuspendedHolds') %] - - - Specify date on which to resume [% INCLUDE 'date-format.inc' %]: - [% END %] -
    -
    + [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] +
    + [% IF ( holds_count ) %] +
    + + + + + + + + + + + + + + + + + +
    Hold dateTitleCall numberItem typeBarcodePickup atExpirationPriorityDelete?Suspend?Status
    -
    - - - - + + + [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] + [% IF hold_cancellation.count %] + + + [% END %]
    - [% END # IF SuspendHoldsIntranet %] - [% ELSE %] -

    Patron has nothing on hold.

    - [% END %] -
    [% # /div#reserves %] - [% END %] + [% IF Koha.Preference('SuspendHoldsIntranet') %] +
    +
    + + + + + [% IF Koha.Preference('AutoResumeSuspendedHolds') %] + + + Specify date on which to resume [% INCLUDE 'date-format.inc' %]: + [% END %] +
    +
    + +
    +
    + + + + +
    +
    + [% END # IF SuspendHoldsIntranet %] - [% IF Koha.Preference('UseRecalls') %] -
    - [% INCLUDE 'recalls.inc' %] -
    - [% END %] + [% ELSE %] +

    Patron has nothing on hold.

    + [% END %] +
    [% # /div#reserves %] + [% END %] - [% IF Koha.Preference('ClaimReturnedLostValue') %] - [% INCLUDE 'patron-return-claims.inc' %] - [% END %] + [% IF Koha.Preference('UseRecalls') %] +
    + [% INCLUDE 'recalls.inc' %] +
    + [% END %] - [% IF Koha.Preference('ArticleRequests') %] - [% INCLUDE 'patron-article-requests.inc' %] - [% END %] + [% IF Koha.Preference('ClaimReturnedLostValue') %] + [% INCLUDE 'patron-return-claims.inc' %] + [% END %] + [% IF Koha.Preference('ArticleRequests') %] + [% INCLUDE 'patron-article-requests.inc' %] + [% END %] +
@@ -901,19 +902,12 @@ }); } - $('#finesholdsissues').tabs({ - // Correct table sizing for tables hidden in tabs - // http://www.datatables.net/examples/api/tabs_and_scrolling.html - "show": function(event, ui) { - var oTable = $('div.dataTables_wrapper>table', ui.panel).dataTable(); - if ( oTable.length > 0 ) { - oTable.fnAdjustColumnSizing(); - } - }, - "activate": function( event, ui ) { - $("a", ui.newTab ).click(); + $("#finesholdsissues a[data-toggle='tab']").on("shown.bs.tab", function(e){ + var oTable = $('div.dataTables_wrapper > table', $(e.target.hash) ).dataTable(); + if ( oTable.length > 0 ) { + oTable.fnAdjustColumnSizing(); } - } ); + }); $("#view_restrictions").on("click",function(){ $('#debarments-tab-link').click(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js index 964528a33d..58ecb622c2 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/holds.js +++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js @@ -120,7 +120,7 @@ $(document).ready(function() { $("#holds-tab").on( "click", function(){ load_holds_table() } ); // If the holds tab is preselected on load, we need to load the table - if ( $("#holds-tab").parent().hasClass('ui-state-active') ) { load_holds_table() } + if ( $("#holds-tab").parent().hasClass('active') ) { load_holds_table() } function load_holds_table() { var holds = new Array(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js index db8576f442..b628b3951c 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js @@ -8,10 +8,8 @@ $(document).ready(function() { return false; }); - $('#patronlists').tabs({ - activate: function( event, ui ) { - $("a", ui.newTab ).click(); - } + $("#patronlists a[data-toggle='tab']").on("shown.bs.tab", function(e){ + $(this).click(); }); $("#borrower_messages .cancel").on("click",function(){ @@ -91,6 +89,12 @@ $(document).ready(function() { $("#" + fieldID).val(""); }); + /* Preselect Bootstrap tab based on location hash */ + var hash = window.location.hash.substring(1); + if( hash ){ + var activeTab = $('a[href="#' + hash + '"]'); + activeTab && activeTab.tab('show'); + } }); -- 2.39.5