Commit 0641cd02 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix sql error preventing blocks being moved down two or more places within the same column


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent d099d4ba
......@@ -1262,6 +1262,12 @@ class View {
}
else {
$this->shuffle_column($bi->get('column'), $values['order'], $bi->get('order'));
if ($bi->get('order') < $values['order']) {
// When moving a block down within a column, the final order is one less
// than the 'desired' order because of the empty space created when the
// block gets taken out of its original spot.
$values['order'] -= 1;
}
}
}
// moving to another column
......@@ -1411,15 +1417,12 @@ class View {
if (!empty($insert)) {
// shuffle everything up
$this->shuffle_helper('order', 'up', '>=', $insert, '"column" = ?', array($column));
}
// shuffle everything down
$this->shuffle_helper('order', 'down', '>', $remove, '"column" = ?', array($column));
if (!empty($insert)) {
// now move it back
set_field('block_instance', 'order', $insert, 'view', $this->get('id'), 'column', $column, 'order', 0);
}
// shuffle everything down
$this->shuffle_helper('order', 'down', '>', $remove, '"column" = ?', array($column));
}
else if (!empty($insert)) {
// shuffle everything up
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment