Skip to content

Commit

Permalink
Merge pull request #12771 from colemanw/grantDates
Browse files Browse the repository at this point in the history
Switch grant form to use crmDatepicker instead of jCalendar
  • Loading branch information
seamuslee001 authored Sep 13, 2018
2 parents 0f162a4 + 56e00d5 commit 6c7045d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 43 deletions.
24 changes: 4 additions & 20 deletions CRM/Grant/Form/Grant.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,6 @@ public function setDefaultValues() {
if (isset($defaults['amount_granted'])) {
$defaults['amount_granted'] = CRM_Utils_Money::format($defaults['amount_granted'], NULL, '%a');
}

$dates = array(
'application_received_date',
'decision_date',
'money_transfer_date',
'grant_due_date',
);

foreach ($dates as $key) {
if (!empty($defaults[$key])) {
list($defaults[$key]) = CRM_Utils_Date::setDateDefaults($defaults[$key]);
}
}
}
else {
list($defaults['application_received_date']) = CRM_Utils_Date::setDateDefaults();
}

return $defaults;
Expand Down Expand Up @@ -196,10 +180,10 @@ public function buildQuickForm() {

$this->addSelect('status_id', array(), TRUE);

$this->addDate('application_received_date', ts('Application Received'), FALSE, array('formatType' => 'custom'));
$this->addDate('decision_date', ts('Grant Decision'), FALSE, array('formatType' => 'custom'));
$this->addDate('money_transfer_date', ts('Money Transferred'), FALSE, array('formatType' => 'custom'));
$this->addDate('grant_due_date', ts('Grant Report Due'), FALSE, array('formatType' => 'custom'));
$this->add('datepicker', 'application_received_date', ts('Application Received'), [], FALSE, ['time' => FALSE]);
$this->add('datepicker', 'decision_date', ts('Grant Decision'), [], FALSE, ['time' => FALSE]);
$this->add('datepicker', 'money_transfer_date', ts('Money Transferred'), [], FALSE, ['time' => FALSE]);
$this->add('datepicker', 'grant_due_date', ts('Grant Report Due'), [], FALSE, ['time' => FALSE]);

$this->addElement('checkbox', 'grant_report_received', ts('Grant Report Received?'), NULL);
$this->add('textarea', 'rationale', ts('Rationale'), $attributes['rationale']);
Expand Down
37 changes: 14 additions & 23 deletions templates/CRM/Grant/Form/Grant.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -63,34 +63,25 @@
</tr>
<tr class="crm-grant-form-block-application_received_date">
<td class="label">{$form.application_received_date.label}</td>
<td>{if $hideCalendar neq true}
{include file="CRM/common/jcalendar.tpl" elementName=application_received_date}
{else}
{$form.application_received_date.value|crmDate}
{/if}</td>
<td>{$form.application_received_date.html}</td>
</tr>
<tr class="crm-grant-form-block-decision_date">
<td class="label">{$form.decision_date.label}</td>
<td>{if $hideCalendar neq true}
{include file="CRM/common/jcalendar.tpl" elementName=decision_date}
{else}
{$form.decision_date.value|crmDate}
{/if}<br />
<span class="description">{ts}Date on which the grant decision was finalized.{/ts}</span></td>
<td>
{$form.decision_date.html}<br />
<span class="description">{ts}Date on which the grant decision was finalized.{/ts}</span>
</td>
</tr>
<tr class="crm-grant-form-block-money_transfer_date"><td class="label">{$form.money_transfer_date.label}</td>
<td>{if $hideCalendar neq true}
{include file="CRM/common/jcalendar.tpl" elementName=money_transfer_date}
{else}
{$form.money_transfer_date.value|crmDate}
{/if}<br /><span class="description">{ts}Date on which the grant money was transferred.{/ts}</span></td>
<tr class="crm-grant-form-block-money_transfer_date">
<td class="label">{$form.money_transfer_date.label}</td>
<td>
{$form.money_transfer_date.html}<br />
<span class="description">{ts}Date on which the grant money was transferred.{/ts}</span>
</td>
</tr>
<tr class="crm-grant-form-block-grant_due_date"><td class="label">{$form.grant_due_date.label}</td>
<td>{if $hideCalendar neq true}
{include file="CRM/common/jcalendar.tpl" elementName=grant_due_date}
{else}
{$form.grant_due_date.value|crmDate}
{/if}</td>
<tr class="crm-grant-form-block-grant_due_date">
<td class="label">{$form.grant_due_date.label}</td>
<td>{$form.grant_due_date.html}</td>
</tr>
<tr class="crm-grant-form-block-grant_report_received">
<td class="label">{$form.grant_report_received.label}</td>
Expand Down

0 comments on commit 6c7045d

Please sign in to comment.