Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20154 dedupe code improvement, remove unused autoflip parameter #9873

Merged
merged 2 commits into from
Feb 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Core/OptionGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public static function &valuesByID($id, $flip = FALSE, $grouping = FALSE, $local
*
* @param bool $flip
*/
public static function lookupValues(&$params, &$names, $flip = FALSE) {
public static function lookupValues(&$params, $names, $flip = FALSE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In comments just above it still refers to this as a 'reference array' of names. But looks like a good improvement since the names never get modified.

foreach ($names as $postName => $value) {
// See if $params field is in $names array (i.e. is a value that we need to lookup)
if ($postalName = CRM_Utils_Array::value($postName, $params)) {
Expand Down
6 changes: 2 additions & 4 deletions CRM/Dedupe/Merger.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $autoFlip
'join' => self::getJoinOnDedupeTable(),
'where' => self::getWhereString($batchLimit, $isSelected),
);
return CRM_Dedupe_Merger::merge($dupePairs, $cacheParams, $mode, $autoFlip, $redirectForPerformance, $checkPermissions);
return CRM_Dedupe_Merger::merge($dupePairs, $cacheParams, $mode, $redirectForPerformance, $checkPermissions);
}

/**
Expand Down Expand Up @@ -748,8 +748,6 @@ public static function getMergeStatsMsg($cacheKeyString) {
* 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 bool $autoFlip to let api decide which contact to retain and which to delete.
* Whether to let api decide which contact to retain and which to delete.
*
* @param bool $redirectForPerformance
* Redirect to a url for batch processing.
Expand All @@ -760,7 +758,7 @@ public static function getMergeStatsMsg($cacheKeyString) {
* @return array|bool
*/
public static function merge($dupePairs = array(), $cacheParams = array(), $mode = 'safe',
$autoFlip = TRUE, $redirectForPerformance = FALSE, $checkPermissions = TRUE
$redirectForPerformance = FALSE, $checkPermissions = TRUE
) {
$cacheKeyString = CRM_Utils_Array::value('cache_key_string', $cacheParams);
$resultStats = array('merged' => array(), 'skipped' => array());
Expand Down
6 changes: 1 addition & 5 deletions api/v3/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ function civicrm_api3_contact_merge($params) {
'srcID' => $params['to_remove_id'],
'dstID' => $params['to_keep_id'],
),
), array(), $params['mode'], $params['auto_flip'])) != FALSE) {
), array(), $params['mode'])) != FALSE) {
return civicrm_api3_create_success($result, $params);
}
throw new CiviCRM_API3_Exception('Merge failed');
Expand All @@ -1111,10 +1111,6 @@ function _civicrm_api3_contact_merge_spec(&$params) {
'type' => CRM_Utils_Type::T_INT,
'api.aliases' => array('other_id'),
);
$params['auto_flip'] = array(
'title' => 'Swap destination and source to retain lowest id?',
'api.default' => TRUE,
);
$params['mode'] = array(
// @todo need more detail on what this means.
'title' => 'Dedupe mode',
Expand Down