Bug 35916: Purchase suggestions bibliographic filter should be a "contains" search

Make all bibliographic information fields filter do a contain match
rather than an exact match

Test plan:
1. Create a purchase suggestion with a multi-word title (e.g. one day in december)
   1.1. Go to Acquisitions > Suggestions > New purchase suggestion
   1.2. Enter a title (e.g. one day in december)
   1.3. Click on Submit your suggestion

2. Search for one of the words in the title
   2.1. In the "Filter by" section, click on Bibliographic information
   2.2. In the title field, enter one of the words of the title (e.g. december)
   2.3. Click Go
   --> No results

3. Apply the patch
4. Redo step 2 and notice there is now a valid result

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3d7ea3bd99)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Shi Yao Wang 2024-02-23 14:16:27 -05:00 committed by Fridolin Somers
parent de4f54b3fa
commit 8644a1165f

View file

@ -424,6 +424,9 @@ if ($op=~/else/) {
if $search_params->{$f} eq '__ANY__'
|| $search_params->{$f} eq '';
}
for my $bi (qw (title author isbn publishercode copyrightdate collectiontitle)) {
$search_params->{$bi} = { 'LIKE' => "%" . $search_params->{$bi} . "%" } if $search_params->{$bi};
}
$search_params->{archived} = 0 if !$filter_archived;
my @suggestions = Koha::Suggestions->search_limited($search_params)->as_list;