avoid invalid secondary emails
authordemeritcowboy <demeritcowboy@hotmail.com>
Thu, 29 Jun 2023 13:57:17 +0000 (09:57 -0400)
committerdemeritcowboy <demeritcowboy@hotmail.com>
Thu, 29 Jun 2023 13:57:17 +0000 (09:57 -0400)
CRM/Core/CodeGen/GenerateData.php

index 94eb6aa0084030bbf124917716ddb1bab70a0ee0..b0b6b9e82116108fa9272b726d86711c30aee01d 100644 (file)
@@ -1051,8 +1051,8 @@ class CRM_Core_CodeGen_GenerateData {
    * @return string
    */
   private function _individualEmail($contact, $domain = NULL) {
-    $first = $contact->first_name;
-    $last = $contact->last_name;
+    $first = $contact->first_name ?? ($this->probability(.5) ? $this->randomItem('male_name') : $this->randomItem('female_name'));
+    $last = $contact->last_name ?? $this->randomItem('last_name');
     $f = $first[0];
     $l = $last[0];
     $m = $contact->middle_name ? $contact->middle_name[0] . '.' : '';