Bugzilla – Attachment 60483 Details for
Bug 8548
Add callnumber sort option to overdue report
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8548: Add datatable to circ overdue report, remove sortby filter
Bug-8548-Add-datatable-to-circ-overdue-report-remo.patch (text/plain), 8.10 KB, created by
Aleisha Amohia
on 2017-02-20 22:27:39 UTC
(
hide
)
Description:
Bug 8548: Add datatable to circ overdue report, remove sortby filter
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2017-02-20 22:27:39 UTC
Size:
8.10 KB
patch
obsolete
>From f23d51ce38984b40e4f5c276c22c58aff38b5fe9 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 14 Feb 2017 01:36:44 +0000 >Subject: [PATCH] Bug 8548: Add datatable to circ overdue report, remove sortby > filter > >This patch adds a datatable to the circ overdue report. Since the >datatable makes sorting easy, I've also removed the sort by filter on >the side. > >To test: >1) Go to Circulation -> Overdues >2) Notice overdues report shows as datatable >3) Confirm sorting on all columns works >4) Test the Filters and confirm they all still work as expected > >Sponsored-by: Catalyst IT >Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >--- > circ/overdue.pl | 60 +--------------------- > .../intranet-tmpl/prog/en/modules/circ/overdue.tt | 34 +++--------- > 2 files changed, 9 insertions(+), 85 deletions(-) > >diff --git a/circ/overdue.pl b/circ/overdue.pl >index ab723e1..68abc84 100755 >--- a/circ/overdue.pl >+++ b/circ/overdue.pl >@@ -31,7 +31,6 @@ use DateTime; > use DateTime::Format::MySQL; > > my $input = new CGI; >-my $order = $input->param('order') || ''; > my $showall = $input->param('showall'); > my $bornamefilter = $input->param('borname') || ''; > my $borcatfilter = $input->param('borcat') || ''; >@@ -105,20 +104,6 @@ for my $attrcode (grep { /^patron_attr_filter_/ } $input->multi_param) { > my $have_pattr_filter_data = keys(%cgi_attrcode_to_attrvalues) > 0; > > my @patron_attr_filter_loop; # array of [ domid cgivalue ismany isclone ordinal code description repeatable authorised_value_category ] >-my @patron_attr_order_loop; # array of { label => $patron_attr_label, value => $patron_attr_order } >- >-my @sort_roots = qw(borrower title barcode date_due); >-push @sort_roots, map {$_ . " desc"} @sort_roots; >-my @order_loop = ({selected => $order ? 0 : 1}); # initial blank row >-foreach (@sort_roots) { >- my $tmpl_name = $_; >- $tmpl_name =~ s/\s/_/g; >- push @order_loop, { >- selected => $order eq $_ ? 1 : 0, >- ordervalue => $_, >- 'order_' . $tmpl_name => 1, >- }; >-} > > my $sth = $dbh->prepare('SELECT code,description,repeatable,authorised_value_category > FROM borrower_attribute_types >@@ -139,19 +124,7 @@ while (my $row = $sth->fetchrow_hashref) { > $row->{isclone} = $isclone; > push @patron_attr_filter_loop, { %$row }; # careful: must store a *deep copy* of the modified row > } continue { $isclone = 1, ++$serial } >- foreach my $sortorder ('asc', 'desc') { >- my $ordervalue = "patron_attr_${sortorder}_${code}"; >- push @order_loop, { >- selected => $order eq $ordervalue ? 1 : 0, >- ordervalue => $ordervalue, >- label => $row->{description}, >- $sortorder => 1, >- }; >- } > } continue { ++$ordinal } >-for (@patron_attr_order_loop) { $_->{selected} = 1 if $order eq $_->{value} } >- >-$template->param(ORDER_LOOP => \@order_loop); > > my %borrowernumber_to_attributes; # hash of { borrowernumber => { attrcode => [ [val,display], [val,display], ... ] } } > # i.e. val differs from display when attr is an authorised value >@@ -213,7 +186,6 @@ $template->param( > itemtypeloop => \@itemtypeloop, > patron_attr_filter_loop => \@patron_attr_filter_loop, > borname => $bornamefilter, >- order => $order, > showall => $showall, > dateduefrom => $dateduefrom, > datedueto => $datedueto, >@@ -300,14 +272,7 @@ if ($noreport) { > my $bnlist = $have_pattr_filter_data ? join(',',keys %borrowernumber_to_attributes) : ''; > $strsth =~ s/WHERE 1=1/WHERE 1=1 AND borrowers.borrowernumber IN ($bnlist)/ if $bnlist; > $strsth =~ s/WHERE 1=1/WHERE 0=1/ if $have_pattr_filter_data && !$bnlist; # no match if no borrowers matched patron attrs >- $strsth.=" ORDER BY " . ( >- ($order eq "borrower") ? "surname, firstname, date_due" : >- ($order eq "borrower desc") ? "surname desc, firstname desc, date_due" : >- ($order eq "title" or $order eq "title desc") ? "$order, date_due, surname, firstname" : >- ($order eq "barcode" or $order eq "barcode desc") ? "items.$order, date_due, surname, firstname" : >- ($order eq "date_due desc") ? "date_due DESC, surname, firstname" : >- "date_due, surname, firstname" # default sort order >- ); >+ $strsth.=" ORDER BY date_due, surname, firstname"; > $template->param(sql=>$strsth); > my $sth=$dbh->prepare($strsth); > $sth->execute( >@@ -363,29 +328,6 @@ if ($noreport) { > }; > } > >- my ($attrorder) = $order =~ /patron_attr_(.*)$/; >- my $patrorder = ''; >- my $sortorder = 'asc'; >- if (defined $attrorder) { >- ($sortorder, $patrorder) = split /_/, $attrorder, 2; >- } >- print STDERR ">>> order is $order, patrorder is $patrorder, sortorder is $sortorder\n" if $debug; >- >- if (my @attrtype = grep { $_->{'code'} eq $patrorder } @patron_attr_filter_loop) { # sort by patron attrs perhaps? >- my $ordinal = $attrtype[0]{ordinal}; >- print STDERR ">>> sort ordinal is $ordinal\n" if $debug; >- >- sub patronattr_sorter_asc { >- lc $a->{patron_attr_value_loop}[$ordinal]{value} >- cmp >- lc $b->{patron_attr_value_loop}[$ordinal]{value} } >- >- sub patronattr_sorter_des { -patronattr_sorter_asc() } >- >- my $sorter = $sortorder eq 'desc' ? \&patronattr_sorter_des : \&patronattr_sorter_asc; >- @overduedata = sort $sorter @overduedata; >- } >- > if ($op eq 'csv') { > binmode(STDOUT, ":encoding(UTF-8)"); > my $csv = build_csv(\@overduedata); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >index 6c3ee80..5e5f466 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >@@ -3,6 +3,8 @@ > <title>Koha › Circulation › Items overdue as of [% todaysdate %]</title> > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'calendar.inc' %] >+[% INCLUDE 'datatables.inc' %] >+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> > [%- USE Branches -%] > <script type="text/javascript"> > //<![CDATA[ >@@ -59,6 +61,12 @@ > }; > }); > } >+ >+ $(document).ready(function(){ >+ $("#overduest").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "sPaginationType": "four_button" >+ })); >+ }); > //]]> > </script> > <style type="text/css"> >@@ -233,32 +241,6 @@ > </select> > </li> > >- <li><label for="order">Sort by:</label> <select name="order" id="order"> >-[% FOREACH ORDER_LOO IN ORDER_LOOP %] >- [% IF ( ORDER_LOO.selected ) %] >- <option value="[% ORDER_LOO.ordervalue %]" selected="selected"> >- [% ELSE %] >- <option value="[% ORDER_LOO.ordervalue %]"> >- [% END %] >- [% IF ( ORDER_LOO.order_date_due ) %]Due date >- [% ELSIF ( ORDER_LOO.order_borrower ) %]Patron >- [% ELSIF ( ORDER_LOO.order_barcode ) %]Barcode >- [% ELSIF ( ORDER_LOO.order_title ) %]Title >- [% ELSIF ( ORDER_LOO.order_date_due_desc ) %]Due date desc >- [% ELSIF ( ORDER_LOO.order_borrower_desc ) %]Patron desc >- [% ELSIF ( ORDER_LOO.order_barcode_desc ) %]Barcode desc >- [% ELSIF ( ORDER_LOO.order_title_desc ) %]Title desc >- [% ELSE %][% ORDER_LOO.label %] >- [% IF ( ORDER_LOO.desc ) %]desc[% END %] >- [% END %] >- </option> >-[% END %] >- [% FOREACH patron_attr_order_loo IN patron_attr_order_loop %] >- [% IF ( patron_attr_order_loo.selected ) %]<option value="[% patron_attr_order_loo.value |html %]" selected="selected">[% patron_attr_order_loo.label %]</option> >- [% ELSE %]<option value="[% patron_attr_order_loo.value |html %]">[% patron_attr_order_loo.label %]</option>[% END %] >- [% END %] >-</select></li> >- > <li class="radio"><label for="showall">Show any items currently checked out:</label> > [% IF ( showall ) %] > <input type="checkbox" id="showall" name="showall" value="show" checked="checked" /> >-- >2.1.4
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 8548
:
60170
|
60466
|
60483
|
60484
|
61302