From 683b1d19d5277959c6a86bb2ba32c68b3141848f Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Wed, 14 May 2025 11:00:09 +0100 Subject: [PATCH] Bug 33430: (follow-up) Fix the data filtering from the left menu Signed-off-by: Fridolin Somers --- .../prog/en/modules/suggestion/suggestion.tt | 4 ++-- suggestion/suggestion.pl | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index ce2e9702b3..2762234f09 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -1326,7 +1326,7 @@ let suggestionData = [% To.json(suggestions) | $raw %]; var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %] function loadDatatable(tabName) { - let tabSuggestionData = suggestionData.find(s => s.suggestiontype === tabName) + let tabSuggestionData = suggestionData.find(s => s.suggestiontype === `${tabName}`) $("#table_" + tabName).kohaTable( { sorting: [[4, "asc"]], @@ -1479,7 +1479,7 @@ { data: "status", searchable: false, - orderable: false, + orderable: true, render: function (data, type, row, meta) { if(row.status === 'ASKED') return '%s'.format(_("Pending")); if(row.status === 'ACCEPTED') return '%s'.format(_("Accepted")); diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index de37a7196f..39521c6495 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -456,14 +456,21 @@ if ( $op eq 'else' ) { || $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}; + if ( $search_params->{$bi} ) { + $search_params->{"me.$bi"} = { 'like' => "%" . $search_params->{$bi} . "%" }; + delete $search_params->{$bi}; + } } $search_params->{archived} = 0 if !$filter_archived; foreach my $key ( keys %$search_params ) { if ( $key eq 'branchcode' ) { - my $branch_param = delete $search_params->{$key}; - $search_params->{"me.branchcode"} = $branch_param; + if ( $displayby ne 'branchcode' ) { + my $branch_param = delete $search_params->{$key}; + $search_params->{"me.branchcode"} = $branch_param; + } else { + delete $search_params->{$key}; + } } } -- 2.43.0