Bugzilla – Attachment 166159 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), 41.90 KB, created by
David Nind
on 2024-05-03 21:49:54 UTC
(
hide
)
Description:
Bug 26258: Circulation tabs inconsistent with counters
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-05-03 21:49:54 UTC
Size:
41.90 KB
patch
obsolete
>From 9f9d02788da1f7d6e613a8966cbacebc77729622 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 17 Jul 2023 19:33:31 +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. >Tabs which contain a count which might change based on a user's actions >will keep up to date, e.g. changing claims status, enrolling in clubs, >etc. > >To test, apply the patch and 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. >- Click Actions -> Cancel for one of the recalls. The recall should be > marked "Cancelled" and the count on the tab should update. > >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. > >- Open the Claims tab. Click Actions->Resolve on one or more claims, > confirming that the resolved claim is hidden and the tab numbers > update. >- 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. The tab counter should update correctly. > >Sponsored-by: Athens County Public Libraries >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/css/src/staff-global.scss | 43 ++ > .../prog/en/includes/patron-detail-tabs.inc | 77 +-- > .../prog/en/includes/str/members-menu.inc | 2 + > .../prog/en/modules/clubs/patron-clubs-tab.tt | 1 + > .../prog/en/modules/clubs/patron-enroll.tt | 17 +- > .../modules/patron_lists/patron-lists-tab.tt | 54 +-- > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 438 ++++++++++-------- > koha-tmpl/intranet-tmpl/prog/js/recalls.js | 2 + > 8 files changed, 363 insertions(+), 271 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 121030e70f..f4e26fe4ae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -4941,3 +4941,46 @@ div .suggestion_note { > } > } > } >+ >+.nav.nav-tabs > li > a { >+ align-items: center; >+ display: flex; >+ gap: 5px; >+ >+ span[class*=" label-"] { >+ color: #000; >+ font-size: 85%; >+ font-weight: bold; >+ >+ &.label-info { >+ background-color: #9BD6E8; >+ } >+ >+ &.label-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; >+ padding: .2em .6em .3em; >+ } >+ } >+} >+ >+.count-active { /* Add separator between two counts in a tab */ >+ & + .count-inactive { >+ &:empty::before { >+ content: ""; >+ } >+ >+ &::before { >+ content: " / "; >+ } >+ } >+} >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 b8ad2eb3b7..cf0ebf12d9 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,88 +4,113 @@ > [% WRAPPER tabs id= "finesholdsissues" %] > [% WRAPPER tabs_nav %] > [% WRAPPER tab_item tabname= "checkouts" bt_active= 1 %] >- <span>Checkouts (<span class="checkout_count">[% issuecount || 0 | html %]</span>)</span> >+ <span>Checkouts</span> >+ [% IF ( issuecount ) %] >+ <span class="checkout_count label label-info">[% issuecount || 0 | html %]</span> >+ [% END %] > [% END %] > > [% IF relatives_issues_count %] > [% WRAPPER tab_item tabname= "relatives-issues" %] >- <span>Relatives' checkouts ([% relatives_issues_count | html %])</span> >+ <span>Relatives' checkouts</span> >+ [% IF ( relatives_issues_count ) %] >+ <span class="label label-info">[% relatives_issues_count | html %]</span> >+ [% END %] > [% END %] > [% END %] > > [% IF ( fines ) %] > [% WRAPPER tab_item tabname= "finesandcharges" %] >- <span>Charges ([% fines | $Price %])</span> >+ <span>Charges</span> >+ [% IF ( fines ) %] >+ <span class="label label-info">[% fines | $Price %]</span> >+ [% END %] > [% END %] > [% END %] > > [% IF ( guarantees_fines ) %] > [% WRAPPER tab_item tabname= "guarantees_finesandcharges" %] >- <span>Guarantees' charges ([% guarantees_fines | $Price %])</span> >+ <span>Guarantees' charges</span> >+ [% IF ( guarantees_fines ) %] >+ <span class="label label-info">[% guarantees_fines | $Price %]</span> >+ [% END %] > [% END %] > [% END %] > > [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] > [% WRAPPER tab_item tabname= "holds" %] >- <span>Holds ([% holds_count || 0 | html %])</span> >+ <span>Holds</span> >+ [% IF ( holds_count ) %] >+ <span class="label label-info">[% holds_count | html %]</span> >+ [% END %] > [% END %] > [% END %] > > [% IF Koha.Preference('UseRecalls') %] > [% WRAPPER tab_item tabname= "recalls" %] >- <span>Recalls ([% recalls.count || 0 | html %])</span> >+ <span>Recalls</span> >+ [% IF ( recalls.count ) %] >+ <span id="recalls-count" class="label label-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 ([% article_requests.count || 0 | html %])</span> >+ <span>Article requests</span> >+ [% IF ( article_requests.count ) %] >+ <span class="label label-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="label label-default" id="return-claims-count-resolved">[% patron.return_claims.resolved.count | html %]</span> >- [% ELSE %] >- <span title="Resolved claims" class="label label-success" 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="label label-default" id="return-claims-count-unresolved">[% patron.return_claims.unresolved.count | html %]</span> >- [% ELSE %] >- <span title="Unresolved claims" class="label label-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="label label-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="label label-default" id="return-claims-count-resolved">[% no_claims | html %]</span> >- <span title="Unresolved claims" class="label label-default" id="return-claims-count-unresolved">[% no_claims | html %]</span>) >- [% END # /IF patron.return_claims.count %] >+ <span id="return-claims-count" title="Unresolved claims" class="label label-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="label label-danger">[% patron.restrictions.count | html %]</span> >+ [% END %] > [% END %] > > [% SET enrollments = patron.get_club_enrollments %] > [% SET enrollable = patron.get_enrollable_clubs(0) %] <!-- 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="label label-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="label label-info"> >+ <span id="patron-lists-count">[% patron_lists_count || "" | html %]</span> >+ </span> > [% END %] > [% END %] > [% END # /WRAPPER tabs_nav %] > >- > [% WRAPPER tab_panels %] > [% WRAPPER tab_panel tabname="checkouts" bt_active= 1 %] > [% INCLUDE "checkouts-table.inc" %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc >index 530e9bfb89..f32d8e7526 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc >@@ -16,9 +16,11 @@ > var dateformat = "[% Koha.Preference('dateformat') | html %]"; > > var borrowernumber; >+ var cardnumber; > var number_of_adult_categories = 0; > [% IF patron %] > borrowernumber = "[% patron.borrowernumber | html %]"; >+ cardnumber = "[% patron.cardnumber | html %]"; > [% IF patron.is_child %] > [% SET adult_categories = Categories.scalar.all(category_type => 'A') %] > [% SET number_of_adult_categories = adult_categories.count %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt >index 855683ea26..a0a33dfe7c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt >@@ -92,6 +92,7 @@ function cancelEnrollment( id ) { > if ( success.success ) { > $('#clubs_panel').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=[% borrowernumber | html %]', function() { > $("body").css("cursor", "default"); >+ refreshTabCount( $("#clubs-count-enrolled"), $("#table_clubenrollments tbody tr").length ); > }); > } else { > alert(_("Unable to cancel enrollment!")); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt >index 8db62bdf25..8b2f457a59 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt >@@ -53,7 +53,7 @@ > [% END %] > [% END %] > <li> >- <a href="#" class="btn btn-sm btn-default" onclick="addEnrollment(); return false;">Finish enrollment</a> >+ <a href="#" class="btn btn-sm btn-default" id="patron-club-add-enrollment">Finish enrollment</a> > <a class="cancel" href="#" onclick="showClubs(); return false;">Cancel</a> > </li> > </ol> >@@ -62,9 +62,17 @@ > </div> > > <script> >-if([% enrollent_id | html %]){ >- $("#heading").html(_("Modifying enrollment")+" <em>[% club.name | html %]</em>"); >-} >+ $(document).ready(function(){ >+ if([% enrollent_id | html %]){ >+ $("#heading").html(_("Modifying enrollment")+" <em>[% club.name | html %]</em>"); >+ } >+ >+ $("#patron-club-add-enrollment").on("click", function(e){ >+ e.preventDefault(); >+ addEnrollment(); >+ }); >+ }); >+ > function addEnrollment() { > $("body").css("cursor", "progress"); > const client = APIClient.club; >@@ -74,6 +82,7 @@ function addEnrollment() { > if ( success.success ) { > $('#clubs_panel').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=[% borrowernumber | html %]&id=[% club.id | html %]', function() { > $("body").css("cursor", "default"); >+ refreshTabCount( $("#clubs-count-enrolled"), $("#table_clubenrollments tbody tr").length ); > }); > } else { > alert(_("Unable to create enrollment!")); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt >index 5739762977..c5cf61e99a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt >@@ -91,46 +91,22 @@ > [% END %] > > [% IF available_lists && CAN_user_tools_manage_patron_lists %] >-<div class="h4"> >- <span>Add patron to list</span> >- <select name="patron_list_id" id="add_to_patron_list_id_select"> >- <option value=""></option> >- [%- FOREACH l IN available_lists %] >- <option value="[% l.patron_list_id | html %]">[% l.name | html %]</option> >- [%- END %] >- </select> >- <a onclick="addToList()"><i class="fa fa-plus"></i> >-</div> >+ <fieldset class="brief"> >+ <ol> >+ <li> >+ <label for="add_to_patron_list_id_select">Add patron to list</label> >+ <select name="patron_list_id" id="add_to_patron_list_id_select"> >+ <option value=""></option> >+ [%- FOREACH l IN available_lists %] >+ <option value="[% l.patron_list_id | html %]">[% l.name | html %]</option> >+ [%- END %] >+ </select> >+ <button id="add_patron_to_list" type="button" class="btn btn-default btn-xs"><i class="fa fa-floppy-disk" aria-hidden="true"></i> Save</button></i></button> >+ </li> >+ </ol> >+ </fieldset> > [% END %] > > <script> >- $("#table_listnopatron, #table_inlists").dataTable($.extend(true, {}, dataTablesDefaults, { >- "columnDefs": [ >- { 'sortable': false, "bSearchable": false, 'targets': [ 'NoSort' ] } >- ], >- "sPaginationType": "full" >- })); >- >- [% IF CAN_user_tools_manage_patron_lists %] >- function addToList() { >- var list_id = $("#add_to_patron_list_id_select").val(); >- $('#pat_lists_panel').text(_("Loading...")); >- $("body").css("cursor", "progress"); >- $('#pat_lists_panel').load('/cgi-bin/koha/patron_lists/patron-lists-tab.pl?borrowernumber=[% borrowernumber | html %]&patron_list_id=' + list_id + '&patrons_to_add=[% cardnumber | html %]', function() { >- $("body").css("cursor", "default"); >- }); >- >- return false; >- } >- >- function removeFromList( list_id, patron_list_patron_id ) { >- $('#pat_lists_panel').text(_("Loading...")); >- $("body").css("cursor", "progress"); >- $('#pat_lists_panel').load('/cgi-bin/koha/patron_lists/patron-lists-tab.pl?borrowernumber=[% borrowernumber | html %]&patron_list_id=' + list_id + '&patrons_to_remove=' + patron_list_patron_id, function() { >- $("body").css("cursor", "default"); >- }); >- >- return false; >- } >- [% END %] >+ var CAN_user_tools_manage_patron_lists = "[% CAN_user_tools_manage_patron_lists || 0 | html %]"; > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index c5b474e027..a10b516463 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -465,17 +465,235 @@ function LoadIssuesTable() { > } > } > >-var loadIssuesTableDelayTimeoutId; >-var barcodefield = $("#barcode"); >+function refreshReturnClaimsTable(){ >+ const table = $('#return-claims-table'); >+ if ($.fn.dataTable.isDataTable(table)) { >+ table.DataTable().ajax.reload(); >+ } else { >+ loadReturnClaimsTable(); >+ } >+} >+ >+function loadReturnClaimsTable() { >+ if ( ! returnClaimsTable ) { >+ returnClaimsTable = $("#return-claims-table").dataTable({ >+ "autoWidth": false, >+ "dom": "rt", >+ "order": [], >+ "columnDefs": [ >+ { "orderable": false, "searchable": false, "targets": ['NoSort'] }, >+ { "type": "anti-the", "targets": ["anti-the"] }, >+ ], >+ "columns": [ >+ { >+ "data": "id", >+ "visible": false, >+ }, >+ { >+ "data": function (oObj) { >+ if (oObj.resolution) { >+ return "is_resolved"; >+ } else { >+ return "is_unresolved"; >+ } >+ }, >+ "visible": false, >+ }, >+ { >+ "data": function ( oObj ) { >+ let title = '<a class="return-claim-title strong" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + oObj.biblionumber + '">' >+ + oObj.title >+ + ( oObj.subtitle ? " " + oObj.subtitle : "" ) >+ + ( oObj.enumchron || "" ) >+ + '</a>'; >+ if ( oObj.author ) { >+ title += ' by ' + oObj.author; >+ } >+ title += ' <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=' >+ + oObj.biblionumber >+ + '&itemnumber=' >+ + oObj.itemnumber >+ + '">' >+ + (oObj.barcode ? oObj.barcode.escapeHtml() : "") >+ + '</a>'; >+ >+ return title; >+ } >+ }, >+ { >+ "className": "return-claim-notes-td", >+ "data": function ( oObj ) { >+ let notes = '<span id="return-claim-notes-static-' + oObj.id + '" class="return-claim-notes" data-return-claim-id="' + oObj.id + '">'; >+ if ( oObj.notes ) { >+ notes += oObj.notes; >+ } >+ notes += '</span>'; >+ notes += '<i style="float:right" class="fa-solid fa-pen-to-square" title="' + __("Double click to edit") + '"></i>'; >+ return notes; >+ } >+ }, >+ { >+ "data": "created_on", >+ "visible": false, >+ }, >+ { >+ "orderData": 4, >+ "data": function ( oObj ) { >+ if ( oObj.created_on ) { >+ return $date(oObj.created_on, { no_tz_adjust: true });; >+ } else { >+ return ""; >+ } >+ } >+ }, >+ { >+ "data": "updated_on", >+ "visible": false, >+ }, >+ { >+ "orderData": 6, >+ "data": function ( oObj ) { >+ if ( oObj.updated_on ) { >+ return $date(oObj.updated_on, { no_tz_adjust: true }); >+ } else { >+ return ""; >+ } >+ } >+ }, >+ { >+ "data": function ( oObj ) { >+ if ( ! oObj.resolution ) return ""; >+ >+ let desc = '<strong>' + oObj.resolution_data.lib + '</strong> <i>('; >+ if (oObj.resolved_by_data) desc += '<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=' + oObj.resolved_by_data.borrowernumber + '">' + ( oObj.resolved_by_data.firstname || "" ) + " " + ( oObj.resolved_by_data.surname || "" ) + '</a>'; >+ desc += ', ' + oObj.resolved_on + ')</i>'; >+ return desc; >+ } >+ }, >+ { >+ "data": function ( oObj ) { >+ let delete_html = oObj.resolved_on >+ ? '<li><a href="#" class="return-claim-tools-delete" data-return-claim-id="' + oObj.id + '"><i class="fa fa-trash-can"></i> ' + __("Delete") + '</a></li>' >+ : ""; >+ let resolve_html = ! oObj.resolution >+ ? '<li><a href="#" class="return-claim-tools-resolve" data-return-claim-id="' + oObj.id + '" data-current-lost-status="' + escape_str(oObj.itemlost) + '"><i class="fa fa-check-square"></i> ' + __("Resolve") + '</a></li>' >+ : ""; >+ >+ return '<div class="btn-group">' >+ + ' <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' >+ + __("Actions") + ' <span class="caret"></span>' >+ + ' </button>' >+ + ' <ul class="dropdown-menu">' >+ + ' <li><a href="#" class="return-claim-tools-editnotes" data-return-claim-id="' + oObj.id + '"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + __("Edit notes") + '</a></li>' >+ + resolve_html >+ + delete_html >+ + ' </ul>' >+ + ' </div>'; >+ } >+ }, >+ ], >+ "paging": false, >+ "processing": true, >+ "serverSide": false, >+ "sAjaxSource": '/cgi-bin/koha/svc/return_claims', >+ "fnServerData": function ( sSource, aoData, fnCallback ) { >+ aoData.push( { "name": "borrowernumber", "value": borrowernumber } ); >+ >+ $.getJSON( sSource, aoData, function (json) { >+ let resolved = Number( json.resolved ) || 0; >+ let unresolved = Number( json.unresolved ) || 0; >+ let warningThreshold = $("#return-claims-count-unresolved").data("warning"); >+ >+ refreshTabCount( $('#return-claims-count-unresolved'), unresolved ); >+ >+ if( warningThreshold !== '' && ( ( resolved + unresolved ) > Number( warningThreshold ) ) ){ >+ refreshTabCount( $('#return-claims-count-resolved'), resolved ); >+ $("#return-claims-count").attr("class", "label label-warning"); >+ } else { >+ $("#return-claims-count").attr("class", "label label-info"); >+ } >+ fnCallback(json) >+ } ); >+ }, >+ "search": { "search": "is_unresolved" }, >+ "footerCallback": function (row, data, start, end, display) { >+ var api = this.api(); >+ // Total over all pages >+ var colData = api.column(1).data(); >+ var is_unresolved = 0; >+ var is_resolved = 0; >+ colData.each(function( index, value ){ >+ if( index == "is_unresolved" ){ is_unresolved++; } >+ if (index == "is_resolved") { is_resolved++; } >+ }); >+ // Update footer >+ $("#return-claims-controls").html( showClaimFilter( is_unresolved, is_resolved ) ) >+ } >+ }); >+ } >+} > >-$('#issues-table-load-now-button').click(function(){ >- if ( loadIssuesTableDelayTimeoutId ) clearTimeout(loadIssuesTableDelayTimeoutId); >- LoadIssuesTable(); >- barcodefield.focus(); >+function showClaimFilter( is_unresolved, is_resolved ){ >+ var showAll, showUnresolved; >+ var total = Number( is_unresolved ) + Number( is_resolved ); >+ if( total > 0 ){ >+ showAll = __nx("Show 1 claim", "Show all {count} claims", total, { count: total }); >+ } else { >+ showAll = ""; >+ } >+ if( is_unresolved > 0 ){ >+ showUnresolved = __nx("Show 1 unresolved claim", "Show {count} unresolved claims", is_unresolved, { count: is_unresolved }) >+ } else { >+ showUnresolved = ""; >+ } >+ $("#show_all_claims").html( showAll ); >+ $("#show_unresolved_claims").html( showUnresolved ); >+} >+ >+function addToList() { >+ if( CAN_user_tools_manage_patron_lists ){ >+ var list_id = $("#add_to_patron_list_id_select").val(); >+ $('#pat_lists_panel').text(_("Loading...")); >+ $("body").css("cursor", "progress"); >+ $('#pat_lists_panel').load('/cgi-bin/koha/patron_lists/patron-lists-tab.pl?borrowernumber=' + borrowernumber + '&patron_list_id=' + list_id + '&patrons_to_add=' + cardnumber, function() { >+ refreshTabCount( $("#patron-lists-count"), $("#table_inlists tbody tr").length ); >+ $("body").css("cursor", "default"); >+ }); >+ } >+ return false; >+} >+ >+function removeFromList( list_id, patron_list_patron_id ) { >+ if( CAN_user_tools_manage_patron_lists ){ >+ $('#pat_lists_panel').text(_("Loading...")); >+ $("body").css("cursor", "progress"); >+ $('#pat_lists_panel').load('/cgi-bin/koha/patron_lists/patron-lists-tab.pl?borrowernumber=' + borrowernumber + '&patron_list_id=' + list_id + '&patrons_to_remove=' + patron_list_patron_id, function() { >+ refreshTabCount( $("#patron-lists-count"), $("#table_inlists tbody tr").length ); >+ $("body").css("cursor", "default"); >+ }); >+ } > return false; >-}); >+} >+ >+function refreshTabCount( container, num ){ >+ if( num > 0 ){ >+ container.text( num ); >+ } else { >+ container.text( "" ); >+ } >+} >+ >+var loadIssuesTableDelayTimeoutId; >+var barcodefield = $("#barcode"); >+var returnClaimsTable; > > $(document).ready(function() { >+ $('#issues-table-load-now-button').click(function(){ >+ if ( loadIssuesTableDelayTimeoutId ) clearTimeout(loadIssuesTableDelayTimeoutId); >+ LoadIssuesTable(); >+ barcodefield.focus(); >+ return false; >+ }); > > var onHoldDueDateSet = false; > >@@ -995,205 +1213,10 @@ $(document).ready(function() { > }); > > // Don't load return claims table unless its tab is shown >- var returnClaimsTable; > $("#return-claims-tab").on('shown.bs.tab', function() { > refreshReturnClaimsTable(); > }); > >- function refreshReturnClaimsTable(){ >- const table = $('#return-claims-table'); >- if ($.fn.dataTable.isDataTable(table)) { >- table.DataTable().ajax.reload(); >- } else { >- loadReturnClaimsTable(); >- } >- } >- function loadReturnClaimsTable() { >- if ( ! returnClaimsTable ) { >- returnClaimsTable = $("#return-claims-table").dataTable({ >- "autoWidth": false, >- "dom": "rt", >- "order": [], >- "columnDefs": [ >- { "orderable": false, "searchable": false, "targets": ['NoSort'] }, >- { "type": "anti-the", "targets": ["anti-the"] }, >- ], >- "columns": [ >- { >- "data": "id", >- "visible": false, >- }, >- { >- "data": function (oObj) { >- if (oObj.resolution) { >- return "is_resolved"; >- } else { >- return "is_unresolved"; >- } >- }, >- "visible": false, >- }, >- { >- "data": function ( oObj ) { >- let title = '<a class="return-claim-title strong" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + oObj.biblionumber + '">' >- + oObj.title >- + ( oObj.subtitle ? " " + oObj.subtitle : "" ) >- + ( oObj.enumchron || "" ) >- + '</a>'; >- if ( oObj.author ) { >- title += ' by ' + oObj.author; >- } >- title += ' <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=' >- + oObj.biblionumber >- + '&itemnumber=' >- + oObj.itemnumber >- + '">' >- + (oObj.barcode ? oObj.barcode.escapeHtml() : "") >- + '</a>'; >- >- return title; >- } >- }, >- { >- "className": "return-claim-notes-td", >- "data": function ( oObj ) { >- let notes = '<span id="return-claim-notes-static-' + oObj.id + '" class="return-claim-notes" data-return-claim-id="' + oObj.id + '">'; >- if ( oObj.notes ) { >- notes += oObj.notes; >- } >- notes += '</span>'; >- notes += '<i style="float:right" class="fa-solid fa-pen-to-square" title="' + __("Double click to edit") + '"></i>'; >- return notes; >- } >- }, >- { >- "data": "created_on", >- "visible": false, >- }, >- { >- "orderData": 4, >- "data": function ( oObj ) { >- if ( oObj.created_on ) { >- return $date(oObj.created_on, { no_tz_adjust: true });; >- } else { >- return ""; >- } >- } >- }, >- { >- "data": "updated_on", >- "visible": false, >- }, >- { >- "orderData": 6, >- "data": function ( oObj ) { >- if ( oObj.updated_on ) { >- return $date(oObj.updated_on, { no_tz_adjust: true }); >- } else { >- return ""; >- } >- } >- }, >- { >- "data": function ( oObj ) { >- if ( ! oObj.resolution ) return ""; >- >- let desc = '<strong>' + oObj.resolution_data.lib + '</strong> <i>('; >- if (oObj.resolved_by_data) desc += '<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=' + oObj.resolved_by_data.borrowernumber + '">' + ( oObj.resolved_by_data.firstname || "" ) + " " + ( oObj.resolved_by_data.surname || "" ) + '</a>'; >- desc += ', ' + oObj.resolved_on + ')</i>'; >- return desc; >- } >- }, >- { >- "data": function ( oObj ) { >- let delete_html = oObj.resolved_on >- ? '<li><a href="#" class="return-claim-tools-delete" data-return-claim-id="' + oObj.id + '"><i class="fa fa-trash-can"></i> ' + __("Delete") + '</a></li>' >- : ""; >- let resolve_html = ! oObj.resolution >- ? '<li><a href="#" class="return-claim-tools-resolve" data-return-claim-id="' + oObj.id + '" data-current-lost-status="' + escape_str(oObj.itemlost) + '"><i class="fa fa-check-square"></i> ' + __("Resolve") + '</a></li>' >- : ""; >- >- return '<div class="btn-group">' >- + ' <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' >- + __("Actions") + ' <span class="caret"></span>' >- + ' </button>' >- + ' <ul class="dropdown-menu">' >- + ' <li><a href="#" class="return-claim-tools-editnotes" data-return-claim-id="' + oObj.id + '"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + __("Edit notes") + '</a></li>' >- + resolve_html >- + delete_html >- + ' </ul>' >- + ' </div>'; >- } >- }, >- ], >- "paging": false, >- "processing": true, >- "serverSide": false, >- "sAjaxSource": '/cgi-bin/koha/svc/return_claims', >- "fnServerData": function ( sSource, aoData, fnCallback ) { >- aoData.push( { "name": "borrowernumber", "value": borrowernumber } ); >- >- $.getJSON( sSource, aoData, function (json) { >- let resolved = json.resolved; >- let unresolved = json.unresolved; >- >- if ( resolved > 0 ) { >- $('#return-claims-count-resolved').text(resolved) >- .removeClass('label-default') >- .addClass('label-success'); >- } else { >- $('#return-claims-count-resolved').text(resolved) >- .removeClass('label-success') >- .addClass('label-default'); >- } >- if ( unresolved > 0 ) { >- $('#return-claims-count-unresolved').text(unresolved) >- .removeClass('label-default') >- .addClass('label-warning'); >- } else { >- $('#return-claims-count-unresolved').text(unresolved) >- .removeClass('label-warning') >- .addClass('label-default'); >- } >- >- fnCallback(json) >- } ); >- }, >- "search": { "search": "is_unresolved" }, >- "footerCallback": function (row, data, start, end, display) { >- var api = this.api(); >- // Total over all pages >- var colData = api.column(1).data(); >- var is_unresolved = 0; >- var is_resolved = 0; >- colData.each(function( index, value ){ >- if( index == "is_unresolved" ){ is_unresolved++; } >- if (index == "is_resolved") { is_resolved++; } >- }); >- // Update footer >- $("#return-claims-controls").html( showClaimFilter( is_unresolved, is_resolved ) ) >- } >- }); >- } >- } >- >- function showClaimFilter( is_unresolved, is_resolved ){ >- var showAll, showUnresolved; >- var total = Number( is_unresolved ) + Number( is_resolved ); >- if( total > 0 ){ >- showAll = __nx("Show 1 claim", "Show all {count} claims", total, { count: total }); >- } else { >- showAll = ""; >- } >- if( is_unresolved > 0 ){ >- showUnresolved = __nx("Show 1 unresolved claim", "Show {count} unresolved claims", is_unresolved, { count: is_unresolved }) >- } else { >- showUnresolved = ""; >- } >- $("#show_all_claims").html( showAll ); >- $("#show_unresolved_claims").html( showUnresolved ); >- } >- > $('body').on('click', '.return-claim-tools-editnotes', function() { > let id = $(this).data('return-claim-id'); > $('#return-claim-notes-static-' + id).parent().dblclick(); >@@ -1276,4 +1299,15 @@ $(document).ready(function() { > $("#return-claims-table").DataTable().search("is_unresolved").draw(); > }); > >+ $("body").on("click", "#add_patron_to_list", function(e){ >+ e.preventDefault(); >+ addToList(); >+ }); >+ >+ $("#table_listnopatron, #table_inlists").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "columnDefs": [ >+ { 'sortable': false, "bSearchable": false, 'targets': [ 'NoSort' ] } >+ ], >+ "sPaginationType": "full" >+ })); > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/recalls.js b/koha-tmpl/intranet-tmpl/prog/js/recalls.js >index 9ab3494f1b..db33a12257 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/recalls.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/recalls.js >@@ -12,6 +12,8 @@ $(document).ready(function() { > message = __("The recall may have already been cancelled. Please refresh the page."); > } else { > message = __("Cancelled"); >+ let recallsCount = $("#recalls-count"); >+ refreshTabCount( recallsCount, ( Number( recallsCount.text() ) - 1 ) ); > } > td_node.html(message); > }, >-- >2.39.2
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