Reset alarms when updating an event + codestyle
This commit is contained in:
parent
ab3801d67f
commit
8f40a3bdeb
1 changed files with 25 additions and 15 deletions
|
@ -219,20 +219,30 @@ class kolab_calendar
|
||||||
|
|
||||||
public function update_event($event)
|
public function update_event($event)
|
||||||
{
|
{
|
||||||
$updated = false;
|
$updated = false;
|
||||||
$old = $this->storage->getObject($event['id']);
|
$old = $this->storage->getObject($event['id']);
|
||||||
$object = array_merge($old, $this->_from_rcube_event($event));
|
$object = array_merge($old, $this->_from_rcube_event($event));
|
||||||
$saved = $this->storage->save($object, $event['id']);
|
$saved = $this->storage->save($object, $event['id']);
|
||||||
if (PEAR::isError($saved)) {
|
|
||||||
raise_error(array(
|
if (PEAR::isError($saved)) {
|
||||||
'code' => 600, 'type' => 'php',
|
raise_error(array(
|
||||||
'file' => __FILE__, 'line' => __LINE__,
|
'code' => 600, 'type' => 'php',
|
||||||
'message' => "Error saving contact object to Kolab server:" . $saved->getMessage()),
|
'file' => __FILE__, 'line' => __LINE__,
|
||||||
true, false);
|
'message' => "Error saving contact object to Kolab server:" . $saved->getMessage()),
|
||||||
}
|
true, false);
|
||||||
else {
|
}
|
||||||
$updated = true;
|
else {
|
||||||
}
|
$updated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete alarm settings in local database
|
||||||
|
if ($updated && ($old['alarm'] != $object['alarm'] || $old['start-date'] != $object['start-date'])) {
|
||||||
|
$query = $this->cal->rc->db->query(
|
||||||
|
"DELETE FROM kolab_alarms
|
||||||
|
WHERE event_id=?",
|
||||||
|
$event['id']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return $updated;
|
return $updated;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue