Lines 72-84
my $input = CGI->new;
Link Here
|
72 |
my $suggestedbyme = (defined $input->param('suggestedbyme')? $input->param('suggestedbyme'):1); |
72 |
my $suggestedbyme = (defined $input->param('suggestedbyme')? $input->param('suggestedbyme'):1); |
73 |
my $op = $input->param('op')||'else'; |
73 |
my $op = $input->param('op')||'else'; |
74 |
my @editsuggestions = $input->param('edit_field'); |
74 |
my @editsuggestions = $input->param('edit_field'); |
75 |
my $branchfilter = $input->param('branchcode'); |
75 |
my $suggestedby = $input->param('suggestedby'); |
76 |
my $suggestedby = $input->param('suggestedby'); |
|
|
77 |
my $returnsuggested = $input->param('returnsuggested'); |
78 |
my $returnsuggestedby = $input->param('returnsuggestedby'); |
76 |
my $returnsuggestedby = $input->param('returnsuggestedby'); |
79 |
my $managedby = $input->param('managedby'); |
77 |
my $returnsuggested = $input->param('returnsuggested'); |
80 |
my $displayby = $input->param('displayby'); |
78 |
my $managedby = $input->param('managedby'); |
81 |
my $tabcode = $input->param('tabcode'); |
79 |
my $displayby = $input->param('displayby') || ''; |
|
|
80 |
my $branchfilter = ($displayby ne "branchcode") ? $input->param('branchcode') : ''; |
81 |
my $tabcode = $input->param('tabcode'); |
82 |
|
82 |
|
83 |
# filter informations which are not suggestion related. |
83 |
# filter informations which are not suggestion related. |
84 |
my $suggestion_ref = $input->Vars; |
84 |
my $suggestion_ref = $input->Vars; |
Lines 184-204
if ($op=~/else/) {
Link Here
|
184 |
$op='else'; |
184 |
$op='else'; |
185 |
|
185 |
|
186 |
$displayby||="STATUS"; |
186 |
$displayby||="STATUS"; |
|
|
187 |
delete $$suggestion_ref{'branchcode'} if($displayby eq "branchcode"); |
187 |
my $criteria_list=GetDistinctValues("suggestions.".$displayby); |
188 |
my $criteria_list=GetDistinctValues("suggestions.".$displayby); |
188 |
my @allsuggestions; |
189 |
my @allsuggestions; |
189 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
190 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
190 |
foreach my $criteriumvalue (map{$$_{'value'}} @$criteria_list){ |
191 |
foreach my $criteriumvalue ( map { $$_{'value'} } @$criteria_list ) { |
|
|
192 |
# By default, display suggestions from current working branch |
193 |
if(not defined $branchfilter) { |
194 |
$$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; |
195 |
} |
191 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
196 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
192 |
|
197 |
|
193 |
next if ($definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue); |
198 |
next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); |
194 |
$$suggestion_ref{$displayby}=$criteriumvalue; |
199 |
$$suggestion_ref{$displayby} = $criteriumvalue; |
195 |
# warn $$suggestion_ref{$displayby}."=$criteriumvalue; $displayby"; |
200 |
|
196 |
|
|
|
197 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
201 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
198 |
foreach my $suggestion (@$suggestions){ |
202 |
foreach my $suggestion (@$suggestions) { |
199 |
if($suggestion->{budgetid}) { |
203 |
$suggestion->{budget_name} = GetBudget( $suggestion->{budgetid} )->{budget_name} if $suggestion->{budgetid}; |
200 |
my $budget = GetBudget($suggestion->{budgetid}); |
204 |
foreach my $date qw(suggesteddate manageddate accepteddate) { |
201 |
$suggestion->{budget_name}=$budget->{budget_name} if $budget; |
205 |
if ($suggestion->{$date} and $suggestion->{$date} ne "0000-00-00" && $suggestion->{$date} ne "" ) { |
|
|
206 |
$suggestion->{$date} = format_date( $suggestion->{$date} ); |
207 |
} else { |
208 |
$suggestion->{$date} = ""; |
209 |
} |
202 |
} |
210 |
} |
203 |
foreach my $date ( qw(suggesteddate manageddate accepteddate) ){ |
211 |
foreach my $date ( qw(suggesteddate manageddate accepteddate) ){ |
204 |
if ($suggestion->{$date} ne "0000-00-00" && $suggestion->{$date} ne "" ){ |
212 |
if ($suggestion->{$date} ne "0000-00-00" && $suggestion->{$date} ne "" ){ |
Lines 267-274
foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$
Link Here
|
267 |
my %row = ( |
275 |
my %row = ( |
268 |
value => $thisbranch, |
276 |
value => $thisbranch, |
269 |
branchname => $branches->{$thisbranch}->{'branchname'}, |
277 |
branchname => $branches->{$thisbranch}->{'branchname'}, |
270 |
selected => ($branches->{$thisbranch}->{'branchcode'} eq $branchfilter) |
278 |
selected => ($branchfilter and $branches->{$thisbranch}->{'branchcode'} eq $branchfilter ) || ( $$suggestion_ref{'branchcode'} and $branches->{$thisbranch}->{'branchcode'} eq $$suggestion_ref{'branchcode'} ) |
271 |
||($branches->{$thisbranch}->{'branchcode'} eq $$suggestion_ref{'branchcode'}) |
|
|
272 |
); |
279 |
); |
273 |
push @branchloop, \%row; |
280 |
push @branchloop, \%row; |
274 |
} |
281 |
} |
Lines 278-291
$template->param( branchloop => \@branchloop,
Link Here
|
278 |
branchfilter => $branchfilter); |
285 |
branchfilter => $branchfilter); |
279 |
|
286 |
|
280 |
# the index parameter is different for item-level itemtypes |
287 |
# the index parameter is different for item-level itemtypes |
281 |
my $supportlist=GetSupportList(); |
288 |
my $supportlist = GetSupportList(); |
282 |
foreach my $support(@$supportlist){ |
289 |
|
283 |
$$support{'selected'}= $$support{'itemtype'} eq $$suggestion_ref{'itemtype'}; |
290 |
foreach my $support (@$supportlist) { |
284 |
if ($$support{'imageurl'}){ |
291 |
$$support{'selected'} = (defined $$suggestion_ref{'itemtype'}) |
285 |
$$support{'imageurl'}= getitemtypeimagelocation( 'intranet', $$support{'imageurl'} ); |
292 |
? $$support{'itemtype'} eq $$suggestion_ref{'itemtype'} |
286 |
} |
293 |
: 0; |
287 |
else { |
294 |
if ( $$support{'imageurl'} ) { |
288 |
delete $$support{'imageurl'} |
295 |
$$support{'imageurl'} = getitemtypeimagelocation( 'intranet', $$support{'imageurl'} ); |
|
|
296 |
} else { |
297 |
delete $$support{'imageurl'}; |
289 |
} |
298 |
} |
290 |
} |
299 |
} |
291 |
$template->param(itemtypeloop=>$supportlist); |
300 |
$template->param(itemtypeloop=>$supportlist); |
Lines 309-315
foreach my $budget ( @{$budgets} ) {
Link Here
|
309 |
}; |
318 |
}; |
310 |
|
319 |
|
311 |
$template->param( budgetsloop => $budgets); |
320 |
$template->param( budgetsloop => $budgets); |
312 |
$template->param( "statusselected_$$suggestion_ref{'STATUS'}" =>1); |
321 |
$template->param( "statusselected_$$suggestion_ref{'STATUS'}" =>1) if ($$suggestion_ref{'STATUS'}); |
313 |
|
322 |
|
314 |
# get currencies and rates |
323 |
# get currencies and rates |
315 |
my @rates = GetCurrencies(); |
324 |
my @rates = GetCurrencies(); |
Lines 342-355
$template->param(
Link Here
|
342 |
my %hashlists; |
351 |
my %hashlists; |
343 |
foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) { |
352 |
foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) { |
344 |
my $values_list; |
353 |
my $values_list; |
345 |
$values_list=GetDistinctValues("suggestions.".$field) ; |
354 |
$values_list = GetDistinctValues( "suggestions." . $field ); |
346 |
my @codes_list = map{ |
355 |
my @codes_list = map { |
347 |
{ 'code'=>$$_{'value'}, |
356 |
{ 'code' => $$_{'value'}, |
348 |
'desc'=>GetCriteriumDesc($$_{'value'},$field), |
357 |
'desc' => GetCriteriumDesc( $$_{'value'}, $field ), |
349 |
'selected'=> $$_{'value'} eq $$suggestion_ref{$field} |
358 |
'selected' => ($$suggestion_ref{$field}) ? $$_{'value'} eq $$suggestion_ref{$field} : 0, |
350 |
} |
359 |
} |
351 |
} @$values_list; |
360 |
} @$values_list; |
352 |
$hashlists{lc($field)."_loop"}=\@codes_list; |
361 |
$hashlists{ lc($field) . "_loop" } = \@codes_list; |
353 |
} |
362 |
} |
354 |
$template->param(%hashlists); |
363 |
$template->param(%hashlists); |
355 |
$template->param(DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),); |
364 |
$template->param(DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),); |
356 |
- |
|
|