Skip to content
Snippets Groups Projects
Unverified Commit 0ab8d2c2 authored by Eileen McNaughton's avatar Eileen McNaughton Committed by GitHub
Browse files

Merge pull request #25822 from colemanw/afformValidateSavedSearch

Afform - Fix validateBySavedSearch
parents 6526f075 053ceab2
No related branches found
No related tags found
No related merge requests found
......@@ -112,7 +112,7 @@ abstract class AbstractProcessor extends \Civi\Api4\Generic\AbstractAction {
$api4 = $this->_formDataModel->getSecureApi4($entity['name']);
$idField = CoreUtil::getIdFieldName($entity['type']);
if ($ids && !empty($entity['fields'][$idField]['saved_search'])) {
if ($ids && !empty($entity['fields'][$idField]['defn']['saved_search'])) {
$ids = $this->validateBySavedSearch($entity, $ids);
}
if (!$ids) {
......@@ -144,6 +144,14 @@ abstract class AbstractProcessor extends \Civi\Api4\Generic\AbstractAction {
}
}
/**
* Validate that given id(s) are actually returned by the Autocomplete API
*
* @param $entity
* @param array $ids
* @return array
* @throws \CRM_Core_Exception
*/
private function validateBySavedSearch($entity, array $ids) {
$idField = CoreUtil::getIdFieldName($entity['type']);
$fetched = civicrm_api4($entity['type'], 'autocomplete', [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment