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
19 class CRM_Core_BAO_Query
{
22 * @param CRM_Core_Form $form
23 * @param array $extends
25 public static function addCustomFormFields(&$form, $extends) {
26 $groupDetails = CRM_Core_BAO_CustomGroup
::getGroupDetail(NULL, TRUE, $extends);
28 $tplName = lcfirst($extends[0]) . 'GroupTree';
29 $form->assign($tplName, $groupDetails);
30 foreach ($groupDetails as $group) {
31 foreach ($group['fields'] as $field) {
32 $fieldId = $field['id'];
33 $elementName = 'custom_' . $fieldId;
34 if ($field['data_type'] === 'Date' && $field['is_search_range']) {
35 $form->addDatePickerRange($elementName, $field['label']);
38 CRM_Core_BAO_CustomField
::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
46 * Get legacy fields which we still maybe support.
48 * These are contribution specific but I think it's ok to have one list of legacy supported
49 * params in a central place.
53 protected static function getLegacySupportedFields(): array {
54 // @todo enotices when these are hit so we can start to elimnate them.
56 'financial_type' => 'financial_type_id',
57 'contribution_page' => 'contribution_page_id',
58 'payment_instrument' => 'payment_instrument_id',
59 // or payment_instrument_id?
60 'contribution_payment_instrument' => 'contribution_payment_instrument_id',
61 'contribution_status' => 'contribution_status_id',
67 * Getter for the qill object.
71 public function qill() {
72 return (isset($this->_qill
)) ?
$this->_qill
: "";
76 * Possibly unnecessary function.
81 public static function searchAction(&$row, $id) {}
86 public static function tableNames(&$tables) {}
89 * Get the name of the field.
91 * @param array $values
95 protected static function getFieldName($values) {
97 $fieldAliases = self
::getLegacySupportedFields();
98 if (isset($fieldAliases[$name])) {
99 CRM_Core_Error
::deprecatedFunctionWarning('These parameters should be standardised before we get here');
100 return $fieldAliases[$name];
103 return str_replace(['_high', '_low'], '', $name);