Skip to content

Commit

Permalink
Merge pull request #13198 from seamuslee001/event_search_561
Browse files Browse the repository at this point in the history
dev/core#561 Remove jcalendar from the Event Aggregate Custom Search
  • Loading branch information
seamuslee001 committed Dec 1, 2018
2 parents 45d747b + 84fb17e commit 45ee78a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
15 changes: 7 additions & 8 deletions CRM/Contact/Form/Search/Custom/EventAggregate.php
Expand Up @@ -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, ['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
Expand Down Expand Up @@ -237,14 +237,13 @@ 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";
// 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'])) {
Expand Down
8 changes: 1 addition & 7 deletions templates/CRM/Contact/Form/Search/Custom/EventDetails.tpl
Expand Up @@ -41,13 +41,7 @@
{foreach from=$elements item=element}
<tr class="crm-contact-custom-search-eventDetails-form-block-{$element}">
<td class="label">{$form.$element.label}</td>
{if $element eq 'start_date'}
<td>{include file="CRM/common/jcalendar.tpl" elementName=start_date}</td>
{elseif $element eq 'end_date'}
<td>{include file="CRM/common/jcalendar.tpl" elementName=end_date}</td>
{else}
<td>{$form.$element.html}</td>
{/if}
<td>{$form.$element.html}</td>
</tr>
{/foreach}
<tr class="crm-contact-custom-search-eventDetails-form-block-event_type">
Expand Down

0 comments on commit 45ee78a

Please sign in to comment.