Assignments: Set expiry date to 1 week from now and end date to 1 week + 1 day from now - see #1646

remotes/angel/1.11.x
Yannick Warnier 8 years ago
parent 13b985f6f9
commit 4afa7c5d3b
  1. 9
      main/work/work.lib.php

@ -4587,9 +4587,10 @@ function getFormWork($form, $defaults = array(), $workId = 0)
$form->addHtml('<div id="option2" style="display: none;">');
}
$currentDate = substr(api_get_local_time(), 0, 10);
$timeNextWeek = time()+86400*7;
$nextWeek = substr(api_get_local_time($timeNextWeek), 0, 10);
if (!isset($defaults['expires_on'])) {
$date = substr($currentDate, 0, 10);
$date = substr($nextWeek, 0, 10);
$defaults['expires_on'] = $date.' 23:59';
}
@ -4598,8 +4599,8 @@ function getFormWork($form, $defaults = array(), $workId = 0)
$form->addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'id="end_date"');
if (!isset($defaults['ends_on'])) {
$tomorrow = substr(api_get_local_time(time()+86400), 0, 10);
$date = substr($tomorrow, 0, 10);
$nextDay = substr(api_get_local_time($timeNextWeek+86400), 0, 10);
$date = substr($nextDay, 0, 10);
$defaults['ends_on'] = $date.' 23:59';
}
if (isset($defaults['enableEndDate']) && $defaults['enableEndDate']) {

Loading…
Cancel
Save