Commit d6d8b5e
committed
EA-6357: Get rid of two email_address [WARN] messages
Ticket: https://sugarcrm.atlassian.net/browse/EA-6357
Tidbit generates EmailAddresses module records (12,000 by default). The invalid_email and opt_out fields are of type bool, so they pick up the default bool rule: ['range' => ['min' => 0, 'max' => 1]] — randomly 0 or 1 per record.
Email addresses are not unique — with only ~100 last names from last_name_array, there are many records with the same email_address_caps (e.g. SMITH@EXAMPLE.COM) but different invalid_email values. e.g.:
seed-Emadd-001: smith@example.com, invalid_email=0
seed-Emadd-472: smith@example.com, invalid_email=1
A Contact is linked via email_addr_bean_rel to seed-Emadd-472 (invalid_email=1).
When Sugar saves the Contact (via UI, API, or post-Tidbit operations), Person::save() → SugarEmailAddress::handleLegacySave() → addAddress() → getEmailGUID() → getGuid() which queries email_addresses by email_address_caps and returns the first match: seed-Emadd-001 (invalid_email=0).
The address now has email_address_id=seed-Emadd-001 (not in email_addr_bean_rel for this Contact) → $emailId=null → AddUpdateEmailAddress looks up by caps, gets seed-Emadd-001 with invalid_email=0 as $existingBean, but the boolean value passed is true (from seed-Emadd-472).
didEmailAddressChange sees "0" != true → TRUE → logUpdateEmailProperties fires:
[WARN] Invalid email status was updated during creating a new record. From 0 to 1
[WARN] Opt Out status was updated during creating a new record. From 0 to 0 ← strict !== type mismatch ("0" vs false)1 parent 2231400 commit d6d8b5e
2 files changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
541 | 548 | | |
542 | 549 | | |
543 | 550 | | |
| |||
0 commit comments