CRM-9764 Fix underfined property notices noticed by David
authorSeamus Lee <seamuslee001@gmail.com>
Thu, 25 Jun 2015 00:25:56 +0000 (00:25 +0000)
committerSeamus Lee <seamuslee001@gmail.com>
Thu, 25 Jun 2015 00:25:56 +0000 (00:25 +0000)
14 files changed:
CRM/Contact/Form/Search/Custom/ActivitySearch.php
CRM/Contact/Form/Search/Custom/Basic.php
CRM/Contact/Form/Search/Custom/ContribSYBNT.php
CRM/Contact/Form/Search/Custom/ContributionAggregate.php
CRM/Contact/Form/Search/Custom/DateAdded.php
CRM/Contact/Form/Search/Custom/EventAggregate.php
CRM/Contact/Form/Search/Custom/MultipleValues.php
CRM/Contact/Form/Search/Custom/PostalMailing.php
CRM/Contact/Form/Search/Custom/PriceSet.php
CRM/Contact/Form/Search/Custom/Proximity.php
CRM/Contact/Form/Search/Custom/RandomSegment.php
CRM/Contact/Form/Search/Custom/Sample.php
CRM/Contact/Form/Search/Custom/TagContributions.php
CRM/Contact/Form/Search/Custom/ZipCodeRange.php

index 9590cb644f94966f8ab29bcb53fb5768d7f50244..6072f7c18b1e94ee799c8198a1ce1efc0669ea48 100644 (file)
@@ -256,6 +256,7 @@ ORDER BY contact_a.sort_name';
    * @return string
    */
   public function from() {
+    $this->buildACLClause('contact_a');
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
     $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
     $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
@@ -282,10 +283,6 @@ ORDER BY contact_a.sort_name';
             LEFT JOIN civicrm_contact contact_c
                  ON assignment.contact_id = contact_c.id {$this->_aclFrom}";
 
-    if ($this->_aclWhere) {
-      $this->_where .= " {$this->_aclWhere} ";
-    }
-
     return $from;
   }
 
@@ -363,6 +360,10 @@ ORDER BY contact_a.sort_name';
       }
     }
 
+    if ($this->_aclWhere) {
+      $clauses[] = " {$this->_aclWhere} ";
+    }
+
     return implode(' AND ', $clauses);
   }
 
index f4256b02f1e6a8d81b8e7dfffd6b741446cfc0cc..b920a45188cdf77bcaeb8f0f492575da49646978 100644 (file)
@@ -183,9 +183,6 @@ class CRM_Contact_Form_Search_Custom_Basic extends CRM_Contact_Form_Search_Custo
     $this->buildACLClause('contact_a');
     $from = $this->_query->_fromClause;
     $from .= "{$this->_aclFrom}";
-    if ($this->_aclWhere) {
-      $this->_where .= " AND {$this->_aclWhere} ";
-    }
     return $from;
   }
 
@@ -196,6 +193,9 @@ class CRM_Contact_Form_Search_Custom_Basic extends CRM_Contact_Form_Search_Custo
    */
   public function where($includeContactIDs = FALSE) {
     if ($whereClause = $this->_query->whereClause()) {
+      if ($this->_aclWhere) {
+        $whereCluase .= " AND {$this->_aclWhere} ";
+      }
       return $whereClause;
     }
     return ' (1) ';
index 1d51a84d71b9a1bb75a819840739d956a3972554..cb9d54e226e3e0e55e82f59254144ef2bd798bb5 100644 (file)
@@ -181,9 +181,6 @@ class CRM_Contact_Form_Search_Custom_ContribSYBNT extends CRM_Contact_Form_Searc
 
     }
     $this->buildACLClause('contact_a');
-    if ($this->_aclWhere) {
-      $where .= " AND {$this->_aclWhere} ";
-    }
     $sql = "
 SELECT     $select
 FROM       civicrm_contact AS contact_a {$this->_aclFrom}
@@ -341,6 +338,9 @@ AND      c.receive_date < {$this->start_date_1}
 
       $clauses[] = " xg.contact_id IS NULL ";
     }
+    if ($this->_aclWhere) {
+      $clauses[] .= " {$this->_aclWhere} ";
+    }
     return implode(' AND ', $clauses);
   }
 
index 519be745deaa1dd98a5d7704ff7fc787010d6ef6..fdbf2435d7583b24c7e8f014fe0b9cd10aaceae5 100644 (file)
@@ -184,9 +184,7 @@ $having
 civicrm_contribution AS contrib,
 civicrm_contact AS contact_a {$this->_aclFrom}
 ";
-    if ($this->_aclWhere) {
-      $this->_where .= " {$this->_aclWhere} ";
-    }
+
     return $from;
   }
 
@@ -233,8 +231,12 @@ civicrm_contact AS contact_a {$this->_aclFrom}
       $financial_type_ids = implode(',', array_keys($this->_formValues['financial_type_id']));
       $clauses[] = "contrib.financial_type_id IN ($financial_type_ids)";
     }
-
-    return implode(' AND ', $clauses);
+    if ($this->_aclWhere) {
+      return " {$this->_aclWhere} " . implode(' AND ', $clauses);
+    }
+    else {
+      return implode(' AND ', $clauses);
+    }
   }
 
   /**
index 43baeb5d34b49370bde9393ede2f1ced43eb1cd8..a2106ff25e7539681def1b1811d79c0a14db24cc 100644 (file)
@@ -388,10 +388,6 @@ class CRM_Contact_Form_Search_Custom_DateAdded extends CRM_Contact_Form_Search_C
       $from .= " INNER JOIN Ig_{$this->_tableName} temptable1 ON (contact_a.id = temptable1.contact_id)";
     }
 
-    if ($this->_aclWhere) {
-      $this->_where .= " AND {$this->_aclWhere} ";
-    }
-
     return $from;
   }
 
@@ -401,7 +397,11 @@ class CRM_Contact_Form_Search_Custom_DateAdded extends CRM_Contact_Form_Search_C
    * @return string
    */
   public function where($includeContactIDs = FALSE) {
-    return '(1)';
+    $where = '(1)';
+    if ($this->_aclWhere) {
+      $where = " AND {$this->_aclWhere} ";
+    }
+    return $where;
   }
 
   /**
index 5eb28b8a180f6d32a3606907f66be916e472c114..be637b99dec7246cbbff41c4d6ccb4e2caaf36ba 100644 (file)
@@ -205,9 +205,6 @@ class CRM_Contact_Form_Search_Custom_EventAggregate extends CRM_Contact_Form_Sea
 
         left join civicrm_option_value on
         ( civicrm_option_value.value = civicrm_event.event_type_id AND civicrm_option_value.option_group_id = 14) {$this->_aclFrom}";
-    if ($this->_aclWhere) {
-      $this->_where .= "{$this->_aclWhere} ";
-    }
 
     return $from;
   }
@@ -265,6 +262,9 @@ class CRM_Contact_Form_Search_Custom_EventAggregate extends CRM_Contact_Form_Sea
       $event_type_ids = implode(',', array_keys($this->_formValues['event_type_id']));
       $clauses[] = "civicrm_event.event_type_id IN ( $event_type_ids )";
     }
+    if ($this->_aclWhere) {
+      $clauses[] = "{$this->_aclWhere} ";
+    }
     return implode(' AND ', $clauses);
   }
 
index 701545516f77a503d591b9c43e9f09c1fe0777bf..132392466838a57118e0be15f8e2318f2d630a6c 100644 (file)
@@ -229,10 +229,6 @@ contact_a.sort_name    as sort_name,
                        AND cgc.status = 'Added')";
     }
 
-    if ($this->_aclWhere) {
-      $this->_where .= " AND {$this->_aclWhere} ";
-    }
-
     return $from;
   }
 
@@ -277,6 +273,9 @@ contact_a.sort_name    as sort_name,
     if ($this->_group) {
       $clause[] = "cgc.group_id = {$this->_group}";
     }
+    if ($this->_aclWhere) {
+      $clause[] = " AND {$this->_aclWhere} ";
+    }
 
     $where = '( 1 )';
     if (!empty($clause)) {
index 0f33fc669282a3d790b9b2ecdc02042b6395230a..317cfc05e69614edeac45a09511ce909643df5a3 100644 (file)
@@ -121,9 +121,6 @@ LEFT JOIN civicrm_address address               ON (address.contact_id       = c
                                                     address.is_primary       = 1 )
 LEFT JOIN civicrm_state_province state_province ON  state_province.id = address.state_province_id {$this->_aclFrom}
 ";
-    if ($this->_aclWhere) {
-      $this->_where .= " {$this->_aclWhere} ";
-    }
     return $from;
   }
 
@@ -150,7 +147,11 @@ LEFT JOIN civicrm_state_province state_province ON  state_province.id = address.
                                        (select cr.contact_id_b from civicrm_relationship cr where (cr.contact_id_a = cgc.contact_id AND (cr.relationship_type_id = 7 OR cr.relationship_type_id = 6))),
                                         cgc.contact_id )";
     $clause[] = "contact_a.contact_type IN ('Individual','Household')";
-
+    
+    if ($this->_aclWhere) {
+      $clause[] = " {$this->_aclWhere} ";
+    }
+    
     if (!empty($clause)) {
       $where = implode(' AND ', $clause);
     }
index 4793e00a11a14cb2e8a6ec6f3b577953ae850c3a..01c39a5022292ebdc262bba723609146ac7aa4d3 100644 (file)
@@ -315,10 +315,6 @@ contact_a.display_name   as display_name";
 FROM       civicrm_contact contact_a
 INNER JOIN {$this->_tableName} tempTable ON ( tempTable.contact_id = contact_a.id ) {$this->_aclFrom}
 ";
-    if ($this->_aclWhere) {
-      $this->_where .= " AND {$this->_aclWhere} ";
-    }
-
     return $from;
   }
 
@@ -328,7 +324,11 @@ INNER JOIN {$this->_tableName} tempTable ON ( tempTable.contact_id = contact_a.i
    * @return string
    */
   public function where($includeContactIDs = FALSE) {
-    return ' ( 1 ) ';
+    $where = ' ( 1 ) ';
+    if ($this->_aclWhere) {
+      $where = " AND {$this->_aclWhere} ";
+    }
+    return $where;
   }
 
   /**
index 3f9e8c632a58ce3bc8894b5aaf8e97811124b18e..47633813d69ea77e57f3e63cdf62302af08318a8 100644 (file)
@@ -222,10 +222,6 @@ LEFT JOIN civicrm_group_contact cgc ON ( cgc.contact_id = contact_a.id AND cgc.s
 ";
     }
 
-    if ($this->_aclWhere) {
-      $this->_where .= " AND {$this->_aclWhere} ";
-    }
-
     return $f;
   }
 
@@ -257,7 +253,11 @@ AND cgc.group_id = {$this->_group}
 
     $where .= " AND contact_a.is_deleted != 1 ";
     $where .= "{$this->_where}";
-
+    
+    if ($this->_aclWhere) {
+      $where .= " AND {$this->_aclWhere} ";
+    }
+    
     return $this->whereClause($where, $params);
   }
 
index d590a34834639c36eb565bf6f9a1ddb7bf7994cc..0e972f2404b60c467ebacc4e6c8da96f0973f8c5 100644 (file)
@@ -331,10 +331,6 @@ class CRM_Contact_Form_Search_Custom_RandomSegment extends CRM_Contact_Form_Sear
 
     $from .= " $fromTail";
 
-    if ($this->_aclWhere) {
-      $this->_where .= " AND {$this->_aclWhere} ";
-    }
-
     return $from;
 
   }
@@ -345,6 +341,12 @@ class CRM_Contact_Form_Search_Custom_RandomSegment extends CRM_Contact_Form_Sear
    * @return string
    */
   public function where($includeContactIDs = FALSE) {
+    $where = '(1)';
+    
+    if ($this->_aclWhere) {
+      $where = " AND {$this->_aclWhere} ";
+    }
+    
     return '(1)';
   }
 
index 99929e53450c73ca8e5aceb13775bde8447f35a0..6f11d7830f4619833788ebb87a2f839387aed5d3 100644 (file)
@@ -149,9 +149,6 @@ LEFT JOIN civicrm_email           ON ( civicrm_email.contact_id = contact_a.id A
                                        civicrm_email.is_primary = 1 )
 LEFT JOIN civicrm_state_province state_province ON state_province.id = address.state_province_id {$this->_aclFrom}
 ";
-    if ($this->_aclWhere) {
-      $this->_where .= " AND {$this->_aclWhere} ";
-    }
     return $from;
   }
 
@@ -192,6 +189,10 @@ LEFT JOIN civicrm_state_province state_province ON state_province.id = address.s
       $params[$count] = array($state, 'Integer');
       $clause[] = "state_province.id = %{$count}";
     }
+    
+    if ($this->_aclWhere) {
+      $clause[] = " AND {$this->_aclWhere} ";
+    }
 
     if (!empty($clause)) {
       $where .= ' AND ' . implode(' AND ', $clause);
index c57cbbea1be9b2092e912aaac7f5fbe5ad609181..30a3fae809f3d5a9b2e4c4e28e005511245b4965 100644 (file)
@@ -154,9 +154,6 @@ WHERE  $where
                                         civicrm_entity_tag.entity_id = contact_a.id )
       LEFT JOIN civicrm_tag ON civicrm_tag.id = civicrm_entity_tag.tag_id {$this->_aclFrom}
      ";
-    if ($this->_aclWhere) {
-      $this->_where .= " {$this->_aclWhere} ";
-    }
     return $from;
   }
 
@@ -209,6 +206,9 @@ WHERE  $where
         $clauses[] = "contact_a.id IN ( $contactIDs )";
       }
     }
+    if ($this->_aclWhere) {
+      $clauses[] = " {$this->_aclWhere} ";
+    }
     return implode(' AND ', $clauses);
   }
 
index 8ca17281b9c69979c2002a5020c95528364b551a..f661731e1b4bc8cf0b01ad963b645cb7e09d6b81 100644 (file)
@@ -140,9 +140,6 @@ LEFT JOIN civicrm_address address ON ( address.contact_id       = contact_a.id A
 LEFT JOIN civicrm_email   email   ON ( email.contact_id = contact_a.id AND
                                        email.is_primary = 1 ) {$this->_aclFrom}
 ";
-    if ($this->_aclWhere) {
-      $this->_where .= " {$this->_aclWhere} ";
-    }
     return $from;
   }
 
@@ -175,6 +172,10 @@ LEFT JOIN civicrm_email   email   ON ( email.contact_id = contact_a.id AND
       2 => array(trim($high), 'Integer'),
     );
 
+    if ($this->_aclWhere) {
+      $where .= " AND {$this->_aclWhere} ";
+    }
+
     return $this->whereClause($where, $params);
   }