Bugzilla – Attachment 59312 Details for
Bug 13371
Add filters to the supplier list view
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13371: Add filters on the supplier list view
Bug-13371-Add-filters-on-the-supplier-list-view.patch (text/plain), 24.39 KB, created by
Julian Maurice
on 2017-01-20 09:42:47 UTC
(
hide
)
Description:
Bug 13371: Add filters on the supplier list view
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2017-01-20 09:42:47 UTC
Size:
24.39 KB
patch
obsolete
>From 3d9d0a92ddbde5e29535a4c2a924c84cb11a89a7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 1 Dec 2014 18:08:45 +0100 >Subject: [PATCH] Bug 13371: Add filters on the supplier list view >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch adds the ability to filter the basket list depending on its >creator name, basketgroup name, dates (creation, close), etc. >It also adds a new link to filter on opened baskets only and the ability >to switch to a simple view if the complete view is to complex > >Test plan: >Go on the supplier list view (acqui/booksellers.pl) and confirm that the >view is more ergonomic and the filters permit to the librarians to find >a basket more easily than before. > >Signed-off-by: Paola Rossi <paola.rossi@cineca.it> > >Followed test plan, works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> >--- > acqui/booksellers.pl | 11 + > koha-tmpl/intranet-tmpl/prog/css/datatables.css | 17 + > .../prog/en/modules/acqui/booksellers.tt | 369 +++++++++++++-------- > 3 files changed, 259 insertions(+), 138 deletions(-) > >diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl >index a4d010f033..7b8036b316 100755 >--- a/acqui/booksellers.pl >+++ b/acqui/booksellers.pl >@@ -156,11 +156,22 @@ for my $vendor (@suppliers) { > }; > > } >+ >+my $sessionID = $query->cookie('CGISESSID'); >+my $session = C4::Auth::get_session($sessionID); >+my $view = $query->param('view'); >+if ( $view ) { >+ $session->param('bookseller_default_view', $view); >+} else { >+ $view = $session->param('bookseller_default_view'); >+} >+ > $template->param( > loop_suppliers => $loop_suppliers, > supplier => ( $booksellerid || $supplier ), > count => $supplier_count, > has_budgets => $has_budgets, >+ view => $view, > ); > $template->{VARS}->{'allbaskets'} = $allbaskets; > >diff --git a/koha-tmpl/intranet-tmpl/prog/css/datatables.css b/koha-tmpl/intranet-tmpl/prog/css/datatables.css >index 71fdb6b2ec..f7e73609ce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/datatables.css >+++ b/koha-tmpl/intranet-tmpl/prog/css/datatables.css >@@ -263,6 +263,23 @@ table.group td.group { > background-color: #D1CFD0; > border-bottom: 2px solid #A19B9E; > border-top: 2px solid #A19B9E; >+ font-weight: bold; >+} >+ >+table.group tr.odd td { >+ background-color : #F3F3F3; >+ border : 1px solid #BCBCBC; >+ border-right : 1px solid #BCBCBC; >+} >+ >+table.group tr.even td { >+ background-color: #FFF; >+ border-right : 1px solid #BCBCBC; >+} >+ >+table.group td.group .action { >+ float: right; >+ font-weight: normal; > } > > table.group tr.odd td { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt >index 1384c1a705..4d1a25e98e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt >@@ -2,28 +2,79 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Search for vendor [% supplier %]</title> > [% INCLUDE 'doc-head-close.inc' %] >-<style type="text/css"> >-#vendors td{ >- vertical-align: top; >-} >-</style> > <link rel="stylesheet" href="[% interface %]/[% theme %]/css/datatables.css" /> >+[% INCLUDE 'calendar.inc' %] > [% INCLUDE 'datatables.inc' %] >+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script> >+ > <script type="text/javascript"> > //<![CDATA[ >+var SHOW_ONLY_OPENED = _("Show opened baskets only"); >+var SHOW_ALL = _("Show opened and closed baskets"); >+var only_opened = 0; > $(document).ready(function() { >- $("table.baskets").dataTable($.extend(true, {}, dataTablesDefaults, { >- 'sDom': 't', >- 'bPaginate': false, >- 'bFilter': false, >- 'bInfo': false, >- "aaSorting": [[ 1, "asc" ]], >+ var thead_row = $("#baskets").find('thead tr'); >+ var clone = thead_row.clone().addClass('filters_row'); >+ thead_row.before(clone); >+ >+ var table = $("#baskets").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "fnDrawCallback": function ( oSettings ) { >+ if ( oSettings.aiDisplay.length == 0 ) >+ { >+ return; >+ } >+ >+ var nTrs = $('#baskets tbody tr'); >+ var iColspan = nTrs[0].getElementsByTagName('td').length; >+ var sLastGroup = ""; >+ for ( var i=0 ; i<nTrs.length ; i++ ) >+ { >+ var iDisplayIndex = oSettings._iDisplayStart + i; >+ var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0]; >+ if ( sGroup != sLastGroup ) >+ { >+ var nGroup = document.createElement( 'tr' ); >+ var nCell = document.createElement( 'td' ); >+ nCell.colSpan = iColspan; >+ nCell.className = "group"; >+ nCell.innerHTML = sGroup; >+ nGroup.appendChild( nCell ); >+ nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); >+ sLastGroup = sGroup; >+ } >+ } >+ }, > "aoColumnDefs": [ >- { "sType": "title-string", "aTargets" : [ "title-string" ] }, >- { "sType": "title-numeric", "aTargets" : [ "title-numeric" ] }, >- { 'aTargets': [-1], 'bSortable': false } >- ] >- })); >+ { "bVisible": false, "aTargets": [ 'NoVisible' ] }, >+ { "bSortable": false, "aTargets": ["_all"] } >+ ], >+ 'bSort': true, >+ 'aaSortingFixed': [[ 0, 'asc' ]], >+ 'bPaginate': false, >+ 'bAutoWidth': false >+ })).columnFilter( >+ { >+ 'sPlaceHolder': 'head:after', >+ // The first column is hidden >+ // Without bUseColVis, the filters don't work on the correct column. >+ 'bUseColVis': true, >+ 'aoColumns': [ >+ null, >+ { type: 'text' }, >+ { type: 'text' }, >+ { type: 'text' }, >+ { type: 'text' }, >+ { type: 'text' }, >+ { type: 'text' }, >+ { type: 'date-range' }, >+ { type: 'text' }, >+ { type: 'date-range' }, >+ null >+ >+ ] >+ } >+ ); >+ > $("#supplierlist").change(function() { > var id = $(this).find("option:selected").val(); > window.location.href = "#" + id; >@@ -33,6 +84,19 @@ $(document).ready(function() { > var legend = _("Add order to basket %s").format(basket); > $(this).find("legend").html(legend); > }); >+ >+ $("#toggle_closed_baskets").on('click', function(e){ >+ e.preventDefault(); >+ if( only_opened ) { >+ $(this).text(SHOW_ONLY_OPENED); >+ table.fnFilter('', 9); >+ only_opened = 0; >+ } else { >+ $(this).text(SHOW_ALL); >+ table.fnFilter('^$', 9, 1); >+ only_opened = 1; >+ } >+ }); > }); > //]]> > </script> >@@ -59,139 +123,168 @@ $(document).ready(function() { > [% ELSE %] > <h1>Vendor search: [% count %] results found for '[% supplier %]'</h1> > [% END %] >-[% END %] >-[% IF ( loop_suppliers.size ) %] >- [% UNLESS (count == 1) %] >- <p>Choose a vendor in the list to jump directly to the right place. >- <select id="supplierlist"> >- [% FOREACH supplier1 IN loop_suppliers %] >- <option value="[% supplier1.booksellerid %]">[% supplier1.name %]</option> >+ >+ [% BLOCK action %] >+ <span class="action"> >+ [% IF CAN_user_acquisition_order_manage %] >+ [% IF supplier.active %] >+ <a class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% supplier.booksellerid %]&op=add_form"><i class="fa fa-plus"></i> New basket</a> >+ [% END %] >+ [% END %] >+ [% IF ( supplier.loop_basket.size ) %] >+ <a class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% supplier.booksellerid %]"><i class="fa fa-inbox"></i> Receive shipment</a> > [% END %] >- </select> >- </p> >+ </span> > [% END %] >- [% IF ( allbaskets ) %] >- <p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]">Show active baskets only</a></p> >+[% END %] >+[% IF ( loop_suppliers.size ) %] >+ [% IF view == "complete" %] >+ <p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&view=simple">Switch to the simple view</a></p> > [% ELSE %] >- <p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]&allbaskets=1">Show all baskets</a></p> >+ <p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&view=complete">Switch to the complete view</a></p> > [% END %] >- <div id="acqui_order_supplierlist"> >- [% FOREACH supplier IN loop_suppliers %] >- <div class="supplier"> >- <span class="suppliername"> >- [% IF (supplier.name) %] >- <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a> >+ >+ [% IF view == "complete" %] >+ [% IF allbaskets %] >+ <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]">Show active baskets only</a> >+ [% ELSE %] >+ <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]&allbaskets=1">Show active and inactive baskets</a> >+ [% END %] >+ | <a href="#" id="toggle_closed_baskets">Show opened baskets only</a> >+ <div id="acqui_order_basketlist"> >+ <table id="baskets" class="group"> >+ <thead> >+ <tr> >+ <th class='NoVisible'>bookseller</th> >+ <th>No.</th> >+ <th>Name</th> >+ <th>Item count</th> >+ <th>Biblio count</th> >+ <th>Items expected</th> >+ <th>Created by</th> >+ <th class="title-string">Date</th> >+ <th>Basket group</th> >+ <th class="title-string">Closed</th> >+ <th> </th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH supplier IN loop_suppliers %] >+ [% IF supplier.loop_basket.size == 0 %] >+ <tr> >+ <td> >+ <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a> >+ ([% supplier.booksellerid %]) >+ [% PROCESS action supplier = supplier %] >+ </td> >+ <td> >+ [% IF allbaskets %] >+ No basket. >+ [% ELSE %] >+ No active basket. >+ [% END %] >+ </td> >+ <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td> >+ </tr> >+ [% END %] >+ [% FOREACH basket IN supplier.loop_basket %] >+ [% IF ( basket.uncertainprices ) %] >+ <tr class="problem"> > [% ELSE %] >- <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">NO NAME</a> >+ <tr> > [% END %] >- </span> >- <span class="action"> >- [% IF ( CAN_user_acquisition_order_manage ) %] >- [% IF ( supplier.active ) %] >- <a class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% supplier.booksellerid %]&op=add_form"><i class="fa fa-plus"></i> New basket</a> >+ <td> >+ <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a> >+ ([% supplier.booksellerid %]) >+ [% PROCESS action supplier = supplier %] >+ </td> >+ <td>[% basket.basketno %]</td> >+ <td>[% basket.basketname %]</td> >+ <td> >+ [% basket.total_items %] >+ [% IF basket.total_items_cancelled %] >+ ([% basket.total_items_cancelled %] cancelled) >+ [% END %] >+ </td> >+ <td> >+ [% basket.total_biblios %] >+ [% IF basket.total_biblios_cancelled %] >+ ([% basket.total_biblios_cancelled %] cancelled) >+ [% END %] >+ </td> >+ <td>[% basket.expected_items %]</td> >+ <td> >+ [% basket.authorisedby_firstname %] [% basket.authorisedby_surname %] >+ </td> >+ <td><span title="[% basket.creationdate %]">[% basket.creationdate | $KohaDates %]</span></td> >+ <td> >+ [% IF basket.basketgroup %] >+ [% basketgroup = basket.basketgroup %] >+ [% IF basketgroup.closed %] >+ [% basketgroup.name %] (closed) >+ [% ELSE %] >+ <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% basket.booksellerid %]&basketgroupid=[% basketgroup.id %]">[% basketgroup.name %]</a> >+ [% END %] >+ [% END %] >+ </td> >+ <td> >+ [% IF ( basket.closedate ) %] >+ <span title="[% basket.closedate %]">[% basket.closedate | $KohaDates %]</span> >+ [% ELSE %] >+ <span title="9999-99-99"></span> >+ [% END %] >+ </td> >+ <td class="actions"> >+ <a class="btn btn-mini" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]"><i class="fa fa-eye"></i> View</a> >+ >+ [% IF not basket.closedate and supplier.active %] >+ <a class="btn btn-mini" id="addtoBasketLabel[% basket.basketno %]" href="#addtoBasket[% basket.basketno %]" role="button" data-toggle="modal"><i class="fa fa-plus"></i> Add to basket</a> >+ <!-- Modal --> >+ <div id="addtoBasket[% basket.basketno %]" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel[% basket.basketno %]" aria-hidden="true" data-basketno="[% basket.basketname %]"> >+ <div class="modal-body"> >+ [% INCLUDE 'acquisitions-add-to-basket.inc' booksellerid=supplier.booksellerid basketno=basket.basketno %] >+ </div> >+ <div class="modal-footer"> >+ <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a> >+ </div> >+ </div> >+ [% END %] >+ </td> >+ </tr> >+ [% END %][%# FOREACH basket IN supplier.loop_basket %] >+ [% END %] >+ </tbody> >+ </table> >+ </div> >+ [% ELSE %] >+ <div id="acqui_order_supplierlist"> >+ [% FOREACH supplier IN loop_suppliers %] >+ <div class="supplier"> >+ <span class="suppliername"> >+ [% IF (supplier.name) %] >+ <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a> > [% ELSE %] >- (inactive) >+ <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">NO NAME</a> >+ [% END %] >+ </span> >+ <span class="action"> >+ [% IF ( CAN_user_acquisition_order_manage ) %] >+ [% IF ( supplier.active ) %] >+ <a class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% supplier.booksellerid %]&op=add_form"><i class="fa fa-plus"></i> New basket</a> >+ [% ELSE %] >+ (inactive) >+ [% END %] > [% END %] >- [% END %] > [% IF ( supplier.loop_basket.size ) %] >- <a class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% supplier.booksellerid %]"><i class="fa fa-inbox"></i> Receive shipment</a> >+ <a class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% supplier.booksellerid %]"><i class="fa fa-inbox"></i> Receive shipment</a> > [% END %] >- </span> >- <div class="baskets"> >- [% IF ( supplier.loop_basket.size ) %] >- <table class="baskets"> >- <thead> >- <tr> >- <th>No.</th> >- <th>Name</th> >- <th class="title-numeric">Item count</th> >- <th class="title-numeric">Biblio count</th> >- <th>Items expected</th> >- <th>Created by</th> >- <th class="title-string">Date</th> >- <th>Basket group</th> >- <th class="title-string">Closed</th> >- <th>Actions</th> >- </tr> >- </thead> >- <tbody> >- [% FOREACH basket IN supplier.loop_basket %] >- [% IF ( basket.uncertainprices ) %] >- <tr class="problem"> >- [% ELSE %] >- <tr> >- [% END %] >- <td>[% basket.basketno %]</td> >- <td>[% basket.basketname %]</td> >- <td> >- <span title="[% basket.total_items %]">[% basket.total_items %] >- [% IF basket.total_items_cancelled %] >- ([% basket.total_items_cancelled %] cancelled) >- [% END %] >- </span> >- </td> >- <td> >- <span title="[% basket.total_biblios %]">[% basket.total_biblios %] >- [% IF basket.total_biblios_cancelled %] >- ([% basket.total_biblios_cancelled %] cancelled) >- [% END %] >- </span> >- </td> >- <td>[% basket.expected_items %]</td> >- <td> >- [% basket.authorisedby_firstname %] >- [% basket.authorisedby_surname %] >- </td> >- <td><span title="[% basket.creationdate %]">[% basket.creationdate | $KohaDates %]</span></td> >- <td> >- [% IF basket.basketgroup %] >- [% basketgroup = basket.basketgroup %] >- [% IF basketgroup.closed %] >- [% basketgroup.name %] (closed) >- [% ELSE %] >- <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% basket.booksellerid %]&basketgroupid=[% basketgroup.id %]">[% basketgroup.name %]</a> >- [% END %] >- [% END %] >- </td> >- <td> >- [% IF ( basket.closedate ) %] >- <span title="[% basket.closedate %]">[% basket.closedate | $KohaDates %]</span> >- [% ELSE %] >- <span title="9999-99-99"></span> >- [% END %] >- </td> >- <td class="actions"> >- <a class="btn btn-default btn-xs" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]"><i class="fa fa-eye"></i> View</a> >- >- [% IF not basket.closedate and supplier.active %] >- <a class="btn btn-default btn-xs" id="addtoBasketLabel[% basket.basketno %]" href="#addtoBasket[% basket.basketno %]" role="button" data-toggle="modal"><i class="fa fa-plus"></i> Add to basket</a> >- <!-- Modal --> >- <div id="addtoBasket[% basket.basketno %]" class="modal" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel[% basket.basketno %]" aria-hidden="true" data-basketno="[% basket.basketname %]"> >- <div class="modal-dialog"> >- <div class="modal-content"> >- <div class="modal-body"> >- [% INCLUDE 'acquisitions-add-to-basket.inc' booksellerid=supplier.booksellerid basketno=basket.basketno %] >- </div> >- <div class="modal-footer"> >- <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a> >- </div> >- </div> >- </div> >- </div> >- [% END %] >- </td> >- </tr> >- [% END %][%# FOREACH basket IN supplier.loop_basket %] >- </tbody> >- </table> >- >- [% ELSE %] >- <p>No pending baskets</p> >- [% END %][%# IF ( supplier.loop_basket.size ) %] >+ </span> > </div> >- </div> >- [% END %][%# FOREACH supplier IN loop_suppliers %] >- </div> >+ [% END %] >+ </div> >+ [% END %] >+[% ELSE %] >+ <p>No pending baskets</p> > [% END %][%# IF ( loop_suppliers.size ) %] > </div> > </div> >-- >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 13371
:
34057
|
34058
|
34059
|
34167
|
34170
|
34275
|
34295
|
34296
|
34297
|
34298
|
34299
|
34306
|
34423
|
34424
|
34425
|
34433
|
34434
|
34435
|
34436
|
34437
|
34438
|
34439
|
36759
|
49014
|
49015
|
49016
|
49017
|
49018
|
49019
|
49020
|
49021
|
55235
|
55236
|
55237
|
55238
|
55239
|
55240
|
55241
|
55242
|
55243
|
55244
|
55245
|
55978
| 59312