Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.13, 4.7.14
-
Fix Version/s: 4.7.18
-
Component/s: None
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Contributed Code
-
Verified?:No
Description
Scenario:
- create new contact type which beginning with number, etc. "1SUBTYPE"
- set this new type for a contact
- try to set additional type for the same contact
Method CRM_Contact_BAO_ContactType::getSubtypeCustomPair() contains two different variables: $subtype and $subType.
$subtype = CRM_Utils_Type::escape($subtype, 'String');
$subType = CRM_Core_DAO::VALUE_SEPARATOR . $subtype . CRM_Core_DAO::VALUE_SEPARATOR;
$subTypeClause[] = "extends_entity_column_value LIKE '%{$subtype}%' ";
```
Such code produces invalid query:
SELECT table_name
FROM civicrm_custom_group
WHERE extends = 'Individual' AND extends_entity_column_value LIKE ''Individual'SUBTYPE%'