Fix syntax and variable naming brainos
This commit is contained in:
parent
536ed85f97
commit
0a2a4b5bc6
@ -48,7 +48,7 @@ use ORB::System::Recipe;
|
|||||||
# @return true on success, false if something failed. If this returns false,
|
# @return true on success, false if something failed. If this returns false,
|
||||||
# the reason is in $self -> {"errstr"}.
|
# the reason is in $self -> {"errstr"}.
|
||||||
sub init {
|
sub init {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
# Let the superclass copy the references over
|
# Let the superclass copy the references over
|
||||||
$self -> SUPER::init(@_)
|
$self -> SUPER::init(@_)
|
||||||
|
@ -165,19 +165,19 @@ sub destroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check that the entity is safe to delete...
|
# 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));
|
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);
|
if($refcount);
|
||||||
|
|
||||||
# And now delete the entity itself
|
# And now delete the entity itself
|
||||||
my $nukeh = $self -> {"dbh"} -> prepare("DELETE FROM `".$self -> {"settings"} -> {"database"} -> {$self -> {"entity_table"}}."`
|
my $nukeh = $self -> {"dbh"} -> prepare("DELETE FROM `".$self -> {"settings"} -> {"database"} -> {$self -> {"entity_table"}}."`
|
||||||
WHERE `id` = ?");
|
WHERE `id` = ?");
|
||||||
$nukeh -> execute($args -> {"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;
|
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
|
# Multiple results are potentially dangerous. Log it as an error, but return the first hit anyway
|
||||||
if(scalar(@{$id}) > 1) {
|
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]
|
return $id -> [0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,7 +670,7 @@ sub _renumber_recipe {
|
|||||||
my $newid = $self -> {"dbh"} -> {"mysql_insertid"}
|
my $newid = $self -> {"dbh"} -> {"mysql_insertid"}
|
||||||
or return $self -> self_error("Unable to obtain id for new recipe");
|
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;
|
or return undef;
|
||||||
|
|
||||||
# Nuke the old recipe
|
# Nuke the old recipe
|
||||||
@ -701,9 +701,9 @@ sub _fix_recipe_relations {
|
|||||||
$self -> clear_error();
|
$self -> clear_error();
|
||||||
|
|
||||||
# Move ingredient relation IDs
|
# 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` = ?
|
SET `recipe_id` = ?
|
||||||
WHERE `recipe_id` = ?");
|
WHERE `recipe_id` = ?");
|
||||||
$moveh -> execute($destid, $sourceid)
|
$moveh -> execute($destid, $sourceid)
|
||||||
or return $self -> self_error("Ingredient relation fixup failed: ".$self -> {"dbh"} -> errstr());
|
or return $self -> self_error("Ingredient relation fixup failed: ".$self -> {"dbh"} -> errstr());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user