From 56e00d58a449f4cc5cffe6ba9dac2af3cf11953d Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 4 Sep 2018 11:24:18 -0400 Subject: [PATCH] Switch grant form to use crmDatepicker instead of jCalendar --- CRM/Grant/Form/Grant.php | 24 ++++--------------- templates/CRM/Grant/Form/Grant.tpl | 37 +++++++++++------------------- 2 files changed, 18 insertions(+), 43 deletions(-) diff --git a/CRM/Grant/Form/Grant.php b/CRM/Grant/Form/Grant.php index 0a56a04933..095d9f0aa8 100644 --- a/CRM/Grant/Form/Grant.php +++ b/CRM/Grant/Form/Grant.php @@ -141,22 +141,6 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { 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; @@ -196,10 +180,10 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { $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']); diff --git a/templates/CRM/Grant/Form/Grant.tpl b/templates/CRM/Grant/Form/Grant.tpl index 6129921975..5ddac7ca34 100644 --- a/templates/CRM/Grant/Form/Grant.tpl +++ b/templates/CRM/Grant/Form/Grant.tpl @@ -63,34 +63,25 @@ {$form.application_received_date.label} - {if $hideCalendar neq true} - {include file="CRM/common/jcalendar.tpl" elementName=application_received_date} - {else} - {$form.application_received_date.value|crmDate} - {/if} + {$form.application_received_date.html} {$form.decision_date.label} - {if $hideCalendar neq true} - {include file="CRM/common/jcalendar.tpl" elementName=decision_date} - {else} - {$form.decision_date.value|crmDate} - {/if}
- {ts}Date on which the grant decision was finalized.{/ts} + + {$form.decision_date.html}
+ {ts}Date on which the grant decision was finalized.{/ts} + - {$form.money_transfer_date.label} - {if $hideCalendar neq true} - {include file="CRM/common/jcalendar.tpl" elementName=money_transfer_date} - {else} - {$form.money_transfer_date.value|crmDate} - {/if}
{ts}Date on which the grant money was transferred.{/ts} + + {$form.money_transfer_date.label} + + {$form.money_transfer_date.html}
+ {ts}Date on which the grant money was transferred.{/ts} + - {$form.grant_due_date.label} - {if $hideCalendar neq true} - {include file="CRM/common/jcalendar.tpl" elementName=grant_due_date} - {else} - {$form.grant_due_date.value|crmDate} - {/if} + + {$form.grant_due_date.label} + {$form.grant_due_date.html} {$form.grant_report_received.label} -- 2.25.1