Don't make up test values for greeting ids as they are type specific
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 27 Oct 2021 23:21:20 +0000 (12:21 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 31 Oct 2021 20:00:38 +0000 (09:00 +1300)
CRM/Contact/BAO/Contact.php
CRM/Core/DAO.php

index 5114fe563af6c12806cfc82bd429e8a65a68e364..6ca6fe6607bc08603a625136bedc6950c681b2d1 100644 (file)
@@ -541,7 +541,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact implements Civi\Te
         //  If we are setting it to null then null out the display field.
         $params[$greetingIndex . '_display'] = 'null';
       }
-      if ((int) $params[$greetingParam] !== CRM_Core_PseudoConstant::getKey('CRM_Contact_BAO_Contact', $greetingParam, 'Customized')) {
+      if ((int) $params[$greetingParam] != CRM_Core_PseudoConstant::getKey('CRM_Contact_BAO_Contact', $greetingParam, 'Customized')) {
         $params[$greetingIndex . '_custom'] = 'null';
       }
 
index 2a375fbca14d621081e35ac2f5f895258d39d1c7..9f6470a8d7f774a541c1d5be0fdc9cf1bbb058fc 100644 (file)
@@ -300,9 +300,9 @@ class CRM_Core_DAO extends DB_DataObject {
     $daoName = get_class($this);
     $handled = FALSE;
 
-    if (!$handled && $dbName == 'contact_sub_type') {
-      //coming up with a rule to set this is too complex let's not set it
-      $handled = TRUE;
+    if (in_array($dbName, ['contact_sub_type', 'email_greeting_id', 'postal_greeting_id', 'addressee_id'], TRUE)) {
+      //coming up with a rule to set these is too complex - skip
+      return;
     }
 
     // Pick an option value if needed