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

Change subject: Fix missing names
......................................................................

Fix missing names

Turns out we WERE filling in the sort name field after all.

Nice to have that nonstandard SUBSTRING_INDEX for splits in MariaDB!

Bug: T159455
Change-Id: Ief4e7fe566c8e8ebdb3652c3c43f3249c171a90a
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/91/340891/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 712a6c9..393b51e 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -2568,3 +2568,22 @@
   );
 
 }
+
+
+/**
+ * Fill in missing first and last names from the sort_name field
+ *
+ * Bug: T159455
+ */
+function wmf_civicrm_update_7480() {
+       civicrm_initialize();
+       CRM_Core_DAO::executeQuery(
+               "UPDATE civicrm_contact
+               SET last_name = SUBSTRING_INDEX(sort_name, ', ', 1),
+                       first_name = SUBSTRING_INDEX(sort_name, ', ', -1)
+               WHERE created_date BETWEEN '2017-02-28' AND '2017-03-03'
+               AND contact_type = 'Individual'
+               AND first_name IS NULL
+               AND last_name IS NULL
+    ");
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief4e7fe566c8e8ebdb3652c3c43f3249c171a90a
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

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

Reply via email to