Rearrange steps of code in edit to catch problems more reliably

This commit is contained in:
Chris 2019-09-28 11:56:01 +01:00
parent de15291388
commit 670d320e88

View File

@ -229,20 +229,20 @@ sub edit {
$self -> {"logger"} -> log("recipe.edit", $args -> {"creator_id"}, "unknown", "Renumbered ".$args -> {"id"}." as $renumbered"); $self -> {"logger"} -> log("recipe.edit", $args -> {"creator_id"}, "unknown", "Renumbered ".$args -> {"id"}." as $renumbered");
# Clear the original ID for the master.
$args -> {"origid"} = undef;
# Create the new recipe at the old ID
$self -> create($args)
or return undef;
# Set the status of the edited recipe # Set the status of the edited recipe
$self -> set_status($renumbered, $self -> set_status($renumbered,
$self -> {"settings"} -> {"config"} -> {"Recipe:status:edited"} // "Edited", $self -> {"settings"} -> {"config"} -> {"Recipe:status:edited"} // "Edited",
$args -> {"updaterid"}) $args -> {"updaterid"})
or return undef; or return undef;
return $args -> {"id"};
# Clear the original ID for the master.
$args -> {"origid"} = undef;
$self -> {"logger"} -> log("recipe.edit", $args -> {"creator_id"}, "unknown", "Creating new version of recipe at ".$args -> {"id"});
# Create the new recipe at the old ID
return $self -> create($args);
} }