accesslib:content_moved() fix bug in depth handling

the depth was getting a bit out-of-control when moving
up the tree. Fix it...
This commit is contained in:
martinlanghoff 2007-09-19 07:14:11 +00:00
parent a372aab507
commit b4ab7f2ec9

View file

@ -4759,8 +4759,8 @@ function context_moved($context, $newparent) {
$newpath = $newparent->path . '/' . $context->id;
$setdepth = '';
if ($newparent->depth +1 != $context->depth) {
$setdepth = ", depth= depth + " . ($context->depth - $newparent->depth +1);
if (($newparent->depth +1) != $context->depth) {
$setdepth = ", depth= depth + ({$newparent->depth} - {$context->depth}) + 1";
}
$sql = "UPDATE {$CFG->prefix}context
SET path='$newpath'