Bug 5453 Do not declare variables in conditionals
authorColin Campbell <colin.campbell@ptfs-europe.com>
Mon, 29 Nov 2010 10:37:15 +0000 (10:37 +0000)
committerChris Cormack <chrisc@catalyst.net.nz>
Fri, 15 Jul 2011 03:50:19 +0000 (15:50 +1200)
Removed occurences in acqui/*.pl

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
acqui/basketgroup.pl
acqui/histsearch.pl

index 457b616..08356f8 100755 (executable)
@@ -305,26 +305,22 @@ if ( $op eq "add" ) {
         # Build the combobox to select the billing place
         my @billingplaceloop;
         for (sort keys %$branches) {
-            my $selected = 1 if $_ eq $billingplace;
-            my %row = (
+            push @billingplaceloop, {
                 value      => $_,
-                selected   => $selected,
+                selected   => $_ eq $billingplace,
                 branchname => $branches->{$_}->{branchname},
-            );
-            push @billingplaceloop, \%row;
+            };
         }
         $template->param( billingplaceloop => \@billingplaceloop );
         
         # Build the combobox to select the delivery place
         my @deliveryplaceloop;
         for (sort keys %$branches) {
-            my $selected = 1 if $_ eq $deliveryplace;
-            my %row = (
+            push @deliveryplaceloop, {
                 value      => $_,
-                selected   => $selected,
+                selected   => $_ eq $deliveryplace,
                 branchname => $branches->{$_}->{branchname},
-            );
-            push @deliveryplaceloop, \%row;
+            };
         }
         $template->param( deliveryplaceloop => \@deliveryplaceloop );
 
index 0190e4a..2c41742 100755 (executable)
@@ -75,11 +75,17 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 
-my $from_iso = C4::Dates->new($input->param('from'))->output('iso') if $input->param('from');
-my   $to_iso =   C4::Dates->new($input->param('to'))->output('iso') if $input->param('iso');
+my ( $from_iso, $to_iso, $d );
+if ( $d = $input->param('from') ) {
+    $from_iso = C4::Dates->new($d)->output('iso');
+}
+if ( $d = $input->param('iso') ) {
+    $to_iso = C4::Dates->new($d)->output('iso');
+}
+
 my ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) =
-  &GetHistory( $title, $author, $name, $from_iso, $to_iso );
-  
+  GetHistory( $title, $author, $name, $from_iso, $to_iso );
+
 $template->param(
     suggestions_loop        => $order_loop,
     total_qty               => $total_qty,