예제 #1
0
 static function fromWhereEmail($id)
 {
     $params =& self::getSearchParams($id);
     if ($params) {
         if (CRM_Utils_Array::value('customSearchID', $params)) {
             require_once 'CRM/Contact/BAO/SearchCustom.php';
             return CRM_Contact_BAO_SearchCustom::fromWhereEmail(null, $id);
         } else {
             $tables = $whereTables = array('civicrm_contact' => 1, 'civicrm_email' => 1);
             $where = CRM_Contact_BAO_SavedSearch::whereClause($id, $tables, $whereTables);
             $from = CRM_Contact_BAO_Query::fromClause($whereTables);
             return array($from, $where);
         }
     } else {
         // fix for CRM-7240
         $from = "\nFROM      civicrm_contact contact_a \nLEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)\n";
         $where = " ( 1 ) ";
         $tables['civicrm_contact'] = $whereTables['civicrm_contact'] = 1;
         $tables['civicrm_email'] = $whereTables['civicrm_email'] = 1;
         return array($from, $where);
     }
 }
예제 #2
0
 /**
  * Get from where email (whatever that means!).
  *
  * @param int $id
  *
  * @return array
  */
 public static function fromWhereEmail($id)
 {
     $params = self::getSearchParams($id);
     if ($params) {
         if (!empty($params['customSearchID'])) {
             return CRM_Contact_BAO_SearchCustom::fromWhereEmail(NULL, $id);
         } else {
             $tables = $whereTables = array('civicrm_contact' => 1, 'civicrm_email' => 1);
             $where = CRM_Contact_BAO_SavedSearch::whereClause($id, $tables, $whereTables);
             $from = CRM_Contact_BAO_Query::fromClause($whereTables);
             return array($from, $where);
         }
     } else {
         // fix for CRM-7240
         $from = "\nFROM      civicrm_contact contact_a\nLEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)\n";
         $where = " ( 1 ) ";
         $tables['civicrm_contact'] = $whereTables['civicrm_contact'] = 1;
         $tables['civicrm_email'] = $whereTables['civicrm_email'] = 1;
         return array($from, $where);
     }
 }
예제 #3
0
 static function fromWhereEmail($id)
 {
     $params =& self::getSearchParams($id);
     if ($params) {
         if (CRM_Utils_Array::value('customSearchID', $params)) {
             require_once 'CRM/Contact/BAO/SearchCustom.php';
             return CRM_Contact_BAO_SearchCustom::fromWhereEmail(null, $id);
         } else {
             $tables = $whereTables = array('civicrm_contact' => 1, 'civicrm_email' => 1);
             $where = CRM_Contact_BAO_SavedSearch::whereClause($id, $tables, $whereTables);
             $from = CRM_Contact_BAO_Query::fromClause($whereTables);
             return array($from, $where);
         }
     } else {
         CRM_Core_Error::fatal('No contactID clause');
     }
 }