Calendar - fix some bugs in readonly mode:

- missing participant widget would fail
- read-only end date would cause error
This commit is contained in:
nathangray 2017-11-03 14:38:51 -06:00
parent df4f4deb1f
commit 5da12be8e8

View File

@ -1072,7 +1072,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
if(widget) if(widget)
{ {
var recur_end = widget.getRoot().getWidgetById('recur_enddate'); var recur_end = widget.getRoot().getWidgetById('recur_enddate');
if(recur_end && !recur_end.getValue()) if(recur_end && recur_end.getValue && !recur_end.getValue())
{ {
recur_end.set_min(widget.getValue()); recur_end.set_min(widget.getValue());
} }
@ -1121,6 +1121,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
if(typeof widget === 'undefined') widget = input; if(typeof widget === 'undefined') widget = input;
var content = widget.getInstanceManager().getValues(widget.getRoot()); var content = widget.getInstanceManager().getValues(widget.getRoot());
var participant = widget.getRoot().getWidgetById('participant'); var participant = widget.getRoot().getWidgetById('participant');
if(!participant) return;
participant.set_autocomplete_params({exec:{ participant.set_autocomplete_params({exec:{
start: content.start, start: content.start,
@ -2281,7 +2282,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
egw.dataGetUIDdata(widget.day_widgets[day].registeredUID).data egw.dataGetUIDdata(widget.day_widgets[day].registeredUID).data
); );
} }
// Hide loader // Hide loader
widget.loader.hide(); widget.loader.hide();
row_index++; row_index++;
@ -3035,7 +3036,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
start: typeof record.data.start === 'string' ? record.data.start : record.data.start.toJSON(), start: typeof record.data.start === 'string' ? record.data.start : record.data.start.toJSON(),
end: typeof record.data.end === 'string' ? record.data.end : record.data.end.toJSON() end: typeof record.data.end === 'string' ? record.data.end : record.data.end.toJSON()
}; };
if(dates.start.substr(0,10) !== dates.end.substr(0,10) && if(dates.start.substr(0,10) !== dates.end.substr(0,10) &&
// Avoid events ending at midnight having a 0 length event the next day // Avoid events ending at midnight having a 0 length event the next day
dates.end.substr(11,8) !== '00:00:00') dates.end.substr(11,8) !== '00:00:00')
{ {