From be06bf055461e6559cc3ad579abcf35febe8e112 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 7 Apr 2009 17:37:54 -0500 Subject: [PATCH] acceptorreject.pl cleanup Perltidy the ugly block (still ugly). Use elsif where appropriate. Added FIXME. Signed-off-by: Galen Charlton --- suggestion/acceptorreject.pl | 48 +++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/suggestion/acceptorreject.pl b/suggestion/acceptorreject.pl index cbc0b98c2e..6147b34fb1 100755 --- a/suggestion/acceptorreject.pl +++ b/suggestion/acceptorreject.pl @@ -141,10 +141,10 @@ if ( $op eq "aorr_confirm" ) { if (scalar(@deletelist)>0){ my $params = "&delete_field=".join ("&delete_field=",@deletelist); print $input->redirect("/cgi-bin/koha/suggestion/acceptorreject.pl?op=delete_confirm$params"); + exit; } } - -if ( $op eq "delete_confirm" ) { +elsif ( $op eq "delete_confirm" ) { my @delete_field = $input->param("delete_field"); foreach my $delete_field (@delete_field) { &DelSuggestion( $loggedinuser, $delete_field,"intranet" ); @@ -153,28 +153,36 @@ if ( $op eq "delete_confirm" ) { } my $reasonsloop = GetAuthorisedValues("SUGGEST"); -my $pending_suggestions = &SearchSuggestion( "", "", "", "", 'ASKED', "",$branchcode ); -map{$_->{'reasonsloop'}=$reasonsloop;$_->{'date'}=format_date($_->{'date'})} @$pending_suggestions; -my $accepted_suggestions = &GetSuggestionByStatus('ACCEPTED',$branchcode); -map{$_->{'reasonsloop'}=$reasonsloop;$_->{'date'}=format_date($_->{'date'})} @$accepted_suggestions; -my $rejected_suggestions = &GetSuggestionByStatus('REJECTED',$branchcode); -map{$_->{'reasonsloop'}=$reasonsloop;$_->{'date'}=format_date($_->{'date'})} @$rejected_suggestions; +my $pending_suggestions = &SearchSuggestion("", "", "", "", 'ASKED', "", $branchcode); +map { $_->{'reasonsloop'} = $reasonsloop; $_->{'date'} = format_date($_->{'date'}) } @$pending_suggestions; +my $accepted_suggestions = &GetSuggestionByStatus('ACCEPTED', $branchcode); +map { $_->{'reasonsloop'} = $reasonsloop; $_->{'date'} = format_date($_->{'date'}) } @$accepted_suggestions; +my $rejected_suggestions = &GetSuggestionByStatus('REJECTED', $branchcode); +map { $_->{'reasonsloop'} = $reasonsloop; $_->{'date'} = format_date($_->{'date'}) } @$rejected_suggestions; + +# FIXME: BAD use of map in VOID context. my @allsuggestions; -push @allsuggestions,{"suggestiontype"=>"accepted", - 'suggestions_loop'=>$accepted_suggestions, - 'reasonsloop' => $reasonsloop}; -push @allsuggestions,{"suggestiontype"=>"pending", - 'suggestions_loop'=>$pending_suggestions, - 'reasonsloop' => $reasonsloop}; -push @allsuggestions,{"suggestiontype"=>"rejected", - 'suggestions_loop'=>$rejected_suggestions, - 'reasonsloop' => $reasonsloop}; +push @allsuggestions, + { "suggestiontype" => "accepted", + 'suggestions_loop' => $accepted_suggestions, + 'reasonsloop' => $reasonsloop + }; +push @allsuggestions, + { "suggestiontype" => "pending", + 'suggestions_loop' => $pending_suggestions, + 'reasonsloop' => $reasonsloop + }; +push @allsuggestions, + { "suggestiontype" => "rejected", + 'suggestions_loop' => $rejected_suggestions, + 'reasonsloop' => $reasonsloop + }; $template->param( - suggestions => \@allsuggestions, - "op_$op" => 1, - dateformat => C4::Context->preference("dateformat"), + suggestions => \@allsuggestions, + "op_$op" => 1, + dateformat => C4::Context->preference("dateformat"), ); output_html_with_http_headers $input, $cookie, $template->output; -- 2.20.1