Commit 6a71ce92 authored by m.stenta's avatar m.stenta
Browse files

If only one log is selected for rescheduling, default to showing its timestamp.

parent 5ce55492
......@@ -472,13 +472,26 @@ function log_reschedule_action_form($context, $form_state) {
}
// Default timestamp to today.
$timestamp = REQUEST_TIME;
// If only one log item is selected, use it's timestamp as the default.
if (!empty($logs) && count($logs) == 1) {
$log_id = reset($form_state['selection']);
$log = log_load($log_id);
$timestamp = $log->timestamp;
}
// Convert the timestamp to the format Date API expects.
$default_value = date('Y-m-d H:i', $timestamp);
// "Date" field
$form['timestamp'] = array(
'#type' => 'date_select',
'#title' => t('Date'),
'#date_format' => 'M j Y',
'#date_type' => DATE_FORMAT_UNIX,
'#date_year_range' => '-10:+3',
'#default_value' => REQUEST_TIME,
'#default_value' => $default_value,
'#required' => TRUE,
);
......
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