Bugzilla – Attachment 127136 Details for
Bug 27296
Return claims should be filtered by default to show unresolved claims
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27296: Return claims should be filtered by default to show unresolved claims
Bug-27296-Return-claims-should-be-filtered-by-defa.patch (text/plain), 8.64 KB, created by
Katrin Fischer
on 2021-10-31 13:25:29 UTC
(
hide
)
Description:
Bug 27296: Return claims should be filtered by default to show unresolved claims
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-10-31 13:25:29 UTC
Size:
8.64 KB
patch
obsolete
>From 3f105642d252fabd325c1cfb54e4cbd56f5b90ae Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 9 Nov 2020 19:36:22 +0000 >Subject: [PATCH] Bug 27296: Return claims should be filtered by default to > show unresolved claims > >This patch modifies the DataTables configuration of the return claims >table on the checkout and patron detail pages. Using the footerCallback >function, the count of resolved and unresolved claims is calculated and >used to filter the list of claims to show only unresolved claims by >default. > >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). > >- If necessary, Enable claims returned functionality by defining a value > in the ClaimReturnedLostValue system preference. >- Open for checkout a patron who has items checked out. >- From the table of checkouts, click "Claim returned" for one or more > items. > - As you mark items "Clamed returned," the the items should appear > under the "Claims" tab. The corresonding filter links should be > updated accordingly, "Show all X claims." > - Mark one or more claims resolved. As you do so they should disappear > from the list of claims. The filter links should be updated to > reflect that there are some resolved and some unresolved claims. > - Clicking each filter link should trigger the correct filter. > - Test this process when the count of unresolved claims is zero and > when the cound of resolved claims is zero. > >TESTING TRANSLATABILITY > >- Update a translation, e.g. fr-FR: > > > cd misc/translator > > perl translate update fr-FR > >- Open the corresponding .po file for JavaScript strings, e.g. > misc/translator/po/fr-FR-messages-js.po >- Locate strings pulled from > koha-tmpl/intranet-tmpl/prog/js/checkouts.js for > translation, e.g.: > > #: koha-tmpl/intranet-tmpl/prog/js/checkouts.js:1086 > msgid "Show 1 claim" > msgid_plural "Show all {count} claims" > msgstr[0] "" > msgstr[1] "" > >- Edit the "msgstr" strings however you want (it's just for testing). >- Install the updated translation: > > > perl translate install fr-FR > >- Switch to your newly translated language in the staff client and > repeat the test plan above. The translated strings should appear. > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../intranet-tmpl/prog/css/src/staff-global.scss | 5 +- > .../prog/en/includes/patron-return-claims.inc | 12 ++++- > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 59 ++++++++++++++++++++++ > 3 files changed, 74 insertions(+), 2 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 df2354cad2..3afc4757b8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -70,7 +70,6 @@ a { > } > } > >- > &.csv { > background-image: url("../img/famfamfam/silk/page_white_excel.png"); > } >@@ -133,6 +132,10 @@ a { > } > > } >+a.ctrl_link { >+ display: inline-block; >+ padding-right: 1rem; >+} > > aside { > h5 { >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 63f1dad303..b2ad9700a9 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,14 +1,24 @@ > <div id="return-claims"> >+ <p id="return-claims-controls"> >+ [% IF ( patron.return_claims.resolved.count > 0 || patron.return_claims.unresolved.count > 0 ) %] >+ <a id="show_all_claims" class="ctrl_link" href="#">Show all [% patron.return_claims.count | html %] claim(s)</a> >+ <a id="show_unresolved_claims" class="ctrl_link disabled" href="#">Show [% patron.return_claims.unresolved.count | html %] unresolved claims</a> >+ [% ELSE %] >+ <a id="show_all_claims" class="ctrl_link" href="#"></a> >+ <a id="show_unresolved_claims" class="ctrl_link disabled" href="#"></a> >+ [% END %] >+ </p> > <table id="return-claims-table" class="table table-bordered table-striped"> > <thead> > <tr> > <th class="return-claim-id">Claim ID</th> >+ <th class="return-claim-id">Resolved?</th> > <th class="return-claim-record-title anti-the">Title</th> > <th class="return-claim-notes">Notes</th> > <th class="return-claim-created-on">Created on</th> > <th class="return-claim-updated-on">Updated on</th> > <th class="return-claim-resolution">Resolution</th> >- <th class="return-claim-actions"> </th> >+ <th class="return-claim-actions NoSort"> </th> > </tr> > </thead> > </table> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index 1ecd66002f..e31585814a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -954,12 +954,26 @@ $(document).ready(function() { > "bAutoWidth": false, > "sDom": "rt", > "aaSorting": [], >+ "aoColumnDefs": [ >+ { "bSortable": false, "bSearchable": false, 'aTargets': ['NoSort'] }, >+ { "sType": "anti-the", "aTargets": ["anti-the"] }, >+ ], > "aoColumns": [ > { > "mDataProp": "id", > "bVisible": false, > }, > { >+ "mDataProp": function (oObj) { >+ if (oObj.resolution) { >+ return "is_resolved"; >+ } else { >+ return "is_unresolved"; >+ } >+ }, >+ "bVisible": false, >+ }, >+ { > "mDataProp": function ( oObj ) { > let title = '<a class="return-claim-title strong" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + oObj.biblionumber + '">' > + oObj.title >@@ -1068,10 +1082,41 @@ $(document).ready(function() { > 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(); >@@ -1182,4 +1227,18 @@ $(document).ready(function() { > > }); > >+ $("#show_all_claims").on("click", function(e){ >+ e.preventDefault(); >+ $(".ctrl_link").removeClass("disabled"); >+ $(this).addClass("disabled"); >+ $("#return-claims-table").DataTable().search("").draw(); >+ }); >+ >+ $("#show_unresolved_claims").on("click", function (e) { >+ e.preventDefault(); >+ $(".ctrl_link").removeClass("disabled"); >+ $(this).addClass("disabled"); >+ $("#return-claims-table").DataTable().search("is_unresolved").draw(); >+ }); >+ > }); >-- >2.11.0
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 27296
:
114619
|
126351
| 127136