'api' => array('params' => array('is_deceased' => 0)),
),
),
+ 'activity_date_time' => array(
+ 'type' => 'datepicker',
+ 'label' => ts('Date'),
+ 'required' => TRUE,
+ ),
'followup_assignee_contact_id' => array(
'type' => 'entityRef',
'label' => ts('Assigned to'),
$defaults = $this->_values + CRM_Core_Form_RecurringEntity::setDefaultValues();
// if we're editing...
if (isset($this->_activityId)) {
- if (empty($defaults['activity_date_time'])) {
- list($defaults['activity_date_time'], $defaults['activity_date_time_time']) = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime');
- }
- elseif ($this->_action & CRM_Core_Action::UPDATE) {
- $this->assign('current_activity_date_time', $defaults['activity_date_time']);
- list($defaults['activity_date_time'],
- $defaults['activity_date_time_time']
- ) = CRM_Utils_Date::setDateDefaults($defaults['activity_date_time'], 'activityDateTime');
- list($defaults['repetition_start_date'], $defaults['repetition_start_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['activity_date_time'], 'activityDateTime');
- }
if ($this->_context != 'standalone') {
$this->assign('target_contact_value',
$defaults['source_contact_id'] = $this->_sourceContactId;
$defaults['target_contact_id'] = $this->_targetContactId;
+ }
- list($defaults['activity_date_time'], $defaults['activity_date_time_time'])
- = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime');
+ if (empty($defaults['activity_date_time'])) {
+ $defaults['activity_date_time'] = date('Y-m-d H:i:s');
}
if ($this->_activityTypeId) {
$this->addRule('duration',
ts('Please enter the duration as number of minutes (integers only).'), 'positiveInteger'
);
- $this->addDateTime('activity_date_time', ts('Date'), TRUE, array('formatType' => 'activityDateTime'));
// Add followup date.
$this->addDateTime('followup_date', ts('in'), FALSE, array('formatType' => 'activityDateTime'));
);
}
- // store the date with proper format
- $params['activity_date_time'] = CRM_Utils_Date::processDate($params['activity_date_time'], $params['activity_date_time_time']);
-
// format params as arrays
foreach (array('target', 'assignee', 'followup_assignee') as $name) {
if (!empty($params["{$name}_contact_id"])) {
$this->assign('urlPath', 'civicrm/case/activity');
$encounterMediums = CRM_Case_PseudoConstant::encounterMedium();
- // Fixme: what's the justification for this? It seems like it is just re-adding an option in case it is the default and disabled.
- // Is that really a big problem?
if ($this->_activityTypeFile == 'OpenCase') {
- $this->_encounterMedium = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId,
- 'medium_id'
- );
+ if ($this->_action == CRM_Core_Action::UPDATE) {
+ $this->getElement('activity_date_time')->freeze();
+ }
+ // Fixme: what's the justification for this? It seems like it is just re-adding an option in case it is the default and disabled.
+ // Is that really a big problem?
+ $this->_encounterMedium = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'medium_id');
if (!array_key_exists($this->_encounterMedium, $encounterMediums)) {
$encounterMediums[$this->_encounterMedium] = CRM_Core_OptionGroup::getLabel('encounter_medium',
$this->_encounterMedium,
</tr>
<tr class="crm-case-activity-form-block-activity_date_time">
<td class="label">{$form.activity_date_time.label}</td>
- {if $action eq 2 && $activityTypeFile eq 'OpenCase'}
- <td class="view-value">{$current_activity_date_time|crmDate}
- <div class="description">Use a <a href="{$changeStartURL}">Change Start Date</a> activity to change the date</div>
- {* avoid errors about missing field *}
- <div style="display: none;">{include file="CRM/common/jcalendar.tpl" elementName=activity_date_time}</div>
- </td>
- {else}
- <td class="view-value">{include file="CRM/common/jcalendar.tpl" elementName=activity_date_time}</td>
- {/if}
+ <td class="view-value">
+ {$form.activity_date_time.html}
+ {if $action eq 2 && $activityTypeFile eq 'OpenCase'}
+ <div class="description">Use a <a class="open-inline" href="{$changeStartURL}">Change Start Date</a> activity to change the date</div>
+ {/if}
+ </td>
</tr>
{if $action eq 2 && $activityTypeFile eq 'OpenCase'}
<tr class="crm-case-activity-form-block-details">