Skip to content

Commit 6636674

Browse files
committed
Properly handle assignments in case of serial data
Search query should check assignment status only for pages, but not serial data. Fixes cosmocode#666
1 parent b20fff6 commit 6636674

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

meta/Assignments.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
/**
66
* Class Assignments
77
*
8-
* Manages the assignment of schemas (table names) to pages and namespaces
8+
* Manages the assignment of schemas (table names) to pages and namespaces.
9+
* An assignment is created when actual struct data is attached to the page.
10+
* Assignment are never deleted, only their "assigned" status is changed.
911
*
1012
* This is a singleton. Assignment data is only loaded once per request.
1113
*

meta/SearchSQLBuilder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public function addSchemas($schemas)
4747
$subOr = $subAnd->whereSubOr();
4848
$subOr->whereAnd("GETACCESSLEVEL($datatable.pid) > 0");
4949
$subOr->whereAnd("PAGEEXISTS($datatable.pid) = 1");
50-
$subOr->whereAnd('(ASSIGNED = 1 OR ASSIGNED IS NULL)');
50+
// make sure to check assignment for page data only
51+
$subOr->whereAnd("($datatable.rid != 0 OR (ASSIGNED = 1 OR ASSIGNED IS NULL))");
5152

5253
// add conditional schema assignment check
5354
$this->qb->addLeftJoin(

0 commit comments

Comments
 (0)