Bugzilla – Attachment 4456 Details for
Bug 5453
Variables declaration should not occur in conditionals
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5453: Move declarations out of conditionals
Bug-5453-Move-declarations-out-of-conditionals.patch (text/plain), 5.91 KB, created by
Chris Cormack
on 2011-06-14 20:57:46 UTC
(
hide
)
Description:
Bug 5453: Move declarations out of conditionals
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-06-14 20:57:46 UTC
Size:
5.91 KB
patch
obsolete
>From 237ccf827e57e7098f607d4df549275d291644b4 Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Mon, 29 Nov 2010 11:06:48 +0000 >Subject: [PATCH] Bug 5453: Move declarations out of conditionals > >Patch admin/*.pl scripts > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > admin/aqbudgets.pl | 6 +++++- > admin/aqcontract.pl | 32 ++++++++++++++++++++++---------- > admin/auth_tag_structure.pl | 17 ++++++++--------- > admin/branches.pl | 8 +++----- > admin/smart-rules.pl | 13 ++++++------- > 5 files changed, 44 insertions(+), 32 deletions(-) > >diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl >index e34f2cc..3ff1bd6 100755 >--- a/admin/aqbudgets.pl >+++ b/admin/aqbudgets.pl >@@ -323,7 +323,11 @@ if ($op eq 'add_form') { > ); > } > >- my $budget_period_total = $num->format_price($$period{budget_period_total}) if $$period{budget_period_total}; >+ my $budget_period_total; >+ if ( $period->{budget_period_total} ) { >+ $budget_period_total = >+ $num->format_price( $period->{budget_period_total} ); >+ } > $template->param( > else => 1, > budget => \@loop, >diff --git a/admin/aqcontract.pl b/admin/aqcontract.pl >index 07fb757..7126c99 100755 >--- a/admin/aqcontract.pl >+++ b/admin/aqcontract.pl >@@ -59,17 +59,29 @@ $template->param( > if ( $op eq 'add_form' ) { > $template->param( add_form => 1 ); > >- # if contractnumber exists, it's a modify action, so read values to modify... >- my $contract = @{GetContract( { contractnumber => $contractnumber } )}[0] if $contractnumber; >- >- $template->param( >- contractnumber => $$contract{contractnumber}, >- contractname => $$contract{contractname}, >- contractdescription => $$contract{contractdescription}, >- contractstartdate => format_date( $$contract{contractstartdate} ), >- contractenddate => format_date( $$contract{contractenddate} ), >- DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar, >- ); >+ # if contractnumber exists, it's a modify action, so read values to modify... >+ if ($contractnumber) { >+ my $contract = >+ @{ GetContract( { contractnumber => $contractnumber } ) }[0]; >+ >+ $template->param( >+ contractnumber => $contract->{contractnumber}, >+ contractname => $contract->{contractname}, >+ contractdescription => $contract->{contractdescription}, >+ contractstartdate => format_date( $contract->{contractstartdate} ), >+ contractenddate => format_date( $contract->{contractenddate} ), >+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar, >+ ); >+ } else { >+ $template->param( >+ contractnumber => undef, >+ contractname => undef, >+ contractdescription => undef, >+ contractstartdate => undef, >+ contractenddate => undef, >+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar, >+ ); >+ } > > # END $OP eq ADD_FORM > } >diff --git a/admin/auth_tag_structure.pl b/admin/auth_tag_structure.pl >index 9c55df3..bd3dc93 100755 >--- a/admin/auth_tag_structure.pl >+++ b/admin/auth_tag_structure.pl >@@ -55,15 +55,14 @@ my ($template, $loggedinuser, $cookie) > }); > > # get authtype list >-my $authtypes = getauthtypes; >-my @authtypesloop; >-foreach my $thisauthtype (keys %$authtypes) { >- my $selected = 1 if $thisauthtype eq $authtypecode; >- my %row =(value => $thisauthtype, >- selected => $selected, >- authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'}, >- ); >- push @authtypesloop, \%row; >+my $authtypes = getauthtypes; >+my @authtypesloop = (); >+foreach my $thisauthtype ( keys %{$authtypes} ) { >+ push @authtypesloop, >+ { value => $thisauthtype, >+ selected => $thisauthtype eq $authtypecode, >+ authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'}, >+ }; > } > > my $sth; >diff --git a/admin/branches.pl b/admin/branches.pl >index 5c71b0c..d6388f5 100755 >--- a/admin/branches.pl >+++ b/admin/branches.pl >@@ -189,12 +189,10 @@ elsif ( $op eq 'addcategory_validate' ) { > elsif ( $op eq 'delete_category' ) { > > # if the user has pressed the "delete branch" button. >- my $message = "MESSAGE8" if CheckBranchCategorycode($categorycode); >- if ($message) { >+ if ( CheckBranchCategorycode($categorycode) ) { > $template->param( else => 1 ); >- default($message,$template); >- } >- else { >+ default( 'MESSAGE8', $template ); >+ } else { > $template->param( delete_category => 1 ); > $template->param( categorycode => $categorycode ); > } >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 5ba92d8..f290934 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -339,12 +339,11 @@ elsif ($op eq "add-branch-item") { > my $branches = GetBranches(); > my @branchloop; > for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { >- my $selected = 1 if $thisbranch eq $branch; >- my %row =(value => $thisbranch, >- selected => $selected, >- branchname => $branches->{$thisbranch}->{'branchname'}, >- ); >- push @branchloop, \%row; >+ push @branchloop, { >+ value => $thisbranch, >+ selected => $thisbranch eq $branch, >+ branchname => $branches->{$thisbranch}->{'branchname'}, >+ }; > } > > my $sth=$dbh->prepare("SELECT description,categorycode FROM categories ORDER BY description"); >@@ -426,7 +425,7 @@ foreach my $entry (@sorted_branch_cat_rules, @sorted_row_loop) { > $entry->{unlimited_maxissueqty} = 1 unless defined($entry->{maxissueqty}); > } > >-my @sorted_row_loop = sort by_category_and_itemtype @row_loop; >+@sorted_row_loop = sort by_category_and_itemtype @row_loop; > > my $sth_branch_item; > if ($branch eq "*") { >-- >1.7.4.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5453
:
4340
|
4341
|
4342
|
4343
|
4344
|
4345
|
4346
|
4455
| 4456 |
4457
|
4458
|
4459
|
4460
|
4461