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
17 class CRM_Core_BAO_Query
{
20 * @param CRM_Core_Form $form
21 * @param array $extends
23 public static function addCustomFormFields(&$form, $extends) {
24 $groupDetails = CRM_Core_BAO_CustomGroup
::getGroupDetail(NULL, TRUE, $extends);
26 $tplName = lcfirst($extends[0]) . 'GroupTree';
27 $form->assign($tplName, $groupDetails);
28 foreach ($groupDetails as $group) {
29 foreach ($group['fields'] as $field) {
30 $fieldId = $field['id'];
31 $elementName = 'custom_' . $fieldId;
32 if ($field['data_type'] === 'Date' && $field['is_search_range']) {
33 $form->addDatePickerRange($elementName, $field['label']);
36 CRM_Core_BAO_CustomField
::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
44 * Get legacy fields which we still maybe support.
46 * These are contribution specific but I think it's ok to have one list of legacy supported
47 * params in a central place.
51 protected static function getLegacySupportedFields(): array {
52 // @todo enotices when these are hit so we can start to elimnate them.
54 'financial_type' => 'financial_type_id',
55 'contribution_page' => 'contribution_page_id',
56 'payment_instrument' => 'payment_instrument_id',
57 // or payment_instrument_id?
58 'contribution_payment_instrument' => 'contribution_payment_instrument_id',
59 'contribution_status' => 'contribution_status_id',
65 * Getter for the qill object.
69 public function qill() {
70 return (isset($this->_qill
)) ?
$this->_qill
: "";
74 * Possibly unnecessary function.
79 public static function searchAction(&$row, $id) {}
84 public static function tableNames(&$tables) {}
87 * Get the name of the field.
89 * @param array $values
93 protected static function getFieldName($values) {
95 $fieldAliases = self
::getLegacySupportedFields();
96 if (isset($fieldAliases[$name])) {
97 CRM_Core_Error
::deprecatedFunctionWarning('These parameters should be standardised before we get here');
98 return $fieldAliases[$name];
101 return str_replace(['_high', '_low'], '', $name);