*
* @return string
*/
- public static function internalFilters( $rg, $strID1 = 'contact1.id', $strID2 = 'contact2.id' ) {
+ public static function internalFilters($rg, $strID1 = 'contact1.id', $strID2 = 'contact2.id') {
// Add a contact id filter for dedupe by group requests and add logic
// to remove duplicate results with opposing orders, i.e. 1,2 and 2,1
if( !empty($rg->contactIds) ) {
- $cids = implode(',',$rg->contactIds);
+ $cids = implode(',', $rg->contactIds);
return "($strID1 IN ($cids) AND ( $strID2 NOT IN ($cids) OR ($strID2 IN ($cids) AND $strID1 < $strID2) ))";
}
else {
*/
static function dupesByParams($params,
$ctype,
- $used = 'Unsupervised',
- $except = array(),
+ $used = 'Unsupervised',
+ $except = array(),
$ruleGroupID = NULL
) {
// If $params is empty there is zero reason to proceed.
public static function dupesInGroup($rgid, $gid) {
$cids = array_keys(CRM_Contact_BAO_Group::getMember($gid));
if ( !empty($cids) ) {
- return self::dupes($rgid, $cids);
- }
+ return self::dupes($rgid, $cids);
+ }
return array();
}
$fields['location_type_id'] = '';
// FIXME: we also need to do some hacking for id and name fields, see CRM-3902’s comments
$fixes = array(
- 'address_name' => 'name', 'country' => 'country_id',
- 'state_province' => 'state_province_id', 'county' => 'county_id',
+ 'address_name' => 'name',
+ 'country' => 'country_id',
+ 'state_province' => 'state_province_id',
+ 'county' => 'county_id',
);
foreach ($fixes as $orig => $target) {
if (!empty($flat[$orig])) {
return $sqls;
}
-
switch ($tableName) {
case 'civicrm_membership':
- if (array_key_exists($tableName, $tableOperations) && $tableOperations[$tableName]['add'])
- break;
- if ($mode == 'add') {
- $sqls[] = "
+ if (array_key_exists($tableName, $tableOperations) && $tableOperations[$tableName]['add']) {
+ break;
+ }
+ if ($mode == 'add') {
+ $sqls[] = "
DELETE membership1.* FROM civicrm_membership membership1
INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = membership2.membership_type_id
AND membership1.contact_id = {$mainId}
AND membership2.contact_id = {$otherId} ";
- }
- if ($mode == 'payment') {
- $sqls[] = "
+ }
+ if ($mode == 'payment') {
+ $sqls[] = "
DELETE contribution.* FROM civicrm_contribution contribution
INNER JOIN civicrm_membership_payment payment ON payment.contribution_id = contribution.id
INNER JOIN civicrm_membership membership1 ON membership1.id = payment.membership_id
AND membership1.contact_id = {$mainId}
INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = membership2.membership_type_id
AND membership2.contact_id = {$otherId}";
- }
- break;
+ }
+ break;
case 'civicrm_uf_match':
// normal queries won't work for uf_match since that will lead to violation of unique constraint,
* Helps decide how to behave when there are conflicts.
* A 'safe' value skips the merge if there are any un-resolved conflicts.
* Does a force merge otherwise.
- * @param boolean $autoFlip
+ * @param bool $autoFlipWether to let api decide which contact to retain and which to delete.
* Wether to let api decide which contact to retain and which to delete.
* @param bool $redirectForPerformance
*
* Helps decide how to behave when there are conflicts.
* A 'safe' value skips the merge if there are any un-resolved conflicts.
* Does a force merge otherwise (aggressive mode).
- * @param boolean $autoFlip
+ * @param bool $autoFlipWether to let api decide which contact to retain and which to delete.
* Wether to let api decide which contact to retain and which to delete.
*
*
);
if (!empty($contact['preferred_communication_method'])){
- // api 3 returns pref_comm_method as an array, which breaks the lookup; so we reconstruct
- $prefCommList = is_array($specialValues[$moniker]['preferred_communication_method']) ?
- implode(CRM_Core_DAO::VALUE_SEPARATOR, $specialValues[$moniker]['preferred_communication_method']) :
- $specialValues[$moniker]['preferred_communication_method'];
+ // api 3 returns pref_comm_method as an array, which breaks the lookup; so we reconstruct
+ $prefCommList = is_array($specialValues[$moniker]['preferred_communication_method']) ? implode(CRM_Core_DAO::VALUE_SEPARATOR, $specialValues[$moniker]['preferred_communication_method']) : $specialValues[$moniker]['preferred_communication_method'];
$specialValues[$moniker]['preferred_communication_method'] = CRM_Core_DAO::VALUE_SEPARATOR . $prefCommList . CRM_Core_DAO::VALUE_SEPARATOR;
}
$names = array(
);
if ($values['data'] === 0 || $values['data'] === '0') {
$values['data'] = $qfZeroBug;
- }
+ }
$value = ($values['data']) ? $values['data'] : $value;
- }
+ }
}
$rows["move_custom_$fid"]['title'] = $field['label'];
}
}
-
// **** Do location related migration:
if (!empty($locBlocks)) {
$locComponent = array(
}
if (isset($migrationInfo['main_details']['loc_block_ids'][$name])) {
- $mainBlockId = CRM_Utils_Array::value($idKey, $migrationInfo['main_details']['loc_block_ids'][$name]);
+ $mainBlockId = CRM_Utils_Array::value($idKey, $migrationInfo['main_details']['loc_block_ids'][$name]);
}
if (!$otherBlockId) {
// move the other contact's file to main contact
//NYSS need to INSERT or UPDATE depending on whether main contact has an existing record
if ( CRM_Core_DAO::singleValueQuery("SELECT id FROM {$tableName} WHERE entity_id = {$mainId}") ) {
- $sql = "UPDATE {$tableName} SET {$columnName} = {$fileIds[$otherId]} WHERE entity_id = {$mainId}";
+ $sql = "UPDATE {$tableName} SET {$columnName} = {$fileIds[$otherId]} WHERE entity_id = {$mainId}";
}
else {
$sql = "INSERT INTO {$tableName} ( entity_id, {$columnName} ) VALUES ( {$mainId}, {$fileIds[$otherId]} )";
/* } */
-
// CRM-15681 merge sub_types
if ($other_sub_types = CRM_Utils_array::value('contact_sub_type', $migrationInfo['other_details'])) {
if ($main_sub_types = CRM_Utils_array::value('contact_sub_type', $migrationInfo['main_details'])) {