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

Change subject: Add update_7522 to allow for search by phone number Bug: T97372
......................................................................

Add update_7522 to allow for search by phone number Bug: T97372

Change-Id: I9ffe534f03b937e5ea6cd5f3d60c28c409d0240e
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/93/352893/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 8b4cb25..806bc25 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -2979,3 +2979,20 @@
   wmf_civicrm_bootstrap_civi();
   wmf_civicrm_create_option_values( 'payment_instrument', $payment_instruments 
);
 }
+
+/**
+ * Normalize old phone numbers
+ **/
+function wmf_civicrm_update_7522() {
+  civicrm_initialize();
+  $maxId = SELECT id FROM civicrm_phone WHERE max(id);
+  $batch = 100000;
+  for($startId = 0; $startId < $maxId; $startId += $batch) {
+    $endId = $startId + $batch;
+    CRM_Core_DAO::executeQuery("
+      UPDATE civicrm_phone
+      SET phone_numeric = civicrm_strip_non_numeric(phone)
+      WHERE id BETWEEN $startId AND $endId AND phone_numeric=NULL
+    ");
+}
+

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ffe534f03b937e5ea6cd5f3d60c28c409d0240e
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Mepps <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to