3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
21 * This class contains all the function that are called using AJAX
23 class CRM_Event_Page_AJAX
{
26 * Building EventFee combo box.
27 * FIXME: This ajax callback could be eliminated in favor of an entityRef field but the priceFieldValue api doesn't currently support filtering on entity_table
29 public function eventFee() {
30 $name = trim(CRM_Utils_Type
::escape($_GET['term'], 'String'));
36 $whereClause = "cv.label LIKE '$name%' ";
38 $query = "SELECT DISTINCT (
41 FROM civicrm_price_field_value cv
42 LEFT JOIN civicrm_price_field cf ON cv.price_field_id = cf.id
43 LEFT JOIN civicrm_price_set_entity ce ON ce.price_set_id = cf.price_set_id
44 WHERE ce.entity_table = 'civicrm_event' AND {$whereClause}";
46 $dao = CRM_Core_DAO
::executeQuery($query);
48 while ($dao->fetch()) {
49 $results[] = ['id' => $dao->id
, 'text' => $dao->label
];
51 CRM_Utils_JSON
::output($results);