Bugzilla – Attachment 184453 Details for
Bug 26258
Circulation tabs inconsistent with counters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26258: Circulation tabs inconsistent with counters
Bug-26258-Circulation-tabs-inconsistent-with-count.patch (text/plain), 17.97 KB, created by
Owen Leonard
on 2025-07-21 18:27:33 UTC
(
hide
)
Description:
Bug 26258: Circulation tabs inconsistent with counters
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2025-07-21 18:27:33 UTC
Size:
17.97 KB
patch
obsolete
>From cf01cd6fc0705fa7268a74e0993cb8495ed22aba Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 8 Jul 2025 13:30:00 +0000 >Subject: [PATCH] Bug 26258: Circulation tabs inconsistent with counters > >This patch makes changes to the markup, style, and behaviour of counters >which are displayed on the patron's account tabs: Checkouts, Holds, etc. > >This is a simplified patch compared to previous versions in order to try >to get this moving foward. The patch no longer includes added code to >keep tab counts up to date as, for instance, claims are added or >removed. > >To test, apply the patch and rebuild the staff interface CSS. > > - Enable features if necessary: recalls, article requests, claims, > clubs, and patron lists. Test both from the checkout page and the > patron detail page. > >Recalls: > >- If necessary, check out some items to patrons so that there are titles > which can be recalled. >- Log in to the OPAC and place one or more recalls. >- Return to the staff interface and view the "Recalls" tab on the > patron's account. > >Return claims: > >- If necessary, check out some items to a patron. Click the "Claim > returned" button on a few of the patron's checkouts. >- As you add claims, the "Claims" tab should update the count of claims. > > *** NOTE: This changes the display of claims in the tab so that the > count of unresolved claims appears first: "Unresolved / Resolved". > I think it makes more sense for the first number to be the one > which shows the number of "active" issues. > >- Test setting the ClaimReturnedWarningThreshold system preference to > various values: e.g. empty, 1, 5. > - If the pref is empty, OR if the pref is set to a number higher > than the number of patron claims, the count of claims should be > styled with the "info" blue background and the count of resolved > claims is not shown. > > *** NOTE: Hiding the resolved claims seems logical if there is not a > concern about the total number of claims. > > - If the number of all claims exceeds the value of the preference, > the tab should show a count of "Unresolved claims / Resolved claims" > with the yellow warning style. > >Restrictions: > >- Adding a restriction to the account should cause a counter with a > red background to appear on the tab. > >Clubs: > >- If necessary, create at least one club template and then multiple > clubs. >- From the "Clubs" tab on the patron's account, try enrolling and > cancelling enrollments to confirm that the count on the tab updates > correctly. > > *** NOTE: I have removed the count of available clubs because I think > it's not relevant to this interface. We don't do it with patron > lists, so this makes it a little more consistent.. > >Patron lists: > >- If necessary, create two ore more patron lists. >- From the "Patron lists" tab, try adding and removing the patron from > lists. > >Sponsored-by: Athens County Public Libraries >--- > .../prog/css/src/staff-global.scss | 42 ++++++++++ > .../prog/en/includes/patron-detail-tabs.inc | 76 +++++++++++++------ > .../prog/en/includes/recalls.inc | 30 ++++---- > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 16 ---- > 4 files changed, 107 insertions(+), 57 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 ae6c2b97398..ee1c9c5dd87 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -4361,6 +4361,48 @@ div .suggestion_note { > } > } > >+.nav.nav-tabs > li > a { >+ align-items: center; >+ display: flex; >+ gap: 5px; >+ >+ span[class*="badge"] { >+ color: #000; >+ font-size: 85%; >+ font-weight: bold; >+ >+ &.text-bg-info { >+ background-color: #9BD6E8; >+ } >+ >+ &.text-bg-danger { >+ background-color: #FF7873; >+ } >+ >+ &:has( span:empty + span:empty ), /* If the element contains two empty spans */ >+ &:has( span:only-child:empty ) { /* If the element contains only one span and it is empty */ >+ background-color: transparent; >+ padding: 0; >+ } >+ >+ &:has( span + span:empty ) { /* If the element has a non-empty span followed by an empty one, reset style */ >+ background-color: #9BD6E8; >+ } >+ } >+} >+ >+.count-active { /* Add separator between two counts in a tab */ >+ & + .count-inactive { >+ &:empty::before { >+ content: ""; >+ } >+ >+ &::before { >+ content: " / "; >+ } >+ } >+} >+ > .ac-library { > background-color: #EEE !important; > font-weight: normal; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc >index 24e01ea9b38..15cdf7ac17a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc >@@ -4,69 +4,89 @@ > [% WRAPPER tabs id= "finesholdsissues" %] > [% WRAPPER tabs_nav %] > [% WRAPPER tab_item tabname= "checkouts" bt_active= 1 %] >- <span>Checkouts</span> (<span class="checkout_count">[% issuecount || 0 | html %]</span>) >+ <span>Checkouts</span> >+ [% IF ( issuecount ) %] >+ <span class="checkout_count badge text-bg-info">[% issuecount || 0 | html %]</span> >+ [% END %] > [% END %] > > [% IF relatives_issues_count %] > [% WRAPPER tab_item tabname= "relatives-issues" %] >- <span>Relatives' checkouts</span> ([% relatives_issues_count | html %]) >+ <span>Relatives' checkouts</span> >+ [% IF ( relatives_issues_count ) %] >+ <span class="badge text-bg-info">[% relatives_issues_count | html %]</span> >+ [% END %] > [% END %] > [% END %] > > [% IF ( guarantees_fines ) %] > [% WRAPPER tab_item tabname= "guarantees_finesandcharges" %] >- <span>Guarantees' charges</span> ([% guarantees_fines | $Price %]) >+ <span>Guarantees' charges</span> >+ [% IF ( guarantees_fines ) %] >+ <span class="badge text-bg-info">[% guarantees_fines | $Price %]</span> >+ [% END %] > [% END %] > [% END %] > > [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] > [% WRAPPER tab_item tabname= "holds" %] >- <span>Holds</span> ([% holds_count || 0 | html %]) >+ <span>Holds</span> >+ [% IF ( holds_count ) %] >+ <span class="badge text-bg-info">[% holds_count | html %]</span> >+ [% END %] > [% END %] > [% WRAPPER tab_item tabname="bookings" %] > [% SET bookings_count = patron.bookings.filter_by_active.count %] > [% SET expired_bookings_count = patron.bookings.count - bookings_count %] >- <span class="bookings_count">Bookings ([% bookings_count || 0 | html %])</span> >+ <span>Bookings</span> >+ [% IF ( bookings_count ) %] >+ <span class="badge text-bg-info">[% bookings_count || 0 | html %]</span> >+ [% END %] > [% END %] > [% END %] > > [% IF Koha.Preference('UseRecalls') %] > [% WRAPPER tab_item tabname= "recalls" %] >- <span>Recalls</span> ([% recalls.count || 0 | html %]) >+ <span>Recalls</span> >+ [% IF ( recalls.count ) %] >+ <span class="badge text-bg-info">[% recalls.count | html %]</span> >+ [% END %] > [% END %] > [% END %] > > [% IF Koha.Preference('ArticleRequests') %] > [% SET article_requests = Context.Scalar( Context.Scalar( patron, 'article_requests' ), 'filter_by_current') %] > [% WRAPPER tab_item tabname= "article-requests" %] >- <span>Article requests</span> ([% article_requests.count || 0 | html %]) >+ <span>Article requests</span> >+ [% IF ( article_requests.count ) %] >+ <span class="badge text-bg-info">[% article_requests.count | html %]</span> >+ [% END %] > [% END %] > [% END %] > > [% IF Koha.Preference('ClaimReturnedLostValue') || Koha.Preference('BundleLostValue') %] > [% WRAPPER tab_item tabname= "return-claims" %] > <span>Claims</span> >- [% IF ( patron.return_claims.count ) %] >- ([% IF patron.return_claims.resolved.count == 0 %] >- <span title="Resolved claims" class="badge text-bg-info" id="return-claims-count-resolved">[% patron.return_claims.resolved.count | html %]</span> >- [% ELSE %] >- <span title="Resolved claims" class="badge text-bg-info" id="return-claims-count-resolved">[% patron.return_claims.resolved.count | html %]</span> >- [% END %] >- [% IF patron.return_claims.unresolved.count == 0 %] >- <span title="Unresolved claims" class="badge text-bg-info" id="return-claims-count-unresolved">[% patron.return_claims.unresolved.count | html %]</span> >- [% ELSE %] >- <span title="Unresolved claims" class="badge text-bg-warning" id="return-claims-count-unresolved">[% patron.return_claims.unresolved.count | html %]</span> >- [% END %]) >+ [% SET warning_threshold = Koha.Preference('ClaimReturnedWarningThreshold') %] >+ [% IF warning_threshold != '' && ( patron.return_claims.count > warning_threshold ) %] >+ <span id="return-claims-count" title="Unresolved claims / Resolved claims" class="badge text-bg-warning"> >+ <span id="return-claims-count-unresolved" class="count-active" data-warning="[% warning_threshold | html %]">[% patron.return_claims.unresolved.count | html %]</span> >+ <span id="return-claims-count-resolved" class="count-inactive">[% patron.return_claims.resolved.count | html %]</span> >+ </span> > [% ELSE %] >- [% no_claims = 0 %] >- (<span title="Resolved claims" class="badge text-bg-info" id="return-claims-count-resolved">[% no_claims | html %]</span> >- <span title="Unresolved claims" class="badge text-bg-info" id="return-claims-count-unresolved">[% no_claims | html %]</span>) >- [% END # /IF patron.return_claims.count %] >+ <span id="return-claims-count" title="Unresolved claims" class="badge text-bg-info"> >+ <span id="return-claims-count-unresolved" class="count-active" data-warning="[% warning_threshold | html %]">[% patron.return_claims.unresolved.count || "" | html %]</span> >+ <span id="return-claims-count-resolved" class="count-inactive">[% patron.return_claims.resolved.count || "" | html %]</span> >+ </span> >+ [% END %] > [% END # /WRAPPER tab_item return-claims %] > [% END %] > > [% WRAPPER tab_item tabname= "reldebarments" %] >- <span>Restrictions ([% patron.restrictions.count || 0 | html %])</span> >+ <span>Restrictions</span> >+ [% IF ( patron.restrictions.count ) %] >+ <span class="badge text-bg-danger">[% patron.restrictions.count | html %]</span> >+ [% END %] > [% END %] > > [% SET enrollments = patron.get_club_enrollments %] >@@ -74,13 +94,19 @@ > <!-- 0 => not OPAC --> > [% IF CAN_user_clubs && ( enrollable.count || enrollments.count ) %] > [% WRAPPER tab_item tabname= "clubs" %] >- <span>Clubs ([% enrollments.count | html %]/[% enrollable.count | html %])</span> >+ <span>Clubs</span> >+ <span id="clubs-count" title="Club enrollments" class="badge text-bg-info"> >+ <span id="clubs-count-enrolled" class="count-active">[% enrollments.count || "" | html %]</span> >+ </span> > [% END %] > [% END %] > > [% IF CAN_user_tools_manage_patron_lists || patron_lists_count %] > [% WRAPPER tab_item tabname="pat_lists" %] >- <span>Patron lists ([% patron_lists_count | html %])</span> >+ <span>Patron lists</span> >+ <span id="patron-lists" title="Lists containing this patron" class="badge text-bg-info"> >+ <span id="patron-lists-count">[%~ patron_lists_count || "" | html ~%]</span> >+ </span> > [% END %] > [% END %] > [% END # /WRAPPER tabs_nav %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc >index cdc0cffa11d..8915ab1f352 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc >@@ -94,27 +94,25 @@ > <button type="button" class="btn btn-sm btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Actions </button> > <ul class="dropdown-menu dropdown-menu-end"> > [% IF ( recall.requested or recall.overdue ) %] >- <li >- ><a class="cancel_recall dropdown-item" data-id="[% recall.id | html %]"><i class="fa fa-times"></i> Cancel</a></li >- > >+ <li> >+ <a class="cancel_recall dropdown-item" data-id="[% recall.id | html %]"><i class="fa fa-times"></i> Cancel</a> >+ </li> > [% IF ( recall.should_be_overdue ) %] > <li >- ><a class="overdue_recall" data-id="[% recall.id | html %]"><i class="fa fa-hourglass-end"></i> Mark as overdue</a></li >- > >+ ><a class="overdue_recall dropdown-item" data-id="[% recall.id | html %]"><i class="fa fa-hourglass-end"></i> Mark as overdue</a> >+ </li> > [% END %] > [% ELSIF ( recall.waiting ) %] >- <li >- ><a class="revert_recall dropdown-item" data-id="[% recall.id | html %]"><i class="fa fa-undo"></i> Revert waiting</a></li >- > >- <li >- ><a class="expire_recall dropdown-item" data-id="[% recall.id | html %]"><i class="fa fa-times"></i> Expire</a></li >- > >+ <li> >+ <a class="revert_recall dropdown-item" data-id="[% recall.id | html %]"><i class="fa fa-undo"></i> Revert waiting</a> >+ </li> >+ <li> >+ <a class="expire_recall dropdown-item" data-id="[% recall.id | html %]"><i class="fa fa-times"></i> Expire</a> >+ </li> > [% ELSIF ( recall.in_transit ) %] >- <li >- ><a class="transit_recall dropdown-item" data-id="[% recall.id | html %]" >- ><i class="fa fa-times"></i> Cancel recall and return to: [% Branches.GetName(recall.item.homebranch) | html %]</a >- ></li >- > >+ <li> >+ <a class="transit_recall dropdown-item" data-id="[% recall.id | html %]"><i class="fa fa-times"></i> Cancel recall and return to: [% Branches.GetName(recall.item.homebranch) | html %]</a> >+ </li> > [% END %] > </ul> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index 185a5488db5..3552366f7fd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -1546,22 +1546,6 @@ $(document).ready(function () { > url: "/cgi-bin/koha/svc/return_claims?borrowernumber=%s".format( > borrowernumber > ), >- complete: function (json) { >- let resolved = json.resolved; >- let unresolved = json.unresolved; >- >- if (unresolved > 0) { >- $("#return-claims-count-unresolved") >- .text(unresolved) >- .removeClass("text-bg-info") >- .addClass("text-bg-warning"); >- } else { >- $("#return-claims-count-unresolved") >- .text(unresolved) >- .removeClass("text-bg-warning") >- .addClass("text-bg-info"); >- } >- }, > }, > bKohaAjaxSVC: true, > search: { search: "is_unresolved" }, >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26258
:
108694
|
108779
|
153679
|
166147
|
166159
|
166160
|
166239
| 184453