Fix issues with freebusy (Web, busyOffHours)

pull/73/merge
Francis Lachapelle 2015-03-17 15:31:35 -04:00
parent beb57707e8
commit 1d5ae27c99
3 changed files with 19 additions and 7 deletions

2
NEWS
View File

@ -14,6 +14,8 @@ Bug fixes
- use correct mail attachment elements for EAS 2.5 clients
- fixed contacts lookup by UID in freebusy
- reduced telephone number to a single value in JSON response of contacts list
- fixed freebusy data when 'busy off hours' is enabled and period starts during the weekend
- fixed fetching of freebusy data from the Web interface
2.2.16 (2015-02-12)
-------------------

View File

@ -381,8 +381,7 @@
([currentStartDate compare: startDate] == NSOrderedAscending)? startDate : currentStartDate, @"startDate",
currentEndDate, @"endDate", nil]];
if (!firstRange
&& currentEndDate != endDate
if (currentEndDate != endDate
&& ([currentEndDate dayOfWeek] == 6 || [currentEndDate dayOfWeek] == 0))
{
// Fill weekend days

View File

@ -917,6 +917,7 @@ _freeBusyCacheEntry.prototype = {
fetchDates = [];
if (adjustedSd.getTime() < this.startDate.getTime()) {
// Period extends to before current start
var start = adjustedSd.clone();
start.addDays(-7);
var end = this.startDate.beginOfDay();
@ -928,35 +929,45 @@ _freeBusyCacheEntry.prototype = {
var nextDate = this.startDate.clone();
nextDate.addDays(currentNbrDays);
if (adjustedEd.getTime() >= nextDate.getTime()) {
var end = nextDate.clone();
// Period extends to after current end
var end = adjustedEd.clone();
end.addDays(7);
fetchDates.push({ start: nextDate, end: end });
}
}
else {
// Initial range
var start = adjustedSd.clone();
start.addDays(-7);
var end = adjustedEd.clone();
end.addDays(7);
fetchDates = [ { start: start, end: end } ];
}
return fetchDates;
},
integrateEntries: function fBCE_integrateEntries(entries, start, end) {
var days, merged = false;
if (this.startDate) {
if (start.getTime() < this.startDate) {
var days = start.deltaDays(this.startDate);
days = start.deltaDays(this.startDate);
if (entries.length == (days * 96)) {
// New period is just before previous period
this.startDate = start;
this.entries = entries.concat(this.entries);
merged = true;
}
}
else {
this.entries = this.entries.concat(entries);
days = this.startDate.deltaDays(start);
if (this.entries.length == (days * 96)) {
// New period is just after previous period
this.entries = this.entries.concat(entries);
merged = true;
}
}
} else {
}
if (!merged) {
this.startDate = start;
this.entries = entries;
}