Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.1.4
-
Fix Version/s: 3.2
-
Component/s: Core CiviCRM
-
Labels:None
Description
CiviCRM does not validate the contact subtype when creating a new contact.
If civicrm/contact/add is called with a non-existent contact subtype, for example civicrm/contact/add?ct=Individual&cst=MythicalBeast, the contact add form is presented and when it is submitted its processing fails with a message "One of the parameters (value: ) is not of the type Integer".
The reason for this is that the contact data structure is not populated in CRM/Contact/BAO/Contact.php because the following snippet of code bails out instead of kicking off an error-handling process
//fix for validate contact sub type CRM-5143
$subType = CRM_Utils_Array::value('contact_sub_type', $params );
if ( $subType && !(CRM_Contact_BAO_ContactType::isExtendsContactType($subType, $params['contact_type'], true)) )
It would probably be wise to both fix this routine (or its caller) to present a meaningful error message when the contact subtype is non-existing, even better would be to also validate the contact subtype while handling the contact/add request.
I'd be willing to help with this, but it would have to be at a low priority (and there is the question of what knock-on effect there would be in modifying the above code snippet).