Bugzilla – Attachment 17693 Details for
Bug 10124
Pending orders: ergonomic improvement
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10124: Add filters on the pending orders table
Bug-10124-Add-filters-on-the-pending-orders-table.patch (text/plain), 8.30 KB, created by
Jonathan Druart
on 2013-04-26 07:38:57 UTC
(
hide
)
Description:
Bug 10124: Add filters on the pending orders table
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-04-26 07:38:57 UTC
Size:
8.30 KB
patch
obsolete
>From 2033d7ad4686d788ef1a3d6bab236336b4d884f0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 25 Apr 2013 16:57:07 +0200 >Subject: [PATCH] Bug 10124: Add filters on the pending orders table > >Since the parcel.pl script get *all* pending orders, there is no reason >not to display all of them. > >Like that, DataTable manages pagination and sorting correctly (on all >data). >This patch adds filters on the table header (using columnFilter). > >Test plan: >Try filters on the left of the screen and filters on the table header. >--- > acqui/parcel.pl | 37 +-------- > .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 81 +++++++++++--------- > 2 files changed, 48 insertions(+), 70 deletions(-) > >diff --git a/acqui/parcel.pl b/acqui/parcel.pl >index 57e0e11..d32303c 100755 >--- a/acqui/parcel.pl >+++ b/acqui/parcel.pl >@@ -212,7 +212,7 @@ for my $item ( @parcelitems ) { > push @book_foot_loop, map { $_ } values %foot; > > my @loop_orders = (); >-if(!defined $invoice->{closedate}) { >+unless( defined $invoice->{closedate} ) { > my $pendingorders; > if($input->param('op') eq "search"){ > my $search = $input->param('summaryfilter') || ''; >@@ -297,40 +297,7 @@ if(!defined $invoice->{closedate}) { > my $budget = GetBudget( $line{budget_id} ); > $line{budget_name} = $budget->{'budget_name'}; > >- push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage); >- } >- >- my $count = $countpendings; >- >- if ($count>$resultsperpage){ >- my $displaynext=0; >- my $displayprev=$startfrom; >- if(($count - ($startfrom+$resultsperpage)) > 0 ) { >- $displaynext = 1; >- } >- >- my @numbers = (); >- for (my $i=1; $i<$count/$resultsperpage+1; $i++) { >- my $highlight=0; >- ($startfrom/$resultsperpage==($i-1)) && ($highlight=1); >- push @numbers, { number => $i, >- highlight => $highlight , >- startfrom => ($i-1)*$resultsperpage}; >- } >- >- my $from = $startfrom*$resultsperpage+1; >- my $to; >- if($count < (($startfrom+1)*$resultsperpage)){ >- $to = $count; >- } else { >- $to = (($startfrom+1)*$resultsperpage); >- } >- $template->param(numbers=>\@numbers, >- displaynext=>$displaynext, >- displayprev=>$displayprev, >- nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count), >- prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0) >- ); >+ push @loop_orders, \%line; > } > > $template->param( >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >index 6cde848..bf557ef 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >@@ -4,6 +4,7 @@ > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> > [% INCLUDE 'doc-head-close.inc' %] > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script> > [% INCLUDE 'datatables-strings.inc' %] > <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> > [% INCLUDE 'greybox.inc' %] >@@ -14,10 +15,11 @@ > dt_overwrite_html_sorting_localeCompare(); > > $(document).ready(function(){ >+ > var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, { > "bStateSave": true, > "iCookieDuration": 60*60*24*1000, // 1000 days >- "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]], >+ "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]], > "aoColumnDefs": [ > { "aTargets": [ 3, 8, 9 ], "bSortable": false, "bSearchable": false }, > ], >@@ -33,12 +35,29 @@ > null, > null, > ], >+ 'bAutoWidth': false, > "sPaginationType": "four_button" >- } ) ); >+ } ) >+ ).columnFilter({ >+ sPlaceHolder: "head:after", >+ aoColumns: [ >+ { type: "text" }, >+ { type: "text" }, >+ { type: "text" }, >+ null, >+ { type: "text" }, >+ { type: "text" }, >+ { type: "text" }, >+ { type: "text" }, >+ null, >+ null >+ ] >+ }); >+ > var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, { > "bStateSave": true, > "iCookieDuration": 60*60*24*1000, // 1000 days >- "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]], >+ "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]], > "aoColumnDefs": [ > { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false }, > ], >@@ -55,12 +74,6 @@ > ], > "sPaginationType": "four_button" > } ) ); >-/* >- $("#pendingt").tablesorter({ >- headers: { 2: { sorter: 'articles' },3: { sorter: false },8:{sorter:false}} >- }); >-*/ >- > }); > > // Case-insensitive version of jquery's contains function >@@ -165,12 +178,25 @@ > <p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% formatteddatereceived %]</p> > </div> > [% UNLESS (invoiceclosedate) %] >-<div id="acqui_receive_search"> >+ <div id="acqui_receive_search"> > <h3>Pending orders</h3> > >- [% IF ( loop_orders ) %]<table id="pendingt"> >- <thead> >- <tr> >+ [% IF ( loop_orders ) %] >+ <table id="pendingt"> >+ <thead> >+ <tr> >+ <th>Basket search</th> >+ <th>Order line search</th> >+ <th>Summary search</th> >+ <th> </th> >+ <th>Quantity search</th> >+ <th>Unit cost search</th> >+ <th>Order cost search</th> >+ <th>Fund search</th> >+ <th> </th> >+ <th> </th> >+ </tr> >+ <tr> > <th>Basket</th> > <th>Order line</th> > <th>Summary</th> >@@ -181,9 +207,9 @@ > <th>Fund</th> > <th> </th> > <th> </th> >- </tr> >- </thead> >- <tbody class="filterclass"> >+ </tr> >+ </thead> >+ <tbody class="filterclass"> > [% FOREACH loop_order IN loop_orders %] > <tr> > <td class="basketfilterclass">[% loop_order.basketname %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno %]">[% loop_order.basketno %]</a>)</td> >@@ -238,26 +264,11 @@ > [% END %] > </td> > </tr> >- [% END %] >- </tbody> >- </table>[% ELSE %]There are no pending orders.[% END %] >- <div id="resultnumber"> >- <!-- Row of numbers corresponding to search result pages --> >- [% IF ( displayprev ) %] >- <a href="parcel.pl?invoiceid=[% invoiceid %]&startfrom=[% prevstartfrom %][% IF ( resultsperpage ) %]&resultsperpage=[% resultsperpage %][% END %]#resultnumber"><< Previous</a> >- [% END %] >- [% FOREACH number IN numbers %] >- [% IF ( number.highlight ) %] >- <span class="current">[% number.number %]</span> >- [% ELSE %] >- <a href="parcel.pl?invoiceid=[% invoiceid %]&startfrom=[% number.startfrom %][% IF ( resultsperpage ) %]&resultsperpage=[% resultsperpage %][% END %]#resultnumber">[% number.number %]</a> >- [% END %] > [% END %] >- [% IF ( displaynext ) %] >- <a href="parcel.pl?invoiceid=[% invoiceid %]&startfrom=[% nextstartfrom %][% IF ( resultsperpage ) %]&resultsperpage=[% resultsperpage %][% END %]#resultnumber">Next >></a> >- [% END %] >- </div> >- </div> >+ </tbody> >+ </table> >+ [% ELSE %]There are no pending orders.[% END %] >+ </div> > [% ELSE %] > <p> > Invoice is closed, so you can't receive orders anymore. >-- >1.7.10.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 10124
:
17691
|
17692
|
17693
|
17701
|
18493
|
18494
|
18495
|
18501
|
18502
|
18503
|
19309
|
19636
|
19637
|
19638
|
19639
|
19640