When adding multiple organisation relations to a contacts view, the is_primary field breaks the view because it doesn't use a table alias. it tries to do a lookup via ensure_table() but doesn't check the return value and doesn't actually use the alias is finds, if any...
I note the code in question has a @todo so clearly this is a known problem :-)
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2325223-multi-org-primary-contact-4.patch | 1.88 KB | cafuego |
| #1 | 2325223-multi-org-primary-contact-1.patch | 1.79 KB | cafuego |
Comments
Comment #1
cafuego commentedAttached patch adds a wrapper for $this->query->ensure_table() that checks the list of relation tables and returns the alias for the correct one.
I'm not sure if this is the right way to fix the problem, but it definitely works just fine for my view with three different contact-> relation -> org relationships.
Comment #2
cafuego commentedComment #3
cafuego commentedOops, forgot to actually use the newly looked-up $org_table in the query.
Comment #4
cafuego commentedSrsly.
Comment #5
levelos commented