Exemplo n.º 1
0
 /**
  * Function which actually does all the work for the constructor.
  */
 public function initialize()
 {
     $this->_select = array();
     $this->_element = array();
     $this->_tables = array();
     $this->_whereTables = array();
     $this->_where = array();
     $this->_qill = array();
     $this->_options = array();
     $this->_cfIDs = array();
     $this->_paramLookup = array();
     $this->_having = array();
     $this->_customQuery = NULL;
     // reset cached static variables - CRM-5803
     self::$_activityRole = NULL;
     self::$_considerCompActivities = NULL;
     self::$_withContactActivitiesOnly = NULL;
     $this->_select['contact_id'] = 'contact_a.id as contact_id';
     $this->_element['contact_id'] = 1;
     $this->_tables['civicrm_contact'] = 1;
     if (!empty($this->_params)) {
         $this->buildParamsLookup();
     }
     $this->_whereTables = $this->_tables;
     $this->selectClause();
     $this->_whereClause = $this->whereClause();
     $this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode);
     $this->_simpleFromClause = self::fromClause($this->_whereTables, NULL, NULL, $this->_primaryLocation, $this->_mode);
     $this->openedSearchPanes(TRUE);
 }
Exemplo n.º 2
0
 function whereClauseSingle(&$values)
 {
     // do not process custom fields or prefixed contact ids or component params
     if (CRM_Core_BAO_CustomField::getKeyID($values[0]) || substr($values[0], 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX || substr($values[0], 0, 13) == 'contribution_' || substr($values[0], 0, 6) == 'event_' || substr($values[0], 0, 12) == 'participant_' || substr($values[0], 0, 7) == 'member_' || substr($values[0], 0, 6) == 'quest_' || substr($values[0], 0, 8) == 'kabissa_' || substr($values[0], 0, 4) == 'tmf_' || substr($values[0], 0, 6) == 'grant_' || substr($values[0], 0, 7) == 'pledge_' || substr($values[0], 0, 5) == 'case_') {
         return;
     }
     switch ($values[0]) {
         case 'deleted_contacts':
             $this->deletedContacts($values);
             return;
         case 'contact_type':
             $this->contactType($values);
             return;
         case 'contact_sub_type':
             $this->contactSubType($values);
             return;
         case 'group':
             list($name, $op, $value, $grouping, $wildcard) = $values;
             $this->group($values);
             return;
             // case tag comes from find contacts
         // case tag comes from find contacts
         case 'tag_search':
             $this->tagSearch($values);
             return;
         case 'tag':
         case 'contact_tags':
             $this->tag($values);
             return;
         case 'note':
             $this->notes($values);
             return;
         case 'uf_user':
             $this->ufUser($values);
             return;
         case 'sort_name':
         case 'display_name':
             $this->sortName($values);
             //force civicrm_activity_target, CRM-7812
             self::$_withContactActivitiesOnly = TRUE;
             return;
         case 'email':
             $this->email($values);
             return;
         case 'street_address':
             $this->street_address($values);
             return;
         case 'street_number':
             $this->street_number($values);
             return;
         case 'sortByCharacter':
             $this->sortByCharacter($values);
             return;
         case 'location_type':
             $this->locationType($values);
             return;
         case 'county':
             $this->county($values);
             return;
         case 'state_province':
             $this->stateProvince($values);
             return;
         case 'country':
             $this->country($values, FALSE);
             return;
         case 'postal_code':
         case 'postal_code_low':
         case 'postal_code_high':
             $this->postalCode($values);
             return;
         case 'activity_date':
         case 'activity_date_low':
         case 'activity_date_high':
         case 'activity_role':
         case 'activity_status':
         case 'activity_subject':
         case 'test_activities':
         case 'activity_type_id':
         case 'activity_survey_id':
         case 'activity_tags':
         case 'activity_taglist':
         case 'activity_test':
         case 'activity_contact_name':
         case 'activity_campaign_id':
         case 'activity_engagement_level':
         case 'activity_id':
             CRM_Activity_BAO_Query::whereClauseSingle($values, $this);
             return;
         case 'birth_date_low':
         case 'birth_date_high':
         case 'deceased_date_low':
         case 'deceased_date_high':
             $this->demographics($values);
             return;
         case 'log_date_low':
         case 'log_date_high':
             $this->modifiedDates($values);
             return;
         case 'changed_by':
             $this->changeLog($values);
             return;
         case 'do_not_phone':
         case 'do_not_email':
         case 'do_not_mail':
         case 'do_not_sms':
         case 'do_not_trade':
         case 'is_opt_out':
             $this->privacy($values);
             return;
         case 'privacy_options':
             $this->privacyOptions($values);
             return;
         case 'privacy_operator':
         case 'privacy_toggle':
             // these are handled by privacy options
             return;
         case 'preferred_communication_method':
             $this->preferredCommunication($values);
             return;
         case 'relation_type_id':
             $this->relationship($values);
             return;
         case 'relation_target_name':
             // since this case is handled with the above
             return;
         case 'relation_status':
             // since this case is handled with the above
             return;
         case 'task_status_id':
             $this->task($values);
             return;
         case 'task_id':
             // since this case is handled with the above
             return;
         case 'prox_distance':
             CRM_Contact_BAO_ProximityQuery::process($this, $values);
             return;
         case 'prox_street_address':
         case 'prox_city':
         case 'prox_postal_code':
         case 'prox_state_province_id':
         case 'prox_country_id':
             // handled by the proximity_distance clause
             return;
         default:
             $this->restWhere($values);
             return;
     }
 }
Exemplo n.º 3
0
 /**
  * Function which actually does all the work for the constructor.
  */
 public function initialize()
 {
     $this->_select = array();
     $this->_element = array();
     $this->_tables = array();
     $this->_whereTables = array();
     $this->_where = array();
     $this->_qill = array();
     $this->_options = array();
     $this->_cfIDs = array();
     $this->_paramLookup = array();
     $this->_having = array();
     $this->_customQuery = NULL;
     // reset cached static variables - CRM-5803
     self::$_activityRole = NULL;
     self::$_considerCompActivities = NULL;
     self::$_withContactActivitiesOnly = NULL;
     $this->_select['contact_id'] = 'contact_a.id as contact_id';
     $this->_element['contact_id'] = 1;
     $this->_tables['civicrm_contact'] = 1;
     if (!empty($this->_params)) {
         $this->buildParamsLookup();
     }
     $this->_whereTables = $this->_tables;
     $this->selectClause();
     $this->_whereClause = $this->whereClause();
     if (array_key_exists('civicrm_contribution', $this->_whereTables)) {
         $component = 'contribution';
     }
     if (array_key_exists('civicrm_membership', $this->_whereTables)) {
         $component = 'membership';
     }
     if (isset($component)) {
         CRM_Financial_BAO_FinancialType::buildPermissionedClause($this->_whereClause, $component);
     }
     $this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode);
     $this->_simpleFromClause = self::fromClause($this->_whereTables, NULL, NULL, $this->_primaryLocation, $this->_mode);
     $this->openedSearchPanes(TRUE);
 }