$logDAO->entity_table = 'civicrm_contact';
$logDAO->entity_id = $id;
$logDAO->delete();
-
+
// delete contact participants CRM-12155
CRM_Event_BAO_Participant::deleteContactParticipant($id);
// delete contact contributions CRM-12155
CRM_Contribute_BAO_Contribution::deleteContactContribution($id);
-
+
// do activity cleanup, CRM-5604
CRM_Activity_BAO_Activity::cleanupActivity($id);
* combine all the importable fields from the lower levels object
*
* The ordering is important, since currently we do not have a weight
- * scheme. Adding weight is super important and should be done in the
- * next week or so, before this can be called complete.
+ * scheme. Adding weight is super important
*
* @param int $contactType contact Type
* @param boolean $status status is used to manipulate first title
$fields = array_merge($fields, $locationFields);
- $fields = array_merge($fields,
- CRM_Contact_DAO_Contact::import()
- );
- $fields = array_merge($fields,
- CRM_Core_DAO_Note::import()
- );
+ $fields = array_merge($fields, CRM_Contact_DAO_Contact::import());
+ $fields = array_merge($fields, CRM_Core_DAO_Note::import());
//website fields
$fields = array_merge($fields, CRM_Core_DAO_Website::import());
$fields = CRM_Contact_DAO_Contact::export();
// the fields are meant for contact types
- if (in_array($contactType, array(
- 'Individual', 'Household', 'Organization', 'All'))) {
+ if (
+ in_array(
+ $contactType,
+ array('Individual', 'Household', 'Organization', 'All')
+ )
+ ) {
$fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
}
// add current employer for individuals
}
}
-
+
/**
* Delete a contact-related object that has an 'is_primary' field
* Ensures that is_primary gets assigned to another object if available
// skip component fields
// there are done by the alter query below
// and need not be done on every field
- if ((substr($name, 0, 12) == 'participant_') ||
+ if (
+ (substr($name, 0, 12) == 'participant_') ||
(substr($name, 0, 7) == 'pledge_') ||
(substr($name, 0, 5) == 'case_')
) {
}
$cfID = CRM_Core_BAO_CustomField::getKeyID($name);
-
- if (CRM_Utils_Array::value($name, $this->_paramLookup) ||
+ if (
+ CRM_Utils_Array::value($name, $this->_paramLookup) ||
CRM_Utils_Array::value($name, $this->_returnProperties)
) {
-
if ($cfID) {
// add to cfIDs array if not present
if (!array_key_exists($cfID, $this->_cfIDs)) {
elseif (isset($field['where'])) {
list($tableName, $fieldName) = explode('.', $field['where'], 2);
if (isset($tableName)) {
-
if (CRM_Utils_Array::value($tableName, self::$_dependencies)) {
$this->_tables['civicrm_address'] = 1;
$this->_select['address_id'] = 'civicrm_address.id as address_id';
$this->_element['address_id'] = 1;
}
- if ($tableName == 'gender' || $tableName == 'individual_prefix'
- || $tableName == 'individual_suffix' || $tableName == 'im_provider'
- || $tableName == 'email_greeting' || $tableName == 'postal_greeting'
- || $tableName == 'addressee'
+ if (
+ $tableName == 'gender' || $tableName == 'individual_prefix' ||
+ $tableName == 'individual_suffix' || $tableName == 'im_provider' ||
+ $tableName == 'email_greeting' || $tableName == 'postal_greeting' ||
+ $tableName == 'addressee'
) {
CRM_Core_OptionValue::select($this);
- if (in_array($tableName, array(
- 'email_greeting', 'postal_greeting', 'addressee'))) {
+ if (
+ in_array(
+ $tableName,
+ array('email_greeting', 'postal_greeting', 'addressee')
+ )
+ ) {
//get display
$greetField = "{$name}_display";
$this->_select[$greetField] = "contact_a.{$greetField} as {$greetField}";
$this->_qill[$grouping][] = ts('State') . " ($lType) $op '$value'";
}
}
+ elseif ($field['pseudoconstant']) {
+ $this->optionValueQuery(
+ $name, $op, $value, $grouping,
+ CRM_Core_PseudoConstant::{$field['pseudoconstant']['name']}(),
+ $field,
+ $field['title']
+ );
+ if ($name == 'gender') {
+ self::$_openedPanes[ts('Demographics')] = TRUE;
+ }
+ }
elseif (substr($name, 0, 7) === 'country') {
if (isset($locType[1]) && is_numeric($locType[1])) {
$setTables = FALSE;
ts('World Region')
);
}
- elseif ($name === 'individual_prefix') {
- $this->optionValueQuery(
- $name, $op, $value, $grouping,
- CRM_Core_PseudoConstant::individualPrefix(),
- $field,
- ts('Individual Prefix')
- );
- }
- elseif ($name === 'individual_suffix') {
- $this->optionValueQuery(
- $name, $op, $value, $grouping,
- CRM_Core_PseudoConstant::individualSuffix(),
- $field,
- ts('Individual Suffix')
- );
- }
- elseif ($name === 'gender') {
- $this->optionValueQuery(
- $name, $op, $value, $grouping,
- CRM_Core_PseudoConstant::gender(),
- $field,
- ts('Gender')
- );
- self::$_openedPanes[ts('Demographics')] = TRUE;
- }
elseif ($name === 'birth_date') {
$date = CRM_Utils_Date::processDate($value);
$this->_where[$grouping][] = self::buildClause("contact_a.{$name}", $op, $date);
$tActTable = "`civicrm_act_tag-" . $value . "`";
$activityContacts = CRM_Core_PseudoConstant::activityContacts('name');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
-
+
$this->_tables[$etActTable] =
$this->_whereTables[$etActTable] =
" LEFT JOIN civicrm_activity_contact
return CRM_Core_DAO::singleValueQuery($query);
}
- //crm_core_error::debug('$query', $query); //exit;
+ // crm_core_error::debug('$query', $query); exit;
$dao = CRM_Core_DAO::executeQuery($query);
if ($groupContacts) {
if (in_array($contactType, array(
'Individual', 'Household', 'Organization', 'All'))) {
$nameTitle = array(
- 'addressee' => array('name' => 'addressee',
+ 'addressee' => array(
+ 'name' => 'addressee',
'title' => ts('Addressee'),
'headerPattern' => '/^addressee$/i',
),
);
$title = array(
- 'email_greeting' => array('name' => 'email_greeting',
+ 'email_greeting' => array(
+ 'name' => 'email_greeting',
'title' => ts('Email Greeting'),
'headerPattern' => '/^email_greeting$/i',
),
}
if ($contactType == 'Individual' || $contactType == 'All') {
+ $contactFields = CRM_Contact_DAO_Contact::fields();
$title = array(
- 'gender' => array('name' => 'gender',
+ 'gender' => array(
+ 'name' => 'gender',
'title' => ts('Gender'),
'headerPattern' => '/^gender$/i',
+ 'pseudoconstant' => $contactFields['gender_id']['pseudoconstant'],
),
'individual_prefix' => array(
'name' => 'individual_prefix',
'title' => ts('Individual Prefix'),
'headerPattern' => '/^(prefix|title)/i',
+ 'pseudoconstant' => $contactFields['prefix_id']['pseudoconstant'],
),
'individual_suffix' => array(
'name' => 'individual_suffix',
'title' => ts('Individual Suffix'),
'headerPattern' => '/^suffix$/i',
+ 'pseudoconstant' => $contactFields['suffix_id']['pseudoconstant'],
),
);
$nameTitle = array_merge($nameTitle, $title);
foreach ($nameTitle as $name => $attribs) {
self::$_fields[$key][$name] = $optionName;
list($tableName, $fieldName) = explode('.', $optionName['where']);
- // not sure of this fix, so keeping it commented for now
- // this is from CRM-1541
- // self::$_fields[$mode][$name]['where'] = $name . '.' . $fieldName;
self::$_fields[$key][$name]['where'] = "{$name}.label";
foreach ($attribs as $k => $val) {
self::$_fields[$key][$name][$k] = $val;
* database in dataset.xml
*/
private $dataset = array(
- // Include static group 3
- array('fv' => array('group' => array('3' => 1)),
- 'id' => array(
- '17', '18', '19', '20', '21',
- '22', '23', '24',
- ),
- ),
- // Include static group 5
- array('fv' => array('group' => array('5' => 1)),
- 'id' => array(
- '13', '14', '15', '16', '21',
- '22', '23', '24',
- ),
- ),
- // Include static groups 3 and 5
- array(
- 'fv' => array('group' => array('3' => 1,
- '5' => 1,
- )),
- 'id' => array(
- '13', '14', '15', '16', '17', '18',
- '19', '20', '21', '22', '23', '24',
- ),
- ),
- // Include tag 7
- array('fv' => array('tag' => array('7' => 1)),
- 'id' => array(
- '11', '12', '15', '16',
- '19', '20', '23', '24',
- ),
- ),
- // Include tag 9
- array('fv' => array('tag' => array('9' => 1)),
- 'id' => array(
- '10', '12', '14', '16',
- '18', '20', '22', '24',
- ),
- ),
- // Include tags 7 and 9
- array(
- 'fv' => array('tag' => array('7' => 1,
- '9' => 1,
- )),
- 'id' => array(
- '10', '11', '12', '14', '15', '16',
- '18', '19', '20', '22', '23', '24',
- ),
- ),
- );
+ // Include static group 3
+ array('fv' => array('group' => array('3' => 1)),
+ 'id' => array(
+ '17', '18', '19', '20', '21',
+ '22', '23', '24',
+ ),
+ ),
+ // Include static group 5
+ array('fv' => array('group' => array('5' => 1)),
+ 'id' => array(
+ '13', '14', '15', '16', '21',
+ '22', '23', '24',
+ ),
+ ),
+ // Include static groups 3 and 5
+ array(
+ 'fv' => array('group' => array('3' => 1,
+ '5' => 1,
+ )),
+ 'id' => array(
+ '13', '14', '15', '16', '17', '18',
+ '19', '20', '21', '22', '23', '24',
+ ),
+ ),
+ // Include tag 7
+ array('fv' => array('tag' => array('7' => 1)),
+ 'id' => array(
+ '11', '12', '15', '16',
+ '19', '20', '23', '24',
+ ),
+ ),
+ // Include tag 9
+ array('fv' => array('tag' => array('9' => 1)),
+ 'id' => array(
+ '10', '12', '14', '16',
+ '18', '20', '22', '24',
+ ),
+ ),
+ // Include tags 7 and 9
+ array(
+ 'fv' => array('tag' => array('7' => 1,
+ '9' => 1,
+ )),
+ 'id' => array(
+ '10', '11', '12', '14', '15', '16',
+ '18', '19', '20', '22', '23', '24',
+ ),
+ ),
+
+ // gender_id 1 (male)
+ array( 'fv' => array( 'gender' => 'Female' ),
+ 'id' => array( '9', '20', '22' )
+ ),
+ // prefix_id 2 (Ms.)
+ array( 'fv' => array( 'individual_prefix' => 'Ms.' ),
+ 'id' => array( '10', '13' )
+ ),
+ // suffix_id 2 (Sr.)
+ array( 'fv' => array( 'individual_suffix' => 'V' ),
+ 'id' => array( '16', '19', '20', '21')
+ ),
+ );
public function _construct() {
$this->i = 0;
}
}
// class CRM_Contact_BAO_QueryTestDataProvider
-
-// -- set Emacs parameters --
-// Local variables:
-// mode: php;
-// tab-width: 4
-// c-basic-offset: 4
-// c-hanging-comment-ender-p: nil
-// indent-tabs-mode: nil
-// End:
-
sort_name="Test Contact 9"
first_name="Test"
last_name="Contact 9"
+ gender_id="1"
+ prefix_id="1"
+ suffix_id="1"
/>
<!-- Groups: none Tags: 9 -->
<civicrm_contact
sort_name="Test Contact 10"
first_name="Test"
last_name="Contact 10"
+ gender_id="2"
+ prefix_id="2"
+ suffix_id="2"
/>
<!-- Groups: none Tags: 7 -->
<civicrm_contact
sort_name="Test Contact 11"
first_name="Test"
last_name="Contact 11"
+ gender_id="3"
+ prefix_id="3"
+ suffix_id="3"
/>
<!-- Groups: none Tags: 7, 9 -->
<civicrm_contact
sort_name="Test Contact 12"
first_name="Test"
last_name="Contact 12"
+ gender_id="3"
+ prefix_id="4"
+ suffix_id="4"
/>
<!-- Groups: 5 Tags: none -->
<civicrm_contact
sort_name="Test Contact 13"
first_name="Test"
last_name="Contact 13"
+ gender_id="2"
+ prefix_id="2"
+ suffix_id="2"
/>
<!-- Groups: 5 Tags: 9 -->
<civicrm_contact
sort_name="Test Contact 14"
first_name="Test"
last_name="Contact 14"
+ gender_id="3"
+ prefix_id="4"
+ suffix_id="4"
/>
<!-- Groups: 5 Tags: 7 -->
<civicrm_contact
sort_name="Test Contact 15"
first_name="Test"
last_name="Contact 15"
+ gender_id="3"
+ prefix_id="4"
+ suffix_id="5"
/>
<!-- Groups: 5 Tags: 7, 9 -->
<civicrm_contact
sort_name="Test Contact 16"
first_name="Test"
last_name="Contact 16"
+ gender_id="3"
+ prefix_id="4"
+ suffix_id="6"
/>
<!-- Groups: 3 Tags: none -->
<civicrm_contact
sort_name="Test Contact 17"
first_name="Test"
last_name="Contact 17"
+ gender_id="2"
+ prefix_id="4"
+ suffix_id="7"
/>
<!-- Groups: 3 Tags: 9 -->
<civicrm_contact
sort_name="Test Contact 18"
first_name="Test"
last_name="Contact 18"
+ gender_id="2"
+ prefix_id="4"
+ suffix_id="4"
/>
<!-- Groups: 3 Tags: 7 -->
<civicrm_contact
sort_name="Test Contact 19"
first_name="Test"
last_name="Contact 19"
+ gender_id="2"
+ prefix_id="4"
+ suffix_id="6"
/>
<!-- Groups: 3 Tags: 7, 9 -->
<civicrm_contact
sort_name="Test Contact 20"
first_name="Test"
last_name="Contact 20"
+ gender_id="1"
+ prefix_id="4"
+ suffix_id="6"
/>
<!-- Groups: 3, 5 Tags: none -->
<civicrm_contact
sort_name="Test Contact 21"
first_name="Test"
last_name="Contact 21"
+ gender_id="3"
+ prefix_id="1"
+ suffix_id="6"
/>
<!-- Groups: 3, 5 Tags: 9 -->
<civicrm_contact
sort_name="Test Contact 22"
first_name="Test"
last_name="Contact 22"
+ gender_id="1"
+ prefix_id="1"
+ suffix_id="1"
/>
<!-- Groups: 3, 5 Tags: 7 -->
<civicrm_contact
sort_name="Test Contact 23"
first_name="Test"
last_name="Contact 23"
+ gender_id="3"
+ prefix_id="1"
+ suffix_id="1"
/>
<!-- Groups: 3, 5 Tags: 7, 9 -->
<civicrm_contact
sort_name="Test Contact 24"
first_name="Test"
last_name="Contact 24"
+ gender_id="3"
+ prefix_id="3"
+ suffix_id="2"
/>
<civicrm_tag
id="7"
/>
<civicrm_entity_tag
entity_id="14"
- entity_table="civicrm_contact"
+ entity_table="civicrm_contact"
tag_id="9"
/>
<civicrm_entity_tag
entity_id="16"
- entity_table="civicrm_contact"
+ entity_table="civicrm_contact"
tag_id="9"
/>
<civicrm_entity_tag