From: Coleman Watts Date: Tue, 8 Jan 2019 17:08:39 +0000 (-0500) Subject: dev/core#561 - Convert campaign form date fields X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c38a7f6bcd9220e2097365d4cccc46620557206d;p=civicrm-core.git dev/core#561 - Convert campaign form date fields --- diff --git a/CRM/Campaign/Form/Campaign.php b/CRM/Campaign/Form/Campaign.php index 8b655775de..f94cb29a63 100644 --- a/CRM/Campaign/Form/Campaign.php +++ b/CRM/Campaign/Form/Campaign.php @@ -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'); diff --git a/templates/CRM/Campaign/Form/Campaign.tpl b/templates/CRM/Campaign/Form/Campaign.tpl index ce8ed37f6a..c9d576d166 100644 --- a/templates/CRM/Campaign/Form/Campaign.tpl +++ b/templates/CRM/Campaign/Form/Campaign.tpl @@ -58,12 +58,11 @@ {$form.start_date.label} - {include file="CRM/common/jcalendar.tpl" elementName=start_date} - + {$form.start_date.html} {$form.end_date.label} - {include file="CRM/common/jcalendar.tpl" elementName=end_date} + {$form.end_date.html} {$form.status_id.label}