Skip to content
Snippets Groups Projects
Commit 5b05764e authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #12560 TIME 0:10 added check on document

parent 2727e384
No related branches found
No related tags found
No related merge requests found
...@@ -93,13 +93,15 @@ class EmailController ...@@ -93,13 +93,15 @@ class EmailController
'info' => _EMAIL_ADDED 'info' => _EMAIL_ADDED
]); ]);
HistoryController::add([ if (!empty($args['data']['document']['id'])) {
'tableName' => 'res_letterbox', HistoryController::add([
'recordId' => $args['data']['document']['id'], 'tableName' => 'res_letterbox',
'eventType' => 'ADD', 'recordId' => $args['data']['document']['id'],
'eventId' => 'emailCreation', 'eventType' => 'ADD',
'info' => _EMAIL_ADDED 'eventId' => 'emailCreation',
]); 'info' => _EMAIL_ADDED
]);
}
$isSent = ['success' => 'success']; $isSent = ['success' => 'success'];
if ($args['data']['status'] != 'DRAFT') { if ($args['data']['status'] != 'DRAFT') {
...@@ -207,13 +209,15 @@ class EmailController ...@@ -207,13 +209,15 @@ class EmailController
'info' => _EMAIL_UPDATED 'info' => _EMAIL_UPDATED
]); ]);
HistoryController::add([ if (!empty($args['data']['document']['id'])) {
'tableName' => 'res_letterbox', HistoryController::add([
'recordId' => $args['data']['document']['id'], 'tableName' => 'res_letterbox',
'eventType' => 'UP', 'recordId' => $args['data']['document']['id'],
'eventId' => 'emailModification', 'eventType' => 'UP',
'info' => _EMAIL_UPDATED 'eventId' => 'emailModification',
]); 'info' => _EMAIL_UPDATED
]);
}
if ($body['status'] != 'DRAFT') { if ($body['status'] != 'DRAFT') {
$customId = CoreConfigModel::getCustomId(); $customId = CoreConfigModel::getCustomId();
...@@ -250,15 +254,17 @@ class EmailController ...@@ -250,15 +254,17 @@ class EmailController
'info' => _EMAIL_REMOVED 'info' => _EMAIL_REMOVED
]); ]);
$document = (array)json_decode($email['document']); if (!empty($email['data']['document'])) {
$document = (array)json_decode($email['document']);
HistoryController::add([ HistoryController::add([
'tableName' => 'res_letterbox', 'tableName' => 'res_letterbox',
'recordId' => $document['id'], 'recordId' => $document['id'],
'eventType' => 'DEL', 'eventType' => 'DEL',
'eventId' => 'emailDeletion', 'eventId' => 'emailDeletion',
'info' => _EMAIL_REMOVED 'info' => _EMAIL_REMOVED
]); ]);
}
return $response->withStatus(204); return $response->withStatus(204);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment