|
Lines 94-99
my $tabcode = $input->param('tabcode');
Link Here
|
| 94 |
|
94 |
|
| 95 |
# filter informations which are not suggestion related. |
95 |
# filter informations which are not suggestion related. |
| 96 |
my $suggestion_ref = $input->Vars; |
96 |
my $suggestion_ref = $input->Vars; |
|
|
97 |
my $IndependentBranches; |
| 98 |
my $SuperLibrarian; |
| 97 |
|
99 |
|
| 98 |
# get only the columns of Suggestion |
100 |
# get only the columns of Suggestion |
| 99 |
my $schema = Koha::Database->new()->schema; |
101 |
my $schema = Koha::Database->new()->schema; |
|
Lines 117-122
my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user(
Link Here
|
| 117 |
$borrowernumber = $input->param('borrowernumber') if ( $input->param('borrowernumber') ); |
119 |
$borrowernumber = $input->param('borrowernumber') if ( $input->param('borrowernumber') ); |
| 118 |
$template->param('borrowernumber' => $borrowernumber); |
120 |
$template->param('borrowernumber' => $borrowernumber); |
| 119 |
|
121 |
|
|
|
122 |
#Check if IndependentBranches syspref is enabled and if it is then return IndependentBranches variable of 1 so library |
| 123 |
#filtering does not occur in suggestion.tt |
| 124 |
if ( Koha::Config::SysPrefs->find( 'IndependentBranches')->value) { |
| 125 |
$IndependentBranches = 1; |
| 126 |
$template->param( |
| 127 |
IndependentBranches => $IndependentBranches |
| 128 |
); |
| 129 |
} |
| 130 |
|
| 131 |
if (C4::Context->IsSuperLibrarian()) { |
| 132 |
$SuperLibrarian =1; |
| 133 |
$template->param( |
| 134 |
SuperLibrarian => $SuperLibrarian |
| 135 |
); |
| 136 |
} |
| 137 |
|
| 138 |
# |
| 120 |
######################################### |
139 |
######################################### |
| 121 |
## Operations |
140 |
## Operations |
| 122 |
## |
141 |
## |
|
Lines 225-231
elsif ( $op eq 'show' ) {
Link Here
|
| 225 |
} |
244 |
} |
| 226 |
if ($op=~/else/) { |
245 |
if ($op=~/else/) { |
| 227 |
$op='else'; |
246 |
$op='else'; |
| 228 |
|
247 |
|
| 229 |
$displayby||="STATUS"; |
248 |
$displayby||="STATUS"; |
| 230 |
delete $$suggestion_ref{'branchcode'} if($displayby eq "branchcode"); |
249 |
delete $$suggestion_ref{'branchcode'} if($displayby eq "branchcode"); |
| 231 |
# distinct values of display by |
250 |
# distinct values of display by |
|
Lines 245-273
if ($op=~/else/) {
Link Here
|
| 245 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
264 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
| 246 |
foreach my $criteriumvalue ( @criteria_dv ) { |
265 |
foreach my $criteriumvalue ( @criteria_dv ) { |
| 247 |
# By default, display suggestions from current working branch |
266 |
# By default, display suggestions from current working branch |
| 248 |
unless ( exists $$suggestion_ref{'branchcode'} ) { |
267 |
|
| 249 |
$$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; |
268 |
if ( $IndependentBranches && !$SuperLibrarian) { |
|
|
269 |
unless ( $$suggestion_ref{'branchcode'} ) { |
| 270 |
$$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; |
| 271 |
} |
| 250 |
} |
272 |
} |
|
|
273 |
|
| 251 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
274 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
| 252 |
|
275 |
|
| 253 |
next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); |
276 |
next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); |
| 254 |
$$suggestion_ref{$displayby} = $criteriumvalue; |
277 |
$$suggestion_ref{$displayby} = $criteriumvalue; |
| 255 |
|
278 |
|
| 256 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
279 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
|
|
280 |
|
| 281 |
my $count = 0; |
| 257 |
foreach my $suggestion (@$suggestions) { |
282 |
foreach my $suggestion (@$suggestions) { |
| 258 |
if ($suggestion->{budgetid}){ |
283 |
if ($suggestion->{budgetid}){ |
| 259 |
my $bud = GetBudget( $suggestion->{budgetid} ); |
284 |
my $bud = GetBudget( $suggestion->{budgetid} ); |
| 260 |
$suggestion->{budget_name} = $bud->{budget_name} if $bud; |
285 |
$suggestion->{budget_name} = $bud->{budget_name} if $bud; |
| 261 |
} |
286 |
} |
|
|
287 |
$count++; |
| 262 |
} |
288 |
} |
| 263 |
push @allsuggestions,{ |
289 |
push @allsuggestions,{ |
| 264 |
"suggestiontype"=>$criteriumvalue||"suggest", |
290 |
"suggestiontype"=>$criteriumvalue||"suggest", |
| 265 |
"suggestiontypelabel"=>GetCriteriumDesc($criteriumvalue,$displayby)||"", |
291 |
"suggestiontypelabel"=>GetCriteriumDesc($criteriumvalue,$displayby)||"", |
| 266 |
"suggestionscount"=>scalar(@$suggestions), |
292 |
"suggestionscount"=>scalar(@$suggestions), |
| 267 |
'suggestions_loop'=>$suggestions, |
293 |
'suggestions_loop'=>$suggestions, |
| 268 |
'reasonsloop' => $reasonsloop, |
294 |
'reasonsloop' => $reasonsloop, |
| 269 |
}; |
295 |
}; |
| 270 |
|
|
|
| 271 |
delete $$suggestion_ref{$displayby} unless $definedvalue; |
296 |
delete $$suggestion_ref{$displayby} unless $definedvalue; |
| 272 |
} |
297 |
} |
| 273 |
|
298 |
|
| 274 |
- |
|
|