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 173-197
elsif ($op eq "change" ) {
Link Here
|
173 |
} |
173 |
} |
174 |
$op = 'else'; |
174 |
$op = 'else'; |
175 |
} |
175 |
} |
176 |
if ($op=~/else/) { |
176 |
|
177 |
$op='else'; |
177 |
if ( $op =~ /else/ ) { |
178 |
|
178 |
$op = 'else'; |
179 |
$displayby||="STATUS"; |
179 |
|
180 |
my $criteria_list=GetDistinctValues("suggestions.".$displayby); |
180 |
$displayby ||= "STATUS"; |
|
|
181 |
delete $$suggestion_ref{'branchcode'} if($displayby eq "branchcode"); |
182 |
my $criteria_list = GetDistinctValues( "suggestions." . $displayby ); |
181 |
my @allsuggestions; |
183 |
my @allsuggestions; |
182 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
184 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
183 |
foreach my $criteriumvalue (map{$$_{'value'}} @$criteria_list){ |
185 |
foreach my $criteriumvalue ( map { $$_{'value'} } @$criteria_list ) { |
|
|
186 |
# By default, display suggestions from current working branch |
187 |
if(not defined $branchfilter) { |
188 |
$$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; |
189 |
} |
184 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
190 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
185 |
|
191 |
|
186 |
next if ($definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue); |
192 |
next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); |
187 |
$$suggestion_ref{$displayby}=$criteriumvalue; |
193 |
$$suggestion_ref{$displayby} = $criteriumvalue; |
188 |
# warn $$suggestion_ref{$displayby}."=$criteriumvalue; $displayby"; |
194 |
|
189 |
|
|
|
190 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
195 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
191 |
foreach my $suggestion (@$suggestions){ |
196 |
foreach my $suggestion (@$suggestions) { |
192 |
if($suggestion->{budgetid}) { |
197 |
$suggestion->{budget_name} = GetBudget( $suggestion->{budgetid} )->{budget_name} if $suggestion->{budgetid}; |
193 |
my $budget = GetBudget($suggestion->{budgetid}); |
198 |
foreach my $date qw(suggesteddate manageddate accepteddate) { |
194 |
$suggestion->{budget_name}=$budget->{budget_name} if $budget; |
199 |
if ($suggestion->{$date} and $suggestion->{$date} ne "0000-00-00" && $suggestion->{$date} ne "" ) { |
|
|
200 |
$suggestion->{$date} = format_date( $suggestion->{$date} ); |
201 |
} else { |
202 |
$suggestion->{$date} = ""; |
203 |
} |
195 |
} |
204 |
} |
196 |
foreach my $date qw(suggesteddate manageddate accepteddate){ |
205 |
foreach my $date qw(suggesteddate manageddate accepteddate){ |
197 |
if ($suggestion->{$date} ne "0000-00-00" && $suggestion->{$date} ne "" ){ |
206 |
if ($suggestion->{$date} ne "0000-00-00" && $suggestion->{$date} ne "" ){ |
Lines 260-267
foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$
Link Here
|
260 |
my %row = ( |
269 |
my %row = ( |
261 |
value => $thisbranch, |
270 |
value => $thisbranch, |
262 |
branchname => $branches->{$thisbranch}->{'branchname'}, |
271 |
branchname => $branches->{$thisbranch}->{'branchname'}, |
263 |
selected => ($branches->{$thisbranch}->{'branchcode'} eq $branchfilter) |
272 |
selected => ($branchfilter and $branches->{$thisbranch}->{'branchcode'} eq $branchfilter ) || ( $$suggestion_ref{'branchcode'} and $branches->{$thisbranch}->{'branchcode'} eq $$suggestion_ref{'branchcode'} ) |
264 |
||($branches->{$thisbranch}->{'branchcode'} eq $$suggestion_ref{'branchcode'}) |
|
|
265 |
); |
273 |
); |
266 |
push @branchloop, \%row; |
274 |
push @branchloop, \%row; |
267 |
} |
275 |
} |
Lines 271-284
$template->param( branchloop => \@branchloop,
Link Here
|
271 |
branchfilter => $branchfilter); |
279 |
branchfilter => $branchfilter); |
272 |
|
280 |
|
273 |
# the index parameter is different for item-level itemtypes |
281 |
# the index parameter is different for item-level itemtypes |
274 |
my $supportlist=GetSupportList(); |
282 |
my $supportlist = GetSupportList(); |
275 |
foreach my $support(@$supportlist){ |
283 |
|
276 |
$$support{'selected'}= $$support{'itemtype'} eq $$suggestion_ref{'itemtype'}; |
284 |
foreach my $support (@$supportlist) { |
277 |
if ($$support{'imageurl'}){ |
285 |
$$support{'selected'} = (defined $$suggestion_ref{'itemtype'}) |
278 |
$$support{'imageurl'}= getitemtypeimagelocation( 'intranet', $$support{'imageurl'} ); |
286 |
? $$support{'itemtype'} eq $$suggestion_ref{'itemtype'} |
279 |
} |
287 |
: 0; |
280 |
else { |
288 |
if ( $$support{'imageurl'} ) { |
281 |
delete $$support{'imageurl'} |
289 |
$$support{'imageurl'} = getitemtypeimagelocation( 'intranet', $$support{'imageurl'} ); |
|
|
290 |
} else { |
291 |
delete $$support{'imageurl'}; |
282 |
} |
292 |
} |
283 |
} |
293 |
} |
284 |
$template->param(itemtypeloop=>$supportlist); |
294 |
$template->param(itemtypeloop=>$supportlist); |
Lines 302-308
foreach my $budget ( @{$budgets} ) {
Link Here
|
302 |
}; |
312 |
}; |
303 |
|
313 |
|
304 |
$template->param( budgetsloop => $budgets); |
314 |
$template->param( budgetsloop => $budgets); |
305 |
$template->param( "statusselected_$$suggestion_ref{'STATUS'}" =>1); |
315 |
$template->param( "statusselected_$$suggestion_ref{'STATUS'}" =>1) if ($$suggestion_ref{'STATUS'}); |
306 |
|
316 |
|
307 |
# get currencies and rates |
317 |
# get currencies and rates |
308 |
my @rates = GetCurrencies(); |
318 |
my @rates = GetCurrencies(); |
Lines 335-348
$template->param(
Link Here
|
335 |
my %hashlists; |
345 |
my %hashlists; |
336 |
foreach my $field qw(managedby acceptedby suggestedby budgetid) { |
346 |
foreach my $field qw(managedby acceptedby suggestedby budgetid) { |
337 |
my $values_list; |
347 |
my $values_list; |
338 |
$values_list=GetDistinctValues("suggestions.".$field) ; |
348 |
$values_list = GetDistinctValues( "suggestions." . $field ); |
339 |
my @codes_list = map{ |
349 |
my @codes_list = map { |
340 |
{ 'code'=>$$_{'value'}, |
350 |
{ 'code' => $$_{'value'}, |
341 |
'desc'=>GetCriteriumDesc($$_{'value'},$field), |
351 |
'desc' => GetCriteriumDesc( $$_{'value'}, $field ), |
342 |
'selected'=> $$_{'value'} eq $$suggestion_ref{$field} |
352 |
'selected' => ($$suggestion_ref{$field}) ? $$_{'value'} eq $$suggestion_ref{$field} : 0, |
343 |
} |
353 |
} |
344 |
} @$values_list; |
354 |
} @$values_list; |
345 |
$hashlists{lc($field)."_loop"}=\@codes_list; |
355 |
$hashlists{ lc($field) . "_loop" } = \@codes_list; |
346 |
} |
356 |
} |
347 |
$template->param(%hashlists); |
357 |
$template->param(%hashlists); |
348 |
$template->param(DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),); |
358 |
$template->param(DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),); |
349 |
- |
|
|