<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
+ * @copyright CiviCRM LLC (c) 2004-2015
*/
class CRM_Campaign_BAO_Query {
//since normal activity clause clause get collides.
/**
* If survey, campaign are involved, add the specific fields.
*
- * @param $query
- *
- * @return void
+ * @param CRM_Contact_BAO_Contact $query
*/
public static function select(&$query) {
self::$_applySurveyClause = FALSE;
* Add all the elements shared between,
* normal voter search and voter listing (GOTV form)
*
- *
* @param CRM_Core_Form $form
- * @return void
*/
public static function buildSearchForm(&$form) {
$form->add('text', 'street_unit', ts('Street Unit'), $attributes['street_unit']);
$form->add('text', 'street_address', ts('Street Address'), $attributes['street_address']);
$form->add('text', 'city', ts('City'), $attributes['city']);
- $form->add('text', 'postal_code', ts('Zip / Postal Code'), $attributes['postal_code']);
+ $form->add('text', 'postal_code', ts('Postal Code'), $attributes['postal_code']);
//@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
// this is loaded onto then replace with something like '__' & test
//create temporary table to store voter ids.
$tempTableName = CRM_Core_DAO::createTempTableName('civicrm_survey_respondent');
- CRM_Core_DAO::executeQuery("DROP TABLE IF EXISTS {$tempTableName}");
+ CRM_Core_DAO::executeQuery("DROP TEMPORARY TABLE IF EXISTS {$tempTableName}");
$query = "
CREATE TEMPORARY TABLE {$tempTableName} (
return $voterClause;
}
- /**
- * Build the campaign clause for component serach.
- *
- */
- public static function componentSearchClause(&$params, &$query) {
- $op = CRM_Utils_Array::value('op', $params, '=');
- $campaign = CRM_Utils_Array::value('campaign', $params);
- $tableName = CRM_Utils_Array::value('tableName', $params);
- $grouping = CRM_Utils_Array::value('grouping', $params);
- if (CRM_Utils_System::isNull($campaign) || empty($tableName)) {
- return;
- }
-
- // fixme - what is the purpose of this code? $campaign should be
- // an integer, not an array
- if (is_array($campaign)) {
- foreach (array(
- 'current_campaign',
- 'past_campaign',
- ) as $ignore) {
- $index = array_search($ignore, $campaign);
- if ($index !== FALSE) {
- unset($campaign[$index]);
- }
- }
- }
-
- $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
-
- $campaignIds = $campaignTitles = array();
- if (is_array($campaign)) {
- foreach ($campaign as $campId) {
- $campaignIds[$campId] = $campId;
- $campaignTitles[$campId] = $allCampaigns[$campId];
- }
- if (count($campaignIds) > 1) {
- $op = 'IN';
- $campaignIds = '(' . implode(',', $campaignIds) . ')';
- }
- else {
- $campaignIds = reset($campaignIds);
- }
- }
- else {
- $campaignIds = $campaign;
- if (array_key_exists($campaignIds, $allCampaigns)) {
- $campaignTitles[$campaignIds] = $allCampaigns[$campaignIds];
- }
- }
- $query->_qill[$grouping][] = ts('Campaigns %1',
- array(1 => $op)
- ) . ' ' . implode(' ' . ts('or') . ' ', $campaignTitles);
- $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("{$tableName}.campaign_id",
- $op,
- $campaignIds,
- 'Integer'
- );
- $query->_tables[$tableName] = $query->_whereTables[$tableName] = 1;
- }
-
}