CRM-19368 - Fix invalid argument foreach and undefined index
authorColeman Watts <coleman@civicrm.org>
Fri, 30 Sep 2016 20:52:26 +0000 (16:52 -0400)
committerColeman Watts <coleman@civicrm.org>
Fri, 30 Sep 2016 20:52:26 +0000 (16:52 -0400)
CRM/Report/Form/Contact/Relationship.php

index 6666a97a49cc792ad4aa85d253c32bb5c2729416..c5c5c60abb7f0dac9f1a3852019437fab0232b16 100644 (file)
@@ -588,12 +588,11 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form {
   public function postProcess() {
     $this->beginPostProcess();
 
-    $originalRelationshipTypeIdValue = $this->_params['relationship_type_id_value'];
-    if (!empty($this->_params['relationship_type_id_value'])) {
+    $originalRelationshipTypeIdValue = CRM_Utils_Array::value('relationship_type_id_value', $this->_params);
+    if ($originalRelationshipTypeIdValue) {
       $relationshipTypes = array();
       $direction = array();
-      $relType = array();
-      foreach ($this->_params['relationship_type_id_value'] as $relationship_type) {
+      foreach ((array) $originalRelationshipTypeIdValue as $relationship_type) {
         $relType = explode('_', $relationship_type);
         $direction[] = $relType[1] . '_' . $relType[2];
         $relationshipTypes[] = intval($relType[0]);