Commit c38a7f6b authored by colemanw's avatar colemanw

#561 - Convert campaign form date fields

parent 9360fd2c
......@@ -136,18 +136,8 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form {
public function setDefaultValues() {
$defaults = $this->_values;
if (isset($defaults['start_date'])) {
list($defaults['start_date'], $defaults['start_date_time'])
= CRM_Utils_Date::setDateDefaults($defaults['start_date'], 'activityDateTime');
}
else {
list($defaults['start_date'], $defaults['start_date_time'])
= CRM_Utils_Date::setDateDefaults();
}
if (isset($defaults['end_date'])) {
list($defaults['end_date'], $defaults['end_date_time'])
= CRM_Utils_Date::setDateDefaults($defaults['end_date'], 'activityDateTime');
if (empty($defaults['start_date'])) {
$defaults['start_date'] = date('Y-m-d H:i:s');
}
if (!isset($defaults['is_active'])) {
......@@ -208,10 +198,10 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form {
$this->add('textarea', 'description', ts('Description'), $attributes['description']);
// add campaign start date
$this->addDateTime('start_date', ts('Start Date'), TRUE, array('formatType' => 'activityDateTime'));
$this->add('datepicker', 'start_date', ts('Start Date'), [], TRUE);
// add campaign end date
$this->addDateTime('end_date', ts('End Date'), FALSE, array('formatType' => 'activityDateTime'));
$this->add('datepicker', 'end_date', ts('End Date'));
// add campaign type
$this->addSelect('campaign_type_id', array('onChange' => "CRM.buildCustomData( 'Campaign', this.value );"), TRUE);
......@@ -313,8 +303,6 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form {
$params['created_date'] = date('YmdHis');
}
// format params
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time']);
$params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], TRUE);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['last_modified_id'] = $session->get('userID');
$params['last_modified_date'] = date('YmdHis');
......
......@@ -58,12 +58,11 @@
</tr>
<tr class="crm-campaign-form-block-start_date">
<td class="label">{$form.start_date.label}</td>
<td class="view-value">{include file="CRM/common/jcalendar.tpl" elementName=start_date}
</td>
<td class="view-value">{$form.start_date.html}</td>
</tr>
<tr class="crm-campaign-form-block-end_date">
<td class="label">{$form.end_date.label}</td>
<td class="view-value">{include file="CRM/common/jcalendar.tpl" elementName=end_date}</td>
<td class="view-value">{$form.end_date.html}</td>
</tr>
<tr class="crm-campaign-form-block-status_id">
<td class="label">{$form.status_id.label}</td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment