Commit 2214b02a authored by Mike Kelly's avatar Mike Kelly Committed by Robert Lyon
Browse files

Restructure usr_custom_layout table to take groups into account

Bug #1266317

Group pages, site and institution pages were set as having usr = 0 in
usr_custom_layout because the view owner is null.

Fix by adding group column to table, foreign keyed to group table.

usr column and group column have to be changed to allow null values, and
to have null as default values.

When saving a custom layout, check context, then set usr and group
values accordingly. 
usr = 5, group = null 
usr = null, group = 321
In the case of site and institution pages:
usr = null, group = null

Change-Id: Id42ebcc543d29ee2455aef73227b57c569171385
Signed-off-by: default avatarMike Kelly <>
parent d2531cc4
......@@ -1225,7 +1225,7 @@ class PluginImportLeap extends PluginImport {
vl.iscustom = 0
OR (
vl.iscustom = 1 AND ucl.usr = ?
vl.iscustom = 1 AND ucl.usr = ? AND IS NULL
GROUP BY vlrc.viewlayout
......@@ -770,13 +770,15 @@
<TABLE NAME="usr_custom_layout">
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
<FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true"/>
<FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="layout" TYPE="int" LENGTH="10" NOTNULL="true"/>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="layoutfk" TYPE="foreign" FIELDS="layout" REFTABLE="view_layout" REFFIELDS="id"/>
<KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id"/>
<KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
<TABLE NAME="view_rows_columns">
......@@ -1194,6 +1194,7 @@ function install_view_layout_defaults() {
'usr' => 0,
'group' => null,
'layout' => $vlid,
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