New: Add option AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS to
automatically set end date of event to start date + delta on creation page.
This commit is contained in:
parent
a0543d1752
commit
b94d913440
@ -547,6 +547,10 @@ if ($action == 'create')
|
||||
// Date end
|
||||
$datef=($datef?$datef:$object->datef);
|
||||
if (GETPOST('datef','int',1)) $datef=dol_stringtotime(GETPOST('datef','int',1),0);
|
||||
if (empty($datef) && ! empty($datep) && ! empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS))
|
||||
{
|
||||
$datef=dol_time_plus_duree($datep, $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS, 'h');
|
||||
}
|
||||
print '<tr><td><span id="dateend"'.(GETPOST("actioncode") == 'AC_RDV'?' class="fieldrequired"':'').'>'.$langs->trans("DateActionEnd").'</span></td><td>';
|
||||
if (GETPOST("afaire") == 1) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
else if (GETPOST("afaire") == 2) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
|
||||
@ -131,12 +131,13 @@ function getServerTimeZoneInt($refgmtdate='now')
|
||||
*
|
||||
* @param int $time Date timestamp (or string with format YYYY-MM-DD)
|
||||
* @param int $duration_value Value of delay to add
|
||||
* @param int $duration_unit Unit of added delay (d, m, y, w)
|
||||
* @param int $duration_unit Unit of added delay (d, m, y, w, h)
|
||||
* @return int New timestamp
|
||||
*/
|
||||
function dol_time_plus_duree($time,$duration_value,$duration_unit)
|
||||
{
|
||||
if ($duration_value == 0) return $time;
|
||||
if ($duration_unit == 'h') return $time + (3600*$duration_value);
|
||||
if ($duration_unit == 'w') return $time + (3600*24*7*$duration_value);
|
||||
if ($duration_value > 0) $deltastring="+".abs($duration_value);
|
||||
if ($duration_value < 0) $deltastring="-".abs($duration_value);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user