The five trailing braces just feel "wrong" to me, in particularmy $action = param("ACTION"); if($action) { #Bond the built-in and accessory components to the parent. if($action eq "BOND") { my $main = param("MAIN"); my @built = param("BUILT"); my @acc = param("ACC"); my $query = "SELECT location FROM demstock2 WHERE ds_i +d=$main"; my $sth = $db->prepare($query); $sth->execute or print "Can't execute <pre>$query</pre +>: " . $db->errstr . "<br>\n"; my $mainlocation = $sth->fetchrow_hashref; if($mainlocation->{"location"} ne "STOCK") { print b("Refusing to bond items to $main, as i +t isn't in main stock") . br(); } else { $sth->finish(); for my $acc (@acc) { my $query = "SELECT curr_parent_id FRO +M demstock2 WHERE ds_id=$acc"; my $sth = $db->prepare($query); $sth->execute() or print "Can't execut +e $query: " . $sth->errstr . "<br>\n"; my $current_status = $sth->fetchrow_ha +shref; $sth->finish(); if($current_status->{"curr_parent_id"} + != 0) { print "Refusing to modify the +status of demstock $acc. It has already been moved<br>\n"; } else { my $query = "UPDATE demstock2 +SET curr_parent_id=$main WHERE ds_id=$acc"; my $sth = $db->prepare($quer +y); $sth->execute or print "Can't +execute <pre>$query</pre>: " . $db->errstr . "<br>\n"; $sth->finish(); $query = "INSERT INTO action " +; $query .= "(action_id, actio +n_type, ds_id, occurred, ref_no, staff_id) VALUES" ; $query .= "(NULL, 'MOVE +', $acc, CURRENT_TIMESTAMP, \"0,$main\", $caluser)"; $sth = $db->prepare($query); $sth->execute or print "Can't +execute <pre>$query</pre>: " . $db->errstr . "<br>\n"; $sth->finish; } } for my $built (@built) { my $query = "SELECT curr_parent_id FRO +M demstock2 WHERE ds_id=$built"; my $sth = $db->prepare($query); $sth->execute() or print "Can't execut +e $query: " . $sth->errstr . "<br>\n"; my $current_status = $sth->fetchrow_ha +shref; $sth->finish(); if($current_status->{"curr_parent_id"} + != 0) { print "Refusing to modify the +status of demstock $built. It has already been moved<br>\n"; } else { my $query = "UPDATE demstock2 +SET curr_parent_id=$main WHERE ds_id=$built"; my $sth = $db->prepare($quer +y); $sth->execute() or print "Can' +t execute $query: " . $sth->errstr . "<br>\n"; $sth->finish(); $query = "INSERT INTO action " +; $query .= "(action_id, actio +n_type, ds_id, occurred, ref_no, staff_id) VALUES" ; $query .= "(NULL, 'MOVE +', $built, CURRENT_TIMESTAMP, \"0,$main\", $caluser)"; $sth = $db->prepare($query); $sth->execute or print "Can't +execute <pre>$query</pre>: " . $sth->errstr . "<br>\n"; $sth->finish; } } } } }
In reply to A question of style. by davis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |