fix: [internal] Deleting events

pull/7855/head
Jakub Onderka 2021-10-18 13:55:47 +02:00
parent 934fa326f9
commit bbb21571bf
2 changed files with 5 additions and 5 deletions

View File

@ -2609,8 +2609,7 @@ class EventsController extends AppController
foreach ($idList as $eid) {
$event = $this->Event->find('first', array(
'conditions' => Validation::uuid($eid) ? ['Event.uuid' => $eid] : ['Event.id' => $eid],
'fields' => array('Event.orgc_id', 'Event.id', 'Event.user_id'),
'recursive' => -1
'recursive' => -1,
));
if (empty($event)) {
$fails[] = $eid; // event not found

View File

@ -1351,9 +1351,9 @@ class Event extends AppModel
return $data;
}
public function quickDelete($event)
public function quickDelete(array $event)
{
$id = $event['Event']['id'];
$id = (int)$event['Event']['id'];
$this->Thread = ClassRegistry::init('Thread');
$thread = $this->Thread->find('first', array(
'conditions' => array('Thread.event_id' => $id),
@ -1440,7 +1440,8 @@ class Event extends AppModel
foreach ($relations as $relation) {
$queryTool->quickDelete($relation['table'], $relation['foreign_key'], $relation['value'], $this);
}
return $this->delete($id, false);
$this->set($event);
return $this->delete(null, false);
}
public function createEventConditions($user)