From 8b0533f07fceae41186281bdd98e53e06e71e371 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 15 May 2017 11:19:01 +1200 Subject: [PATCH] CRM-20572 Remove jcalendar from Contrib Sybunt custom Search --- .../Form/Search/Custom/ContribSYBNT.php | 22 +++++++++---------- CRM/Contact/Selector/Custom.php | 2 +- .../Form/Search/Custom/ContribSYBNT.tpl | 12 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CRM/Contact/Form/Search/Custom/ContribSYBNT.php b/CRM/Contact/Form/Search/Custom/ContribSYBNT.php index 5af0eefca4..52601d1a5f 100644 --- a/CRM/Contact/Form/Search/Custom/ContribSYBNT.php +++ b/CRM/Contact/Form/Search/Custom/ContribSYBNT.php @@ -83,7 +83,7 @@ class CRM_Contact_Form_Search_Custom_ContribSYBNT extends CRM_Contact_Form_Searc foreach ($this->_dates as $name => $title) { if (!empty($this->_formValues[$name])) { - $this->{$name} = CRM_Utils_Date::processDate($this->_formValues[$name]); + $this->{$name} = $this->_formValues[$name]; } } } @@ -101,7 +101,7 @@ class CRM_Contact_Form_Search_Custom_ContribSYBNT extends CRM_Contact_Form_Searc } foreach ($this->_dates as $name => $title) { - $form->addDate($name, $title, FALSE, array('formatType' => 'custom')); + $form->add('datepicker', $name, $title, array(), FALSE, array('time' => FALSE)); } foreach ($this->_checkboxes as $name => $title) { @@ -194,7 +194,7 @@ ORDER BY donation_amount desc if ($justIDs) { CRM_Core_DAO::executeQuery("DROP TEMPORARY TABLE IF EXISTS CustomSearch_SYBNT_temp"); $query = "CREATE TEMPORARY TABLE CustomSearch_SYBNT_temp AS ({$sql})"; - $dao = CRM_Core_DAO::executeQuery($query); + CRM_Core_DAO::executeQuery($query); $sql = "SELECT contact_a.id as contact_id FROM CustomSearch_SYBNT_temp as contact_a"; } return $sql; @@ -246,22 +246,22 @@ count(contrib_1.id) AS donation_count $clauses = array(); if (!empty($this->start_date_1)) { - $clauses[] = "contrib_1.receive_date >= {$this->start_date_1}"; + $clauses[] = CRM_Core_DAO::composeQuery('contrib_1.receive_date >= %1', array(1 => array($this->start_date_1, 'String'))); } if (!empty($this->end_date_1)) { - $clauses[] = "contrib_1.receive_date <= {$this->end_date_1}"; + $clauses[] = CRM_Core_DAO::composeQuery('contrib_1.receive_date <= %1', array(1 => array($this->end_date_1, 'String'))); } if (!empty($this->start_date_2) || !empty($this->end_date_2)) { $clauses[] = "contrib_2.is_test = 0"; if (!empty($this->start_date_2)) { - $clauses[] = "contrib_2.receive_date >= {$this->start_date_2}"; + $clauses[] = CRM_Core_DAO::composeQuery('contrib_2.receive_date >= %1', array(1 => array($this->start_date_2, 'String'))); } if (!empty($this->end_date_2)) { - $clauses[] = "contrib_2.receive_date <= {$this->end_date_2}"; + $clauses[] = CRM_Core_DAO::composeQuery('contrib_2.receive_date <= %1', array(1 => array($this->end_date_2, 'String'))); } } @@ -279,11 +279,11 @@ count(contrib_1.id) AS donation_count $excludeClauses = array(); if ($this->exclude_start_date) { - $excludeClauses[] = "c.receive_date >= {$this->exclude_start_date}"; + $excludeClauses[] = CRM_Core_DAO::composeQuery('c.receive_date >= %1', array(1 => array($this->exclude_start_date, 'String'))); } if ($this->exclude_end_date) { - $excludeClauses[] = "c.receive_date <= {$this->exclude_end_date}"; + $excludeClauses[] = CRM_Core_DAO::composeQuery('c.receive_date <= %1', array(1 => array($this->exclude_end_date, 'String'))); } $excludeClause = NULL; @@ -317,7 +317,7 @@ GROUP BY c.contact_id $havingClause "; - $dao = CRM_Core_DAO::executeQuery($query); + CRM_Core_DAO::executeQuery($query); } // now ensure we dont consider donors that are not first time @@ -329,7 +329,7 @@ FROM civicrm_contribution c WHERE c.is_test = 0 AND c.receive_date < {$this->start_date_1} "; - $dao = CRM_Core_DAO::executeQuery($query); + CRM_Core_DAO::executeQuery($query); } $clauses[] = " xg.contact_id IS NULL "; diff --git a/CRM/Contact/Selector/Custom.php b/CRM/Contact/Selector/Custom.php index 7399177184..b1cc490e88 100644 --- a/CRM/Contact/Selector/Custom.php +++ b/CRM/Contact/Selector/Custom.php @@ -297,7 +297,7 @@ class CRM_Contact_Selector_Custom extends CRM_Contact_Selector { $contactQueryObj = $this->_search->getQueryObj(); } - $dao = CRM_Core_DAO::executeQuery($sql, CRM_Core_DAO::$_nullArray); + $dao = CRM_Core_DAO::executeQuery($sql); $columns = $this->_search->columns(); $columnNames = array_values($columns); diff --git a/templates/CRM/Contact/Form/Search/Custom/ContribSYBNT.tpl b/templates/CRM/Contact/Form/Search/Custom/ContribSYBNT.tpl index b298dbb5a6..32368a6d79 100644 --- a/templates/CRM/Contact/Form/Search/Custom/ContribSYBNT.tpl +++ b/templates/CRM/Contact/Form/Search/Custom/ContribSYBNT.tpl @@ -42,8 +42,8 @@ - {include file="CRM/common/jcalendar.tpl" elementName=start_date_1} - {include file="CRM/common/jcalendar.tpl" elementName=end_date_1} + {$form.start_date_1.html} + {$form.end_date_1.html} {$form.is_first_amount.html} {ts}First time donor only?{/ts} @@ -54,8 +54,8 @@ - {include file="CRM/common/jcalendar.tpl" elementName=start_date_2} - {include file="CRM/common/jcalendar.tpl" elementName=end_date_2} + {$form.start_date_2.html} + {$form.end_date_2.html}   @@ -66,8 +66,8 @@ - {include file="CRM/common/jcalendar.tpl" elementName=exclude_start_date} - {include file="CRM/common/jcalendar.tpl" elementName=exclude_end_date} + {$form.exclude_start_date.html} + {$form.exclude_end_date.html}   -- 2.25.1