Add a moveChildren method to the objectManager and implement objectMoveChildren for version
and version_queue. Use this to move versions.
This commit is contained in:
committed by
WineHQ
parent
886cdeafa3
commit
cf81d542ee
@@ -220,6 +220,35 @@ class ObjectManager
|
||||
echo "Failure.\n";
|
||||
}
|
||||
|
||||
/* Move all the object's children to another object of the same type, and
|
||||
delete the original object afterwards */
|
||||
function move_children($iNewId)
|
||||
{
|
||||
$oObject = new $this->sClass($this->iId);
|
||||
$oNewObject = new $this->sClass($iNewId);
|
||||
|
||||
/* The user needs to have edit rights to both the old and the new object
|
||||
If you have edit rights to an object then you should have edit rights
|
||||
to its child objects as well */
|
||||
if(!$oObject->canEdit() || !$oNewObject->canEdit())
|
||||
return FALSE;
|
||||
|
||||
$iAffected = $oObject->objectMoveChildren($iNewId);
|
||||
|
||||
if($iAffected)
|
||||
{
|
||||
$sPlural = ($iAffected == 1) ? "": "s";
|
||||
addmsg("Moved $iAffected child object$sPlural", "green");
|
||||
} else if($iAfffected === FALSE)
|
||||
{
|
||||
/* We don't want to delete this object if some children were not moved */
|
||||
addmsg("Failed to move child objects", "red");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->delete_entry();
|
||||
}
|
||||
|
||||
/* Display screen for submitting a new entry of given type */
|
||||
function add_entry($sBackLink, $sErrors = "")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user