Ensure setting deceased date sets is_deceased in the BAO
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 20 May 2022 07:48:07 +0000 (19:48 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 20 May 2022 07:48:07 +0000 (19:48 +1200)
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Individual.php

index 0d586e08ad19fe3dd5383799663569254f5b40a8..3a2e5f7716ad8afa3e026a6759a9c245b6af4581 100644 (file)
@@ -138,6 +138,9 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact implements Civi\Co
     }
     $params = array_merge($defaults, $params);
 
+    if (!empty($params['deceased_date']) && $params['deceased_date'] !== 'null') {
+      $params['is_deceased'] = TRUE;
+    }
     $allNull = $contact->copyValues($params);
 
     $contact->id = $contactID;
index af28e7a244d5cda5570e3edc681d275be87cc79f..cf18a557b88e9aff50dd6168146e0436f73b507e 100644 (file)
@@ -67,8 +67,6 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact {
       $params['individual_suffix'] = $suffix = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'suffix_id', $suffix_id);
     }
 
-    $params['is_deceased'] = CRM_Utils_Array::value('is_deceased', $params, FALSE);
-
     $individual = NULL;
     if ($contact->id) {
       $individual = new CRM_Contact_BAO_Contact();