return $from;
}
- /**
- * Getter for the qill object.
- *
- * @return string
- */
- public function qill() {
- return (isset($this->_qill)) ? $this->_qill : "";
- }
-
/**
* Add all the elements shared between case activity search and advanced search.
*
* @param CRM_Core_Form $form
*/
public static function buildSearchForm(&$form) {
- $activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
$form->addSelect('activity_type_id',
array('entity' => 'activity', 'label' => ts('Activity Type(s)'), 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -'))
);
array('class' => 'crm-select2')
);
}
- $extends = array('Activity');
- $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
- if ($groupDetails) {
- $form->assign('activityGroupTree', $groupDetails);
- foreach ($groupDetails as $group) {
- foreach ($group['fields'] as $field) {
- $fieldId = $field['id'];
- $elementName = 'custom_' . $fieldId;
- if ($field['data_type'] == 'Date' && $field['is_search_range']) {
- CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
- }
- else {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
- }
- }
- }
- }
+
+ CRM_Core_BAO_Query::addCustomFormFields($form, array('Activity'));
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'activity_campaign_id');
$resultOptions = array();
foreach ($optionGroups as $gid => $name) {
if ($name) {
- $value = array();
$value = CRM_Core_OptionGroup::values($name);
if (!empty($value)) {
while (list($k, $v) = each($value)) {
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2016
*/
-class CRM_Case_BAO_Query {
+class CRM_Case_BAO_Query extends CRM_Core_BAO_Query {
/**
* Get fields.
$form->addElement('checkbox', 'case_deleted', ts('Deleted Cases'));
}
- // add all the custom searchable fields
- $extends = array('Case');
- $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
- if ($groupDetails) {
- $form->assign('caseGroupTree', $groupDetails);
- foreach ($groupDetails as $group) {
- foreach ($group['fields'] as $field) {
- $fieldId = $field['id'];
- $elementName = 'custom_' . $fieldId;
- if ($field['data_type'] == 'Date' && $field['is_search_range']) {
- CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
- }
- else {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
- }
- }
- }
- }
- $form->setDefaults(array('case_owner' => 1));
- }
+ self::addCustomFormFields($form, array('Case'));
- /**
- * @param $row
- * @param int $id
- */
- public static function searchAction(&$row, $id) {
+ $form->setDefaults(array('case_owner' => 1));
}
/**
'placeholder' => ts('Primary'),
));
- // custom data extending addresses -
- $extends = array('Address');
- $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
- if ($groupDetails) {
- $form->assign('addressGroupTree', $groupDetails);
- foreach ($groupDetails as $group) {
- foreach ($group['fields'] as $field) {
- $elementName = 'custom_' . $field['id'];
- if ($field['data_type'] == 'Date' && $field['is_search_range']) {
- CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
- }
- else {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $field['id'], FALSE, TRUE);
- }
- }
- }
- }
+ // custom data extending addresses
+ CRM_Core_BAO_Query::addCustomFormFields($form, array('Address'));
}
/**
CRM_Core_Form_Date::buildDateRange($form, 'relation_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE);
// add all the custom searchable fields
- $relationship = array('Relationship');
- $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $relationship);
- if ($groupDetails) {
- $form->assign('relationshipGroupTree', $groupDetails);
- foreach ($groupDetails as $group) {
- foreach ($group['fields'] as $field) {
- $fieldId = $field['id'];
- $elementName = 'custom_' . $fieldId;
- if ($field['data_type'] == 'Date' && $field['is_search_range']) {
- CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
- }
- else {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
- }
- }
- }
- }
+ CRM_Core_BAO_Query::addCustomFormFields($form, array('Relationship'));
}
/**
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_cancel_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
$form->addElement('text', 'contribution_recur_processor_id', ts('Processor ID'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur', 'processor_id'));
$form->addElement('text', 'contribution_recur_trxn_id', ts('Transaction ID'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur', 'trxn_id'));
- $contributionRecur = array('ContributionRecur');
- $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contributionRecur);
- if ($groupDetails) {
- $form->assign('contributeRecurGroupTree', $groupDetails);
- foreach ($groupDetails as $group) {
- foreach ($group['fields'] as $field) {
- $fieldId = $field['id'];
- $elementName = 'custom_' . $fieldId;
- if ($field['data_type'] == 'Date' && $field['is_search_range']) {
- CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
- }
- else {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
- }
- }
- }
- }
+
+ CRM_Core_BAO_Query::addCustomFormFields($form, array('ContributionRecur'));
+
}
/**
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2016
*/
-class CRM_Contribute_BAO_Query {
+class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query {
/**
* Static field for all the export/import contribution fields.
FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -'))
);
- // Add all the custom searchable fields
- $contribution = array('Contribution');
- $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contribution);
- if ($groupDetails) {
- $form->assign('contributeGroupTree', $groupDetails);
- foreach ($groupDetails as $group) {
- foreach ($group['fields'] as $field) {
- $fieldId = $field['id'];
- $elementName = 'custom_' . $fieldId;
- if ($field['data_type'] == 'Date' && $field['is_search_range']) {
- CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
- }
- else {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
- }
- }
- }
- }
+ self::addCustomFormFields($form, array('Contribution'));
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'contribution_campaign_id');
CRM_Contribute_BAO_ContributionRecur::recurringContribution($form);
}
- /**
- * Function that may not be needed.
- *
- * @param array $row
- * @param int $id
- */
- public static function searchAction(&$row, $id) {
- }
-
/**
* Get table names.
*
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.7 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2016 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2016
+ * $Id$
+ *
+ */
+class CRM_Core_BAO_Query {
+
+ /**
+ * @param CRM_Core_Form $form
+ * @param array $extends
+ */
+ public static function addCustomFormFields(&$form, $extends) {
+ $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
+ if ($groupDetails) {
+ $tplName = lcfirst($extends[0]) . 'GroupTree';
+ $form->assign($tplName, $groupDetails);
+ foreach ($groupDetails as $group) {
+ foreach ($group['fields'] as $field) {
+ $fieldId = $field['id'];
+ $elementName = 'custom_' . $fieldId;
+ if ($field['data_type'] == 'Date' && $field['is_search_range']) {
+ CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
+ }
+ else {
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Possibly unnecessary function.
+ *
+ * @param $row
+ * @param int $id
+ */
+ public static function searchAction(&$row, $id) {}
+
+ /**
+ * @param $tables
+ */
+ public static function tableNames(&$tables) {}
+
+}
* $Id$
*
*/
-class CRM_Event_BAO_Query {
+class CRM_Event_BAO_Query extends CRM_Core_BAO_Query {
/**
* Function get the import/export fields for contribution.
return $from;
}
- /**
- * Getter for the qill object.
- *
- * @return string
- */
- public function qill() {
- return (isset($this->_qill)) ? $this->_qill : "";
- }
-
/**
* @param $mode
* @param bool $includeCustomFields
$form->addRule('participant_fee_amount_low', ts('Please enter a valid money value.'), 'money');
$form->addRule('participant_fee_amount_high', ts('Please enter a valid money value.'), 'money');
- // add all the custom searchable fields
- $extends = array('Participant', 'Event');
- $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
- if ($groupDetails) {
- $form->assign('participantGroupTree', $groupDetails);
- foreach ($groupDetails as $group) {
- foreach ($group['fields'] as $field) {
- $fieldId = $field['id'];
- $elementName = 'custom_' . $fieldId;
- if ($field['data_type'] == 'Date' && $field['is_search_range']) {
- CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
- }
- else {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
- }
- }
- }
- }
+
+ self::addCustomFormFields($form, array('Participant', 'Event'));
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'participant_campaign_id');
$form->setDefaults(array('participant_test' => 0));
}
- /**
- * @param $row
- * @param int $id
- */
- public static function searchAction(&$row, $id) {
- }
-
/**
* @param $tables
*/
* $Id$
*
*/
-class CRM_Grant_BAO_Query {
+class CRM_Grant_BAO_Query extends CRM_Core_BAO_Query {
/**
* @return array
*/
return $from;
}
- /**
- * Getter for the qill object.
- *
- * @return string
- */
- public function qill() {
- return (isset($this->_qill)) ? $this->_qill : "";
- }
-
/**
* @param $mode
* @param bool $includeCustomFields
$form->add('text', 'grant_amount_high', ts('Maximum Amount'), array('size' => 8, 'maxlength' => 8));
$form->addRule('grant_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
- // add all the custom searchable fields
- $grant = array('Grant');
- $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $grant);
- if ($groupDetails) {
- $form->assign('grantGroupTree', $groupDetails);
- foreach ($groupDetails as $group) {
- foreach ($group['fields'] as $field) {
- $fieldId = $field['id'];
- $elementName = 'custom_' . $fieldId;
- if ($field['data_type'] == 'Date' && $field['is_search_range']) {
- CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
- }
- else {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
- }
- }
- }
- }
+ self::addCustomFormFields($form, array('Grant'));
$form->assign('validGrant', TRUE);
}
- /**
- * @param $row
- * @param int $id
- */
- public static function searchAction(&$row, $id) {
- }
-
- /**
- * @param $tables
- */
- public static function tableNames(&$tables) {
- }
-
}
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2016
*/
-class CRM_Member_BAO_Query {
+class CRM_Member_BAO_Query extends CRM_Core_BAO_Query {
/**
* Get available fields.
$form->addYesNo('member_test', ts('Membership is a Test?'), TRUE);
$form->addYesNo('member_is_override', ts('Membership Status Is Overriden?'), TRUE);
- // add all the custom searchable fields
- $extends = array('Membership');
- $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
- if ($groupDetails) {
- $form->assign('membershipGroupTree', $groupDetails);
- foreach ($groupDetails as $group) {
- foreach ($group['fields'] as $field) {
- $fieldId = $field['id'];
- $elementName = 'custom_' . $fieldId;
- if ($field['data_type'] == 'Date' && $field['is_search_range']) {
- CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
- }
- else {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
- }
- }
- }
- }
+ self::addCustomFormFields($form, array('Membership'));
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'member_campaign_id');
$form->setDefaults(array('member_test' => 0));
}
- /**
- * Possibly un-required function.
- *
- * @param array $row
- * @param int $id
- */
- public static function searchAction(&$row, $id) {
- }
-
/**
* Add membership table.
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2016
*/
-class CRM_Pledge_BAO_Query {
+class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query {
/**
* Get pledge fields.
*
return $from;
}
- /**
- * Getter for the qill object.
- *
- * @return string
- */
- public function qill() {
- return (isset($this->_qill)) ? $this->_qill : "";
- }
-
/**
* Ideally this function should include fields that are displayed in the selector.
*
array('' => ts('- any -')) + $freqUnitsDisplay
);
- // add all the custom searchable fields
- $pledge = array('Pledge');
- $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $pledge);
- if ($groupDetails) {
- $form->assign('pledgeGroupTree', $groupDetails);
- foreach ($groupDetails as $group) {
- foreach ($group['fields'] as $field) {
- $fieldId = $field['id'];
- $elementName = 'custom_' . $fieldId;
- if ($field['data_type'] == 'Date' && $field['is_search_range']) {
- CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
- }
- else {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
- }
- }
- }
- }
+ self::addCustomFormFields($form, array('Pledge'));
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'pledge_campaign_id');
$form->setDefaults(array('pledge_test' => 0));
}
- /**
- * @param $row
- * @param int $id
- */
- public static function searchAction(&$row, $id) {
- }
-
/**
* @param $tables
*/
</td>
</tr>
-{if $contributeGroupTree}
+{if $contributionGroupTree}
<tr>
<td colspan="2">
- {include file="CRM/Custom/Form/Search.tpl" groupTree=$contributeGroupTree showHideLinks=false}</td>
+ {include file="CRM/Custom/Form/Search.tpl" groupTree=$contributionGroupTree showHideLinks=false}</td>
</tr>
{/if}
{include file="CRM/Core/DateRange.tpl" fieldName="contribution_recur_cancel_date" from='_low' to='_high'}
</td>
</tr>
- {if $contributeRecurGroupTree}
+ {if $contributionRecurGroupTree}
<tr>
<td colspan="4">
- {include file="CRM/Custom/Form/Search.tpl" groupTree=$contributeRecurGroupTree showHideLinks=false}
+ {include file="CRM/Custom/Form/Search.tpl" groupTree=$contributionRecurGroupTree showHideLinks=false}
</td>
</tr>
{/if}