From 84fb17e32909e0f7c14a383182de4d2f297df6c2 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 1 Dec 2018 05:56:19 +0000 Subject: [PATCH] dev/core#561 Remove jcalendar from the Event Aggregate Custom Search --- CRM/Contact/Form/Search/Custom/EventAggregate.php | 15 +++++++-------- .../Contact/Form/Search/Custom/EventDetails.tpl | 8 +------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/CRM/Contact/Form/Search/Custom/EventAggregate.php b/CRM/Contact/Form/Search/Custom/EventAggregate.php index eb35e4ea1e..dc90e5932a 100644 --- a/CRM/Contact/Form/Search/Custom/EventAggregate.php +++ b/CRM/Contact/Form/Search/Custom/EventAggregate.php @@ -85,8 +85,8 @@ class CRM_Contact_Form_Search_Custom_EventAggregate extends CRM_Contact_Form_Sea $events = CRM_Event_BAO_Event::getEvents(1); $form->add('select', 'event_id', ts('Event Name'), array('' => ts('- select -')) + $events); - $form->addDate('start_date', ts('Payments Date From'), FALSE, array('formatType' => 'custom')); - $form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom')); + $form->add('datepicker', 'start_date', ts('Payments Date From'), [], FALSE, ['time' => FALSE]); + $form->add('datepicker', 'end_date', ts('...through'), [], FALSE, ['time' => FALSE]); /** * If you are using the sample template, this array tells the template fields to render @@ -237,14 +237,13 @@ class CRM_Contact_Form_Search_Custom_EventAggregate extends CRM_Contact_Form_Sea $clauses[] = "civicrm_contribution.payment_instrument_id <> 0"; } - $startDate = CRM_Utils_Date::processDate($this->_formValues['start_date']); - if ($startDate) { - $clauses[] = "civicrm_contribution.receive_date >= $startDate"; + // As we only allow date to be submitted we need to set default times so midnight for start time and just before midnight for end time. + if ($this->_formValues['start_date']) { + $clauses[] = "civicrm_contribution.receive_date >= '{$this->_formValues['start_date']} 00:00:00'"; } - $endDate = CRM_Utils_Date::processDate($this->_formValues['end_date']); - if ($endDate) { - $clauses[] = "civicrm_contribution.receive_date <= {$endDate}235959"; + if ($this->_formValues['end_date']) { + $clauses[] = "civicrm_contribution.receive_date <= '{$this->_formValues['end_date']} 23:59:59'"; } if (!empty($this->_formValues['event_id'])) { diff --git a/templates/CRM/Contact/Form/Search/Custom/EventDetails.tpl b/templates/CRM/Contact/Form/Search/Custom/EventDetails.tpl index bf0a2ebe12..bb15a8736e 100644 --- a/templates/CRM/Contact/Form/Search/Custom/EventDetails.tpl +++ b/templates/CRM/Contact/Form/Search/Custom/EventDetails.tpl @@ -41,13 +41,7 @@ {foreach from=$elements item=element} {$form.$element.label} - {if $element eq 'start_date'} - {include file="CRM/common/jcalendar.tpl" elementName=start_date} - {elseif $element eq 'end_date'} - {include file="CRM/common/jcalendar.tpl" elementName=end_date} - {else} - {$form.$element.html} - {/if} + {$form.$element.html} {/foreach} -- 2.25.1