Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382109 )

Change subject: Resolve conflicts on asymetrical whitespace when merging
......................................................................

Resolve conflicts on asymetrical whitespace when merging

Bug: T175748
Change-Id: I73f6daf4649595f51a7c856356fdba7a788f7de6
---
M sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
2 files changed, 21 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/09/382109/1

diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
index 053beed..b751200 100644
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
+++ b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
@@ -512,6 +512,20 @@
   }
 
   /**
+   * Test that punctuation conflicts are ignored.
+   *
+   * Bug T175748
+   */
+  public function testBatchMergeResolvableConflictPunctuation() {
+    $this->breedDuck(array('id' => $this->contactID, 'first_name' => 'alter. 
ego'));
+    $this->breedDuck(array('id' => $this->contactID2, 'first_name' => 
'alterego'));
+    $result = $this->callAPISuccess('Job', 'process_batch_merge', array('mode' 
=> 'safe'));
+    $this->assertEquals(1, count($result['values']['merged']));
+    $contact = $this->callAPISuccessGetSingle('Contact', array('email' => 
'the_...@duckland.com'));
+    $this->assertEquals('alter. ego', $contact['first_name']);
+  }
+
+  /**
    * Test that a conflict on casing in first names is handled.
    *
    * We do a best effort on this to get the more correct on assuming that 1 
capital letter in a
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 303dc78..4d2c72a 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -2632,9 +2632,14 @@
     "\xE3\x80\x80",
     // Hex nbsp
     '/\xC2\xA0/',
-
   );
-  if (strtoupper(str_replace($whitespaceChars, '', $valueToKeep)) != 
strtoupper(str_replace($whitespaceChars, '', ($valueToOverwrite)))) {
+
+  // 
http://grammar.yourdictionary.com/punctuation/what/Fourteen-Punctuation-Marks.html
+  // but elipsis? really?
+  $punctuationChars = array('.', ':', ',', '&', ';', "'", '-', '_', '?', '(', 
')', '!', '"');
+
+  $ignoreChars = array_merge($whitespaceChars, $punctuationChars);
+  if (strtoupper(str_replace($ignoreChars, '', $valueToKeep)) != 
strtoupper(str_replace($ignoreChars, '', ($valueToOverwrite)))) {
     return FALSE;
   }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/382109
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73f6daf4649595f51a7c856356fdba7a788f7de6
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to