*/
protected $statusMessageTitle;
+ /**
+ * Explicitly declare the form context.
+ */
+ public function getDefaultContext() {
+ return 'create';
+ }
+
/**
* Set variables up before form is built.
*/
else {
$defaults['refund_trxn_id'] = isset($defaults['trxn_id']) ? $defaults['trxn_id'] : NULL;
}
- $dates = array(
- 'receive_date',
- 'receipt_date',
- 'cancel_date',
- 'thankyou_date',
- );
- foreach ($dates as $key) {
- if (!empty($defaults[$key])) {
- list($defaults[$key], $defaults[$key . '_time'])
- = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value($key, $defaults), 'activityDateTime');
- }
- }
if (!$this->_id && empty($defaults['receive_date'])) {
- list($defaults['receive_date'],
- $defaults['receive_date_time']
- ) = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime');
+ $defaults['receive_date'] = date('Y-m-d H:i:s');
}
- $this->assign('receive_date', CRM_Utils_Date::processDate(CRM_Utils_Array::value('receive_date', $defaults),
- CRM_Utils_Array::value('receive_date_time', $defaults)
- ));
$currency = CRM_Utils_Array::value('currency', $defaults);
$this->assign('currency', $currency);
// Hack to get currency info to the js layer. CRM-11440.
}
// add various dates
- $this->addDateTime('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDateTime'));
+ $this->addField('receive_date', array('entity' => 'contribution'), FALSE, FALSE);
+ $this->addField('receipt_date', array('entity' => 'contribution'), FALSE, FALSE);
+ $this->addField('cancel_date', array('entity' => 'contribution', 'label' => ts('Cancelled / Refunded Date')), FALSE, FALSE);
if ($this->_online) {
$this->assign('hideCalender', TRUE);
}
- $this->addDateTime('receipt_date', ts('Receipt Date'), FALSE, array('formatType' => 'activityDateTime'));
- $this->addDateTime('cancel_date', ts('Cancelled / Refunded Date'), FALSE, array('formatType' => 'activityDateTime'));
-
$this->add('textarea', 'cancel_reason', ts('Cancellation / Refund Reason'), $attributes['cancel_reason']);
$totalAmount = NULL;
CRM_Core_Config::singleton()->defaultCurrency
);
- if (!empty($this->_params['receive_date'])) {
- $this->_params['receive_date'] = CRM_Utils_Date::processDate($this->_params['receive_date'], $this->_params['receive_date_time']);
- }
- else {
- $this->_params['receive_date'] = $now;
- }
-
$this->_params['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $params);
$this->_params['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $params);
$this->_params['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $params);
if (!empty($this->_params['is_email_receipt'])) {
$this->_params['receipt_date'] = $now;
}
- else {
- $this->_params['receipt_date'] = CRM_Utils_Date::processDate($this->_params['receipt_date'],
- $params['receipt_date_time'], TRUE
- );
- }
$this->set('params', $this->_params);
'01-' . implode('-', $formValues['revenue_recognition_date'])
);
}
- $dates = array(
- 'receive_date',
- 'receipt_date',
- 'cancel_date',
- );
-
- foreach ($dates as $d) {
- if (isset($formValues[$d])) {
- $params[$d] = CRM_Utils_Date::processDate($formValues[$d], CRM_Utils_Array::value($d . '_time', $formValues), TRUE);
- }
- }
if (!empty($formValues['is_email_receipt'])) {
$params['receipt_date'] = date("Y-m-d");
{if $contributionMode && $processorSupportsFutureStartDate}
<tr id='start_date' class="crm-contribution-form-block-receive_date">
<td class="label">{ts}Start Date{/ts}</td>
- <td {$valueStyle}>{if $hideCalender neq true}{include file="CRM/common/jcalendar.tpl" elementName=receive_date}{else}{$receive_date|crmDate}{/if}<br />
+ <td {$valueStyle}>{if $hideCalender neq true}{$form.receive_date.html}{/if}<br />
<span class="description">{ts}You can set a start date for recurring contributions and the first payment will be on that date. For a single post-dated contribution you must select recurring and choose one installment{/ts}</span>
</td>
</tr>
<td class="label">{$form.cancel_date.label}</td>
<td>
{if $hideCalendar neq true}
- {include file="CRM/common/jcalendar.tpl" elementName=cancel_date}
+ {$form.cancel_date.html}
{else}
{$form.cancel_date.value|crmDate}
{/if}
</tr>
<tr class="crm-contribution-form-block-receive_date">
<td class="label">{$form.receive_date.label}</td>
- <td {$valueStyle}>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}<br />
+ <td>{$form.receive_date.html}<br />
<span class="description">{ts}The date this contribution was received.{/ts}</span>
</td>
</tr>
</tr>
<tr id="receiptDate" class="crm-contribution-form-block-receipt_date">
<td class="label">{$form.receipt_date.label}</td>
- <td>{include file="CRM/common/jcalendar.tpl" elementName=receipt_date}<br />
+ <td>{$form.receipt_date.html}<br />
<span class="description">{ts}Date that a receipt was sent to the contributor.{/ts}</span>
</td>
</tr>