Fix whole day event checkbox lost the default alarm, change 24 hours label to 1 days

This commit is contained in:
nathangray 2018-05-15 09:47:10 -06:00
parent 5682044227
commit 6eb3ca2592
2 changed files with 10 additions and 5 deletions

View File

@ -338,7 +338,7 @@ class calendar_uiforms extends calendar_ui
{ {
$content['alarm'][1]['offset'] = $offset = 60 * $def_alarm; $content['alarm'][1]['offset'] = $offset = 60 * $def_alarm;
$content['start'] = $this->bo->date2array($content['start']); $content['start'] = $this->bo->date2array($content['start']);
$content['start'][1]['offset'] = $this->bo->date2ts($content['start']) - $offset; $content['start'][1]['time'] = $this->bo->date2ts($content['start']) - $offset;
$content['start'] = $this->bo->date2ts($content['start']); $content['start'] = $this->bo->date2ts($content['start']);
} }
} }

View File

@ -2710,7 +2710,8 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
/** /**
* Set alarm options based on WD/Regular event user preferences * Set alarm options based on WD/Regular event user preferences
* Gets fired by wholeday checkbox * Gets fired by wholeday checkbox. This is mainly for display purposes,
* the default alarm is calculated on the server as well.
* *
* @param {egw object} _egw * @param {egw object} _egw
* @param {widget object} _widget whole_day checkbox * @param {widget object} _widget whole_day checkbox
@ -2728,14 +2729,18 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
var _secs_to_label = function (_secs) var _secs_to_label = function (_secs)
{ {
var label=''; var label='';
if (_secs <= 3600) if (_secs < 3600)
{ {
label = self.egw.lang('%1 minutes', _secs/60); label = self.egw.lang('%1 minutes', _secs/60);
} }
else if(_secs <= 86400) else if(_secs < 86400)
{ {
label = self.egw.lang('%1 hours', _secs/3600); label = self.egw.lang('%1 hours', _secs/3600);
} }
else
{
label = self.egw.lang('%1 days', _secs/(3600*24));
}
return label; return label;
}; };
if (typeof content['alarm'][1]['default'] == 'undefined') if (typeof content['alarm'][1]['default'] == 'undefined')
@ -2756,7 +2761,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
start.set_hours(0); start.set_hours(0);
start.set_minutes(0); start.set_minutes(0);
time.set_value(start.get_value()); time.set_value(start.get_value());
time.set_value('-'+(60 * def_alarm)); time.set_value(new Date(new Date(start.get_value()).valueOf() - (60*def_alarm*1000)).toJSON());
event.set_value(_secs_to_label(60 * def_alarm)); event.set_value(_secs_to_label(60 * def_alarm));
} }
} }