Details
-
Type: Sub-task
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.2.0, 2.2.1, 2.2.2, 2.2.3
-
Fix Version/s: 2.2.4
-
Component/s: Drupal Integration Modules
-
Labels:None
Description
I had some problems with the Views 2 integration I contributed...
When I was starting from a CiviCRM Contact and joining in the Drupal Users object, all worked fine. But, when I started with the Drupal Users object and JOINed in the CiviCRM Contact object, some of the SQL was being generated incorectly.
The JOIN from users.uid -> civicrm_uf_match.uf_id | civicrm_uf_match.contact_id -> civicrm_contact.id was wrongly being generated as:
users.uid -> civicrm_uf_match.contact_id | civicrm_uf_match.uf_id -> civicrm_contact.id
So, I figured I had to put a conditional in the custom relationship handler (civicrm_handler_relationship_contact2users) to detect if the base table was the CiviCRM Contact table and set up the JOIN tables and then set the JOIN tables in the opposite direction if the base table was not the CiviCRM Contact table.
The way I have implemented it, and tested thoroughly, seems to work for all use-cases: where CiviCRM Contact table is the object and where another Views 2 defined object is the base table. I think I may have taken an unconventional solution, as I have not seen this documented for other Views 2 code.
Thanks,
Jason