Fix syntax and variable naming brainos
This commit is contained in:
parent
536ed85f97
commit
0a2a4b5bc6
@ -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]
|
||||
}
|
||||
|
||||
|
@ -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,7 +701,7 @@ sub _fix_recipe_relations {
|
||||
$self -> clear_error();
|
||||
|
||||
# Move ingredient relation IDs
|
||||
$moveh = $self -> {"dbh"} -> prepare("UPDATE `".$self -> {"settings"} -> {"database"} -> {"recipeing"}."`
|
||||
my $moveh = $self -> {"dbh"} -> prepare("UPDATE `".$self -> {"settings"} -> {"database"} -> {"recipeing"}."`
|
||||
SET `recipe_id` = ?
|
||||
WHERE `recipe_id` = ?");
|
||||
$moveh -> execute($destid, $sourceid)
|
||||
|
Loading…
x
Reference in New Issue
Block a user