Lines 63-69
sub GetCriteriumDesc{
Link Here
|
63 |
return ($criteriumvalue eq 'ASKED'?"Pending":ucfirst(lc( $criteriumvalue))) if ($displayby =~/status/i); |
63 |
return ($criteriumvalue eq 'ASKED'?"Pending":ucfirst(lc( $criteriumvalue))) if ($displayby =~/status/i); |
64 |
} |
64 |
} |
65 |
return Koha::Libraries->find($criteriumvalue)->branchname |
65 |
return Koha::Libraries->find($criteriumvalue)->branchname |
66 |
if $displayby =~ /branchcode/; |
66 |
if $displayby =~ /branchcode/; |
|
|
67 |
|
67 |
if ( $displayby =~ /itemtype/ ) { |
68 |
if ( $displayby =~ /itemtype/ ) { |
68 |
my $av = Koha::AuthorisedValues->search({ category => 'SUGGEST_FORMAT', authorised_value => $criteriumvalue }); |
69 |
my $av = Koha::AuthorisedValues->search({ category => 'SUGGEST_FORMAT', authorised_value => $criteriumvalue }); |
69 |
return $av->count ? $av->next->lib : 'Unkown'; |
70 |
return $av->count ? $av->next->lib : 'Unkown'; |
Lines 244-274
if ($op=~/else/) {
Link Here
|
244 |
my @allsuggestions; |
245 |
my @allsuggestions; |
245 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
246 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
246 |
foreach my $criteriumvalue ( @criteria_dv ) { |
247 |
foreach my $criteriumvalue ( @criteria_dv ) { |
247 |
# By default, display suggestions from current working branch |
248 |
# By default, display suggestions from current working branch |
248 |
unless ( exists $$suggestion_ref{'branchcode'} ) { |
|
|
249 |
$$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; |
250 |
} |
251 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
252 |
|
249 |
|
253 |
next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); |
250 |
# unless ( exists $$suggestion_ref{'branchcode'} ) { |
254 |
$$suggestion_ref{$displayby} = $criteriumvalue; |
251 |
# $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; |
|
|
252 |
# } |
253 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
255 |
|
254 |
|
256 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
255 |
next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); |
257 |
foreach my $suggestion (@$suggestions) { |
256 |
$$suggestion_ref{$displayby} = $criteriumvalue; |
258 |
if ($suggestion->{budgetid}){ |
257 |
|
259 |
my $bud = GetBudget( $suggestion->{budgetid} ); |
258 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
260 |
$suggestion->{budget_name} = $bud->{budget_name} if $bud; |
259 |
foreach my $suggestion (@$suggestions) { |
261 |
} |
260 |
if ($suggestion->{budgetid}){ |
262 |
} |
261 |
my $bud = GetBudget( $suggestion->{budgetid} ); |
263 |
push @allsuggestions,{ |
262 |
$suggestion->{budget_name} = $bud->{budget_name} if $bud; |
|
|
263 |
} |
264 |
} |
265 |
|
266 |
push @allsuggestions,{ |
264 |
"suggestiontype"=>$criteriumvalue||"suggest", |
267 |
"suggestiontype"=>$criteriumvalue||"suggest", |
265 |
"suggestiontypelabel"=>GetCriteriumDesc($criteriumvalue,$displayby)||"", |
268 |
"suggestiontypelabel"=>GetCriteriumDesc($criteriumvalue,$displayby)||"", |
266 |
"suggestionscount"=>scalar(@$suggestions), |
269 |
"suggestionscount"=>scalar(@$suggestions), |
267 |
'suggestions_loop'=>$suggestions, |
270 |
"suggestions_loop"=>$suggestions, |
268 |
'reasonsloop' => $reasonsloop, |
271 |
"reasonsloop" => $reasonsloop, |
269 |
}; |
272 |
}; |
270 |
|
273 |
|
271 |
delete $$suggestion_ref{$displayby} unless $definedvalue; |
274 |
delete $$suggestion_ref{$displayby} unless $definedvalue; |
272 |
} |
275 |
} |
273 |
|
276 |
|
274 |
$template->param( |
277 |
$template->param( |
275 |
- |
|
|