Bug 27402: Add DT column filtering to the cities admin page
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 8 Jan 2021 11:10:22 +0000 (12:10 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 28 Jan 2021 15:41:22 +0000 (16:41 +0100)
commit829d193a1aee8492336c300b2314473420f7bb80
tree1fae8d4123381d014ce45863e42fee7aec111e6c
parentab5663ca84c88f8b76481c238dbae8b4dcdf2c79
Bug 27402: Add DT column filtering to the cities admin page

Bug 24561 added a wrapper to use easily all the DataTables functionalities when a REST API route was used within Koha.

The filtering method used is working for the global search filter, but not if we have a filter on top of each column.

This patchset is going to, first, add the filters on top of each column
of the cities table, then the code will be moved to the DT REST API wrapper to make it reusable easily.

Test plan:

Generate some cities:
  use Koha::Cities;
  for ( 1 .. 42 ) {
      Koha::City->new({city_name => "name_$_", city_state => "state_$_", city_country => "country_$_", city_zipcode => "zipcode_$_" })->store;
  }
Hit /admin/cities.pl
Use the filters

The general filter must do a OR query on each of the cities' attributes,
when column filters must use AND

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt