Nick Clemens
fe508be07a
This patchset adds a new ability to save searches on the staff client, and display them in the results page on staff or opac as a new filter. New filters can be added from the resuilts page after a search, and there is an admin page for updating deleting and renaming filters There is a new permission to control management of these filters New filters can be added that are not displayed along with facets, this allows for building custom links using these filters to keep URLs shorter Due to bug 30528 testing in ES is recommended To test: 1 - Apply patches and update database and restart all 2 - Enable new system preference 'SavedSearchFilters' 3 - As superlibrarian perform a search in staff client, something broad like 'a' 4 - Note new 'Save search as filter' link on results page 5 - Click it, save search as new filter, check 'Staff client' visibility 6 - Perform another search 7 - Note the filter now appears above facets 8 - Click to it filter results 9 - Note results are limited by the new filter, and it is checked in the facets 10 - Confirm click the [x] removes the filter 11 - Go to administration->search filters 12 - Confirm the filter appears 13 - Edit and mark as OPAC visible 14 - Test OPAC to ensure it shows and can be applied/removed 15 - Copy URL with filter applied 16 - In adminsitration mark filter as not visible on staff or opac 17 - Confirm link above still works 18 - Create a new staff with catalogue and search filters permission 19 - Ensure they can access/save filters 20 - Remove filter permission and ensure they cannot 21 - Disable system preference 22 - Confirm links to search filters page are removed from admin home and admin sidebar 23 - Confirm filters do not appear on results and cannot be created 24 - Enable pref 25 - Create a filter 26 - From search filters page, click 'Edit search' 27 - Confirm you are taken to advanced search page letting you know which filter you are editing 28 - Confirm you can change searhc options and save 29 - Confirm you can perform the search from this page Sponsored-by: Sponsored by: Round Rock Public Library [https://www.roundrocktexas.gov/departments/library/] Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
60 lines
1.6 KiB
Perl
Executable file
60 lines
1.6 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
# Copyright 2013 BibLibre
|
|
#
|
|
# This file is part of Koha
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
|
|
|
use Modern::Perl;
|
|
use CGI;
|
|
|
|
use C4::Auth qw( get_template_and_user );
|
|
use C4::Output qw( output_html_with_http_headers );
|
|
|
|
use Koha::SearchFilters;
|
|
|
|
use Try::Tiny qw( catch try);
|
|
|
|
my $cgi = CGI->new;
|
|
|
|
my ($template, $borrowernumber, $cookie) = get_template_and_user({
|
|
template_name => 'admin/search_filters.tt',
|
|
query => $cgi,
|
|
type => 'intranet',
|
|
flagsrequired => { parameters => 'manage_search_filters' },
|
|
});
|
|
|
|
my $op = $cgi->param('op') || '';
|
|
|
|
if ($op eq 'del') {
|
|
my $id = $cgi->param('id');
|
|
my $sf = Koha::SearchFilters->find($id);
|
|
$template->param(filter_not_found => 1) unless $sf;
|
|
if ($sf) {
|
|
try{
|
|
$sf->delete();
|
|
$template->param( filter_deleted => $sf->name );
|
|
} catch {
|
|
$template->param( error => $_ );
|
|
};
|
|
}
|
|
}
|
|
|
|
my $filters = Koha::SearchFilters->search();
|
|
|
|
$template->param(
|
|
filters_count => $filters->count,
|
|
);
|
|
|
|
output_html_with_http_headers $cgi, $cookie, $template->output;
|