|
Lines 92-100
my $managedby = $input->param('managedby');
Link Here
|
| 92 |
my $displayby = $input->param('displayby') || ''; |
92 |
my $displayby = $input->param('displayby') || ''; |
| 93 |
my $tabcode = $input->param('tabcode'); |
93 |
my $tabcode = $input->param('tabcode'); |
| 94 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
94 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
|
|
95 |
my $filter_branchcode = $input->param('filter_branchcode'); |
| 95 |
|
96 |
|
| 96 |
# filter informations which are not suggestion related. |
97 |
# filter informations which are not suggestion related. |
| 97 |
my $suggestion_ref = $input->Vars; |
98 |
my $suggestion_ref = $input->Vars; |
|
|
99 |
my $IndependentBranches; |
| 100 |
my $SuperLibrarian; |
| 98 |
|
101 |
|
| 99 |
# get only the columns of Suggestion |
102 |
# get only the columns of Suggestion |
| 100 |
my $schema = Koha::Database->new()->schema; |
103 |
my $schema = Koha::Database->new()->schema; |
|
Lines 118-123
my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user(
Link Here
|
| 118 |
$borrowernumber = $input->param('borrowernumber') if ( $input->param('borrowernumber') ); |
121 |
$borrowernumber = $input->param('borrowernumber') if ( $input->param('borrowernumber') ); |
| 119 |
$template->param('borrowernumber' => $borrowernumber); |
122 |
$template->param('borrowernumber' => $borrowernumber); |
| 120 |
|
123 |
|
|
|
124 |
#Check if IndependentBranches syspref is enabled and if it is then return IndependentBranches variable of 1 so library |
| 125 |
#filtering does not occur in suggestion.tt |
| 126 |
if ( Koha::Config::SysPrefs->find( 'IndependentBranches')->value) { |
| 127 |
$IndependentBranches = 1; |
| 128 |
$template->param( |
| 129 |
IndependentBranches => $IndependentBranches |
| 130 |
); |
| 131 |
} |
| 132 |
|
| 133 |
if (C4::Context->IsSuperLibrarian()) { |
| 134 |
$SuperLibrarian =1; |
| 135 |
$template->param( |
| 136 |
SuperLibrarian => $SuperLibrarian |
| 137 |
); |
| 138 |
} |
| 139 |
|
| 140 |
# |
| 121 |
######################################### |
141 |
######################################### |
| 122 |
## Operations |
142 |
## Operations |
| 123 |
## |
143 |
## |
|
Lines 241-247
elsif ( $op eq 'show' ) {
Link Here
|
| 241 |
} |
261 |
} |
| 242 |
if ($op=~/else/) { |
262 |
if ($op=~/else/) { |
| 243 |
$op='else'; |
263 |
$op='else'; |
| 244 |
|
264 |
|
| 245 |
$displayby||="STATUS"; |
265 |
$displayby||="STATUS"; |
| 246 |
delete $$suggestion_ref{'branchcode'} if($displayby eq "branchcode"); |
266 |
delete $$suggestion_ref{'branchcode'} if($displayby eq "branchcode"); |
| 247 |
# distinct values of display by |
267 |
# distinct values of display by |
|
Lines 260-288
if ($op=~/else/) {
Link Here
|
| 260 |
my @allsuggestions; |
280 |
my @allsuggestions; |
| 261 |
foreach my $criteriumvalue ( @criteria_dv ) { |
281 |
foreach my $criteriumvalue ( @criteria_dv ) { |
| 262 |
# By default, display suggestions from current working branch |
282 |
# By default, display suggestions from current working branch |
| 263 |
unless ( exists $$suggestion_ref{'branchcode'} ) { |
283 |
|
| 264 |
$$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; |
284 |
if ( $IndependentBranches && !$SuperLibrarian) { |
|
|
285 |
unless ( $$suggestion_ref{'branchcode'} ) { |
| 286 |
$$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; |
| 287 |
} |
| 265 |
} |
288 |
} |
|
|
289 |
|
| 266 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
290 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
| 267 |
|
291 |
|
| 268 |
next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); |
292 |
next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); |
| 269 |
$$suggestion_ref{$displayby} = $criteriumvalue; |
293 |
$$suggestion_ref{$displayby} = $criteriumvalue; |
| 270 |
|
294 |
|
| 271 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
295 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
|
|
296 |
|
| 297 |
my $filteredsuggestionlist; |
| 272 |
foreach my $suggestion (@$suggestions) { |
298 |
foreach my $suggestion (@$suggestions) { |
| 273 |
if ($suggestion->{budgetid}){ |
299 |
if ($suggestion->{budgetid}){ |
| 274 |
my $bud = GetBudget( $suggestion->{budgetid} ); |
300 |
my $bud = GetBudget( $suggestion->{budgetid} ); |
| 275 |
$suggestion->{budget_name} = $bud->{budget_name} if $bud; |
301 |
$suggestion->{budget_name} = $bud->{budget_name} if $bud; |
| 276 |
} |
302 |
} |
|
|
303 |
if ($filter_branchcode) { |
| 304 |
push @$filteredsuggestionlist, $suggestion if ($suggestion->{'branchcode'} eq $filter_branchcode); |
| 305 |
} |
| 277 |
} |
306 |
} |
| 278 |
push @allsuggestions,{ |
|
|
| 279 |
"suggestiontype"=>$criteriumvalue||"suggest", |
| 280 |
"suggestiontypelabel"=>GetCriteriumDesc($criteriumvalue,$displayby)||"", |
| 281 |
"suggestionscount"=>scalar(@$suggestions), |
| 282 |
'suggestions_loop'=>$suggestions, |
| 283 |
'reasonsloop' => $reasonsloop, |
| 284 |
}; |
| 285 |
|
307 |
|
|
|
308 |
if ( $filter_branchcode && $filteredsuggestionlist) { |
| 309 |
push @allsuggestions,{ |
| 310 |
"suggestiontype"=>$criteriumvalue||"suggest", |
| 311 |
"suggestiontypelabel"=>GetCriteriumDesc($criteriumvalue,$displayby)||"", |
| 312 |
"suggestionscount"=>scalar(@$filteredsuggestionlist), |
| 313 |
'suggestions_loop'=>$filteredsuggestionlist, |
| 314 |
'reasonsloop' => $reasonsloop, |
| 315 |
}; |
| 316 |
} elsif ( $filter_branchcode eq "__ANY__" ) { |
| 317 |
push @allsuggestions,{ |
| 318 |
"suggestiontype"=>$criteriumvalue||"suggest", |
| 319 |
"suggestiontypelabel"=>GetCriteriumDesc($criteriumvalue,$displayby)||"", |
| 320 |
"suggestionscount"=>scalar(@$suggestions), |
| 321 |
'suggestions_loop'=>$suggestions, |
| 322 |
'reasonsloop' => $reasonsloop, |
| 323 |
}; |
| 324 |
} |
| 286 |
delete $$suggestion_ref{$displayby} unless $definedvalue; |
325 |
delete $$suggestion_ref{$displayby} unless $definedvalue; |
| 287 |
} |
326 |
} |
| 288 |
|
327 |
|
| 289 |
- |
|
|