Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7
-
Fix Version/s: None
-
Component/s: CiviCRM API
-
Labels:
-
Documentation Required?:None
-
Funding Source:Contributed Code
Description
If you use the api to search on a custom field of a non-contact, and you use a sql operator like <=, you get an exception. E.g.:
$result = civicrm_api3('Event', 'get', 'custom_2' => array('<=' => 'BBBB'));
Results in an exception, that contains a query like this:
Failure in api call for event get: DB Error: no such field
SELECT (lots of fields I left out), civicrm_value_testeventgetc_1.testeventgetcustomfieldlte_1 as custom_1
FROM civicrm_event a
LEFT OUTER JOIN civicrm_value_testeventgetc_1 ON civicrm_value_testeventgetc_1.entity_id = a.id
WHERE (a.testeventgetcustomfieldlte_1 <= "BBBB")
LIMIT 25
OFFSET 0
The error is in the where clause. testeventgetcustomfieldlte_1 is a field of custom_1, not a field of a.
Attachments
Issue Links
- links to