Commit d85a81d0 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1696587: Only replace the missing view_row_columns records if the view has an id



To avoid problem when creating a view from import when layout is
specified by creating a dummy view to create the layout needed
before the real page is created

behatnotneeded

Change-Id: I9e3fc2e9cb14321b8697ac37890b37191ff2efe1
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 061b1e41
......@@ -326,12 +326,14 @@ class View {
WHERE viewlayout = ?", array($this->layout))) {
$default = array();
foreach ($rowscols as $row) {
$vrc = (object) array(
'view' => $this->get('id'),
'row' => $row->row,
'columns' => $row->columns
);
ensure_record_exists('view_rows_columns', $vrc, $vrc);
if ($this->get('id')) {
$vrc = (object) array(
'view' => $this->get('id'),
'row' => $row->row,
'columns' => $row->columns
);
ensure_record_exists('view_rows_columns', $vrc, $vrc);
}
$default[$row->row] = $row;
}
}
......@@ -345,20 +347,24 @@ class View {
// Layout not specified so use the view type default layout
$default = array();
foreach ($rowscols as $row) {
$vrc = (object) array(
'view' => $this->get('id'),
'row' => $row->row,
'columns' => $row->columns
);
ensure_record_exists('view_rows_columns', $vrc, $vrc);
if ($this->get('id')) {
$vrc = (object) array(
'view' => $this->get('id'),
'row' => $row->row,
'columns' => $row->columns
);
ensure_record_exists('view_rows_columns', $vrc, $vrc);
}
$default[$row->row] = $row;
}
}
else {
// Layout not known so make it 1 row / 3 cols
insert_record('view_rows_columns', (object) array(
'view' => $this->get('id'),
'row' => 1, 'columns' => 3));
if ($this->get('id')) {
insert_record('view_rows_columns', (object) array(
'view' => $this->get('id'),
'row' => 1, 'columns' => 3));
}
$default = self::default_columnsperrow();
}
$this->columnsperrow = $default;
......
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