Unverified Commit 7b722788 authored by Seamus Lee's avatar Seamus Lee Committed by GitHub

Merge pull request #16002 from seamuslee001/handle_custom_field_deleted

Fix regression from fixing relative key handling where custom field no longer exists in the database
parents 616def14 6d8d4c91
......@@ -4786,8 +4786,13 @@ civicrm_relationship.start_date > {$today}
if (($customFieldID = CRM_Core_BAO_CustomField::getKeyID($fieldName)) == FALSE) {
return FALSE;
}
if ('Date' == civicrm_api3('CustomField', 'getvalue', ['id' => $customFieldID, 'return' => 'data_type'])) {
return TRUE;
try {
$customFieldDataType = civicrm_api3('CustomField', 'getvalue', ['id' => $customFieldID, 'return' => 'data_type']);
if ('Date' == $customFieldDataType) {
return TRUE;
}
}
catch (CiviCRM_API3_Exception $e) {
}
return FALSE;
}
......
......@@ -96,6 +96,10 @@ class CRM_Contact_BAO_SavedSearchTest extends CiviUnitTestCase {
$defaults = $sg->setDefaultValues();
$this->checkArrayEquals($defaults, $formValues);
$this->callAPISuccess('CustomField', 'delete', ['id' => $this->ids['CustomField']['int']]);
unset($this->ids['CustomField']['int']);
$defaults = $sg->setDefaultValues();
$this->checkArrayEquals($defaults, $formValues);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment