Skip to content
Snippets Groups Projects
Commit 70a44aee authored by Seamus Lee's avatar Seamus Lee
Browse files

#561 Replace jacalendar with datepicker in Price Field Form

Update Display of Field dates as well
parent bbdb4eea
Branches
Tags
No related merge requests found
......@@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Price/PriceField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:2a85d03f1f7e607a89d20b810d8ead38)
* (GenCodeChecksum:e9ff5a22489167a421efd2f415ba4f58)
*/
/**
......@@ -374,7 +374,8 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO {
'bao' => 'CRM_Price_BAO_PriceField',
'localizable' => 0,
'html' => [
'type' => 'CheckBox',
'type' => 'Select Date',
'formatType' => 'activityDateTime',
],
],
'expire_on' => [
......@@ -389,6 +390,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO {
'localizable' => 0,
'html' => [
'type' => 'Select Date',
'formatType' => 'activityDateTime',
],
],
'javascript' => [
......
......@@ -115,17 +115,6 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
$defaults['is_active'] = $isActive;
}
if (!empty($defaults['active_on'])) {
list($defaults['active_on'],
$defaults['active_on_time']
) = CRM_Utils_Date::setDateDefaults($defaults['active_on'], 'activityDateTime');
}
if (!empty($defaults['expire_on'])) {
list($defaults['expire_on'],
$defaults['expire_on_time']
) = CRM_Utils_Date::setDateDefaults($defaults['expire_on'], 'activityDateTime');
}
}
else {
$defaults['is_active'] = 1;
......@@ -338,10 +327,10 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceField', 'help_post')
);
$this->addDateTime('active_on', ts('Active On'), FALSE, array('formatType' => 'activityDateTime'));
$this->add('datepicker', 'active_on', ts('Active On'), [], FALSE, array('time' => TRUE));
// expire_on
$this->addDateTime('expire_on', ts('Expire On'), FALSE, array('formatType' => 'activityDateTime'));
$this->add('datepicker', 'expire_on', ts('Expire On'), [], FALSE, array('time' => TRUE));
// is required ?
$this->add('checkbox', 'is_required', ts('Required?'));
......@@ -643,18 +632,6 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
$params['is_required'] = CRM_Utils_Array::value('is_required', $params, FALSE);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $params, FALSE);
if (isset($params['active_on'])) {
$params['active_on'] = CRM_Utils_Date::processDate($params['active_on'],
CRM_Utils_Array::value('active_on_time', $params),
TRUE
);
}
if (isset($params['expire_on'])) {
$params['expire_on'] = CRM_Utils_Date::processDate($params['expire_on'],
CRM_Utils_Array::value('expire_on_time', $params),
TRUE
);
}
$params['visibility_id'] = CRM_Utils_Array::value('visibility_id', $params, FALSE);
$params['count'] = CRM_Utils_Array::value('count', $params, FALSE);
......
......@@ -205,7 +205,7 @@
<tr class="crm-price-field-form-block-active_on">
<td class="label">{$form.active_on.label}</td>
<td>{include file="CRM/common/jcalendar.tpl" elementName=active_on}
<td>{$form.active_on.html}
{if $action neq 4}
<br /><span class="description">{ts}Date this field becomes effective (optional). Used for price set fields that are made available starting on a specific date.{/ts}</span>
{/if}
......@@ -214,7 +214,7 @@
<tr class="crm-price-field-form-block-expire_on">
<td class="label">{$form.expire_on.label}</td>
<td>{include file="CRM/common/jcalendar.tpl" elementName=expire_on}
<td>{$form.expire_on.html}
{if $action neq 4}
<br /><span class="description">{ts}Date this field expires (optional). Used for price set fields that are no longer available after a specific date (e.g. early-bird pricing).{/ts}</span>
{/if}
......
......@@ -79,8 +79,8 @@
<td class="nowrap">{$row.weight}</td>
<td class="crm-editable" data-field="is_required" data-type="boolean">{if $row.is_required eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td>{if $row.active_on}{$row.active_on|date_format:"%Y-%m-%d %T"}{/if}</td>
<td>{if $row.expire_on}{$row.expire_on|date_format:"%Y-%m-%d %T"}{/if}</td>
<td>{if $row.active_on}{$row.active_on|crmDate}{/if}</td>
<td>{if $row.expire_on}{$row.expire_on|crmDate}{/if}</td>
<td>{if $row.html_type eq "Text"}{$row.price|crmMoney}{else}<a class="action-item" href="{crmURL p="civicrm/admin/price/field/option" q="action=browse&reset=1&sid=$sid&fid=$fid"}">{if $isReserved}{ts}View Price Options{/ts}{else}{ts}Edit Price Options{/ts}{/if}</a>{/if}</td>
{if $getTaxDetails}
<td>{if $row.tax_rate != '' && $row.html_type eq "Text / Numeric Quantity"}
......
......@@ -174,7 +174,8 @@
<comment>If non-zero, do not show this field before the date specified</comment>
<add>1.8</add>
<html>
<type>CheckBox</type>
<type>Select Date</type>
<formatType>activityDateTime</formatType>
</html>
</field>
<field>
......@@ -186,6 +187,7 @@
<add>1.8</add>
<html>
<type>Select Date</type>
<formatType>activityDateTime</formatType>
</html>
</field>
<field>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment