diff --git a/CRM/Contact/Form/Search/Custom/EventAggregate.php b/CRM/Contact/Form/Search/Custom/EventAggregate.php index eb35e4ea1e96..0118f26e8ba8 100644 --- a/CRM/Contact/Form/Search/Custom/EventAggregate.php +++ b/CRM/Contact/Form/Search/Custom/EventAggregate.php @@ -85,8 +85,8 @@ public function buildForm(&$form) { $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); + $form->add('datepicker', 'end_date', ts('...through'), [], FALSE); /** * If you are using the sample template, this array tells the template fields to render @@ -237,14 +237,16 @@ public function where($includeContactIDs = FALSE) { $clauses[] = "civicrm_contribution.payment_instrument_id <> 0"; } - $startDate = CRM_Utils_Date::processDate($this->_formValues['start_date']); - if ($startDate) { - $clauses[] = "civicrm_contribution.receive_date >= $startDate"; + if ($this->_formValues['start_date']) { + // Ensure that if no time has been specified then we set the default time to be midnight. + $start_date = strlen($this->_formValues['start_date']) == 10 ? $this->_formValues['start_date'] . ' 00:00:00' : $this->_formValues['start_date']; + $clauses[] = "civicrm_contribution.receive_date >= '{$start_date}'"; } - $endDate = CRM_Utils_Date::processDate($this->_formValues['end_date']); - if ($endDate) { - $clauses[] = "civicrm_contribution.receive_date <= {$endDate}235959"; + if ($this->_formValues['end_date']) { + // Ensure that if no time is specified then we set the default end time to be just before midnight. + $end_date = strlen($this->_formValues['end_date']) == 10 ? $this->_formValues['end_date'] . ' 23:59:59' : $this->_formValues['end_date']; + $clauses[] = "civicrm_contribution.receive_date <= '{$end_date}'"; } 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 bf0a2ebe125d..bb15a8736e43 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}