mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-09-29 09:00:31 +00:00
(feat) warn when double-booking attendees and offer force save option
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
/* UIxAppointmentActions.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Copyright (C) 2010-2016 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* UIxAppointmentActions.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2014 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Copyright (C) 2011-2016 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -69,6 +67,7 @@
|
||||
NSException *ex;
|
||||
SOGoAppointmentFolder *targetCalendar, *sourceCalendar;
|
||||
SOGoAppointmentFolders *folders;
|
||||
BOOL forceSave;
|
||||
|
||||
rq = [context request];
|
||||
params = [[rq contentAsString] objectFromJSONString];
|
||||
@@ -77,6 +76,7 @@
|
||||
startDelta = [params objectForKey: @"start"];
|
||||
durationDelta = [params objectForKey: @"duration"];
|
||||
destionationCalendar = [params objectForKey: @"destination"];
|
||||
forceSave = NO;
|
||||
|
||||
if (daysDelta || startDelta || durationDelta)
|
||||
{
|
||||
@@ -120,7 +120,8 @@
|
||||
[event updateRecurrenceRulesUntilDate: end];
|
||||
|
||||
[event setLastModified: [NSCalendarDate calendarDate]];
|
||||
ex = [co saveComponent: event];
|
||||
ex = [co saveComponent: event force: forceSave];
|
||||
|
||||
// This condition will be executed only if the event is moved from a calendar to another. If destionationCalendar == 0; there is no calendar change
|
||||
if ([destionationCalendar length] > 0)
|
||||
{
|
||||
@@ -139,12 +140,21 @@
|
||||
ex = [co moveToFolder: targetCalendar];
|
||||
}
|
||||
}
|
||||
|
||||
if (ex)
|
||||
{
|
||||
unsigned int httpStatus;
|
||||
|
||||
httpStatus = 500;
|
||||
|
||||
if ([ex respondsToSelect: @selector(httpStatus)])
|
||||
httpStatus = [ex httpStatus];
|
||||
|
||||
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[ex reason], @"message",
|
||||
[ex reason], @"message",
|
||||
nil];
|
||||
response = [self responseWithStatus: 403
|
||||
|
||||
response = [self responseWithStatus: httpStatus
|
||||
andJSONRepresentation: jsonResponse];
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* UIxAppointmentEditor.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007-2015 Inverse inc.
|
||||
* Copyright (C) 2007-2016 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* UIxAppointmentEditor.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007-2015 Inverse inc.
|
||||
* Copyright (C) 2007-2016 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -467,7 +467,9 @@
|
||||
SOGoAppointmentObject *co;
|
||||
SoSecurityManager *sm;
|
||||
WORequest *request;
|
||||
|
||||
unsigned int httpStatus;
|
||||
BOOL forceSave;
|
||||
|
||||
event = [self event];
|
||||
co = [self clientObject];
|
||||
@@ -488,6 +490,7 @@
|
||||
else
|
||||
{
|
||||
[self setAttributes: params];
|
||||
forceSave = NO;
|
||||
|
||||
if ([event hasRecurrenceRules])
|
||||
[self _adjustRecurrentRules];
|
||||
@@ -511,12 +514,12 @@
|
||||
}
|
||||
|
||||
// Save the event.
|
||||
ex = [co saveComponent: event];
|
||||
ex = [co saveComponent: event force: forceSave];
|
||||
}
|
||||
else
|
||||
{
|
||||
// The event was modified -- save it.
|
||||
ex = [co saveComponent: event];
|
||||
ex = [co saveComponent: event force: forceSave];
|
||||
|
||||
if (componentCalendar
|
||||
&& ![[componentCalendar ocsPath]
|
||||
@@ -539,9 +542,12 @@
|
||||
if (ex)
|
||||
{
|
||||
httpStatus = 500;
|
||||
|
||||
if ([ex respondsToSelect: @selector(httpStatus)])
|
||||
httpStatus = [ex httpStatus];
|
||||
|
||||
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"failure", @"status",
|
||||
[ex reason], @"message",
|
||||
[ex reason], @"message",
|
||||
nil];
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user