Fix syntax and variable naming brainos

This commit is contained in:
Chris 2016-12-24 16:44:36 +00:00
parent 536ed85f97
commit 0a2a4b5bc6
3 changed files with 10 additions and 10 deletions

View File

@ -48,7 +48,7 @@ use ORB::System::Recipe;
# @return true on success, false if something failed. If this returns false,
# the reason is in $self -> {"errstr"}.
sub init {
my $self = shift;
my $self = shift;
# Let the superclass copy the references over
$self -> SUPER::init(@_)

View File

@ -165,19 +165,19 @@ sub destroy {
}
# Check that the entity is safe to delete...
my $refcount = $self -> _fetch_refcount($id);
my $refcount = $self -> _fetch_refcount($args -> {"id"});
return $self -> self_error("Attempt to delete non-existent entity $id from ".$self -> {"entity_table"})
return $self -> self_error("Attempt to delete non-existent entity ".$args -> {"id"}." from ".$self -> {"entity_table"})
unless(defined($refcount));
return $self -> self_error("Attempt to delete entity $id in ".$self -> {"entity_table"}." while still in use ($refcount references)")
return $self -> self_error("Attempt to delete entity ".$args -> {"id"}." in ".$self -> {"entity_table"}." while still in use ($refcount references)")
if($refcount);
# And now delete the entity itself
my $nukeh = $self -> {"dbh"} -> prepare("DELETE FROM `".$self -> {"settings"} -> {"database"} -> {$self -> {"entity_table"}}."`
WHERE `id` = ?");
$nukeh -> execute($args -> {"id"})
or return $self -> self_error("Unable to perform entity $id removal from ".$self -> {"entity_table"}.": ". $self -> {"dbh"} -> errstr);
or return $self -> self_error("Unable to perform entity ".$args -> {"id"}." removal from ".$self -> {"entity_table"}.": ". $self -> {"dbh"} -> errstr);
return 1;
}
@ -206,7 +206,7 @@ sub get_id {
# Multiple results are potentially dangerous. Log it as an error, but return the first hit anyway
if(scalar(@{$id}) > 1) {
$self -> self_error("Multiple matches for specified entity name '".$args -> {"name"}."'");
$self -> self_error("Multiple matches for specified entity name '$name'");
return $id -> [0]
}

View File

@ -670,7 +670,7 @@ sub _renumber_recipe {
my $newid = $self -> {"dbh"} -> {"mysql_insertid"}
or return $self -> self_error("Unable to obtain id for new recipe");
$self -> _fix_recipe_relations($sourceid, $destid)
$self -> _fix_recipe_relations($sourceid, $newid)
or return undef;
# Nuke the old recipe
@ -701,9 +701,9 @@ sub _fix_recipe_relations {
$self -> clear_error();
# Move ingredient relation IDs
$moveh = $self -> {"dbh"} -> prepare("UPDATE `".$self -> {"settings"} -> {"database"} -> {"recipeing"}."`
SET `recipe_id` = ?
WHERE `recipe_id` = ?");
my $moveh = $self -> {"dbh"} -> prepare("UPDATE `".$self -> {"settings"} -> {"database"} -> {"recipeing"}."`
SET `recipe_id` = ?
WHERE `recipe_id` = ?");
$moveh -> execute($destid, $sourceid)
or return $self -> self_error("Ingredient relation fixup failed: ".$self -> {"dbh"} -> errstr());