Bugzilla – Attachment 132172 Details for
Bug 23991
Move SearchSuggestion to Koha::Suggestions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23991: Fix branchcode and budgetid filtering
Bug-23991-Fix-branchcode-and-budgetid-filtering.patch (text/plain), 2.94 KB, created by
Nick Clemens (kidclamp)
on 2022-03-24 15:22:01 UTC
(
hide
)
Description:
Bug 23991: Fix branchcode and budgetid filtering
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-03-24 15:22:01 UTC
Size:
2.94 KB
patch
obsolete
>From 96ba0822e1e95b451634130c4624d4578281a7c7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 17 Jan 2022 14:20:49 +0100 >Subject: [PATCH] Bug 23991: Fix branchcode and budgetid filtering > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > suggestion/suggestion.pl | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-) > >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index d9a56c3e62..6c2bdc84be 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -362,16 +362,19 @@ if ($op=~/else/) { > @criteria_dv = ( C4::Context->userenv->{'branch'} ); > } > >+ unless ( exists $suggestion_ref->{branchcode} ) { >+ $suggestion_ref->{branchcode} = C4::Context->userenv->{'branch'}; >+ } >+ > my @allsuggestions; > foreach my $criteriumvalue ( @criteria_dv ) { >+ my $search_params = {%$suggestion_ref}; > # By default, display suggestions from current working branch >- unless ( exists $$suggestion_ref{'branchcode'} ) { >- $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; >- } > my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; > > next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ) and ($displayby ne 'branchcode' && $branchfilter ne '__ANY__' ); >- $$suggestion_ref{$displayby} = $criteriumvalue; >+ >+ $search_params->{$displayby} = $criteriumvalue; > > # filter on date fields > foreach my $field (qw( suggesteddate manageddate accepteddate )) { >@@ -389,17 +392,24 @@ if ($op=~/else/) { > if ( $from_dt || $to_dt ) { > my $dtf = Koha::Database->new->schema->storage->datetime_parser; > if ( $from_dt && $to_dt ) { >- $suggestion_ref->{$field} = { -between => [ $from_dt, $to_dt ] }; >+ $search_params->{$field} = { -between => [ $from_dt, $to_dt ] }; > } elsif ( $from_dt ) { >- $suggestion_ref->{$field} = { '>=' => $from_dt }; >+ $search_params->{$field} = { '>=' => $from_dt }; > } elsif ( $to_dt ) { >- $suggestion_ref->{$field} = { '<=' => $to_dt }; >+ $search_params->{$field} = { '<=' => $to_dt }; > } > } > } >+ if ( $search_params->{budgetid} && $search_params->{budgetid} eq '__NONE__' ) { >+ $search_params->{budgetid} = [undef, '' ]; >+ } >+ for my $f (qw (branchcode budgetid)) { >+ delete $search_params->{$f} if $search_params->{$f} eq '__ANY__'; >+ } >+ > my @suggestions = > Koha::Suggestions->search_limited( >- { %$suggestion_ref, archived => $filter_archived } )->as_list; >+ { %$search_params, archived => $filter_archived } )->as_list; > > push @allsuggestions, > { >-- >2.30.2
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 23991
:
95172
|
115203
|
115207
|
116639
|
118454
|
119256
|
127058
|
127100
|
128071
|
128072
|
128073
|
128074
|
128075
|
129511
|
129512
|
129513
|
129523
|
130049
|
131896
|
132026
|
132169
|
132170
|
132171
|
132172
|
132173
|
132174
|
132175
|
133874
|
134922
|
136441
|
136442
|
137201