jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403080 )

Change subject: Re-save any contacts without a display name.
......................................................................


Re-save any contacts without a display name.

Doing a blank re-save will cause the display name to be recalculated by Civi
 * rules.
 *
 * Not useful here but possibly for Major Gifts letter addressing it also
 * will allow us to update addressing fields (e.g Dear Fred) for sending 
letters.
 * We don't do that for all contacts but could for MG.
 *
 * Bug: T179118

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

Approvals:
  jenkins-bot: Verified
  Ejegg: Looks good to me, approved



diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 4340077..3b30ed8 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -3289,3 +3289,25 @@
   require_once 'update_payment_instruments.php';
   wmf_install_add_missing_payment_instruments();
 }
+
+/**
+ * Re-save any contacts without a display name.
+ *
+ * Doing a blank re-save will cause the display name to be recalculated by Civi
+ * rules.
+ *
+ * Not useful here but possibly for Major Gifts letter addressing it also
+ * will allow us to update addressing fields (e.g Dear Fred) for sending 
letters.
+ * We don't do that for all contacts but could for MG.
+ *
+ * Bug: T179118
+ */
+function wmf_civicrm_update_7600() {
+  civicrm_initialize();
+  $result = CRM_Core_DAO::executeQuery(
+    "SELECT id FROM civicrm_contact WHERE (display_name is null  OR 
display_name = '') AND is_deleted= 0"
+  );
+  while ($result->fetch()) {
+    civicrm_api3('Contact', 'create', array('id' => $result->id));
+  }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib74916c507217524d57afb277e97ad8ac297adbe
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org>
Gerrit-Reviewer: Ejegg <ej...@ejegg.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to