Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.2.0
-
Fix Version/s: 4.2.0
-
Component/s: Drupal Integration Modules
-
Labels:
Description
Steps to reproduce:
1. Create a Drupal view of civicrm_contacts
2. Add field "CiviCRM Relationships: Relationship Type A-to-B"
3. Observe an error reporting "unsupported operand type"
4. Observe empty relationship type fields even for those contacts with valid relationships
There are two issues here. The first is that civicrm_handler_field_relationship_type.inc's construct() method does not first call it's parent construct() method. This is causing the unsupported operand types error as an options array is not properly initialized without it.
Secondly, when this class is initialized it attempts to load and cache all relationship type names. However, it was attempting to access the relationships using the array key 'label_a_b' which does not exist. It therefore caches no relationship types at all.
Please see attached patch for relevant fixes.