ts('...and $')
);
$form->addRule('max_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
-
- $form->addDate('start_date', ts('Contribution Date From'), FALSE, array('formatType' => 'custom'));
- $form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
+ CRM_Core_Form_Date::buildDateRange($form, 'contribution_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE);
$form->addSelect('financial_type_id',
array('entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search')
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
- $form->assign('elements', array('min_amount', 'max_amount', 'start_date', 'end_date'));
+ $form->assign('elements', array('min_amount', 'max_amount'));
}
/**
$clauses[] = "contrib.contact_id = contact_a.id";
$clauses[] = "contrib.is_test = 0";
- $startTime = !empty($this->_formValues['start_date_time']) ? $this->_formValues['start_date_time'] : '00:00:00';
- $endTime = !empty($this->_formValues['end_date_time']) ? $this->_formValues['end_date_time'] : '23:59:59';
+ $relative = $this->_formValues['contribution_date_relative'];
+ $startDate = $this->_formValues['contribution_date_low'];
+ $endDate = $this->_formValues['contribution_date_high'];
+ list($startDate, $endDate) = CRM_Utils_Date::getFromTo($relative, $startDate, $endDate);
- $startDate = CRM_Utils_Date::processDate($this->_formValues['start_date'], $startTime);
if ($startDate) {
$clauses[] = "contrib.receive_date >= $startDate";
}
- $endDate = CRM_Utils_Date::processDate($this->_formValues['end_date'], $endTime);
if ($endDate) {
$clauses[] = "contrib.receive_date <= $endDate";
}
{foreach from=$elements item=element}
<tr class="crm-contact-custom-search-form-row-{$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-contributionDetails-form-block-receive_date">
+ <td><label>{ts}Contribution Dates{/ts}</label></td>
+ {include file="CRM/Core/DateRange.tpl" fieldName="contribution_date" from='_low' to='_high'}
+ </tr>
<tr class="crm-contact-custom-search-contributionDetails-form-block-financial_type">
<td class="label">{ts}Financial Type{/ts}</td>
<td>{$form.financial_type_id.html|crmAddClass:twenty}</td>