Skip to content
Snippets Groups Projects
Commit 3144fe91 authored by Anton Bagliy's avatar Anton Bagliy
Browse files

FIX: stop sending emails when requests fail #379

parent 2020876d
Branches
No related merge requests found
......@@ -41,16 +41,26 @@ class Controller_Handler_RequestsProcessing extends Controller_Handler {
}
}
$subject = "Request {$ticket}: rating system report";
if ($ticket === -1) {
Log::instance()->add(Log::ERROR, '{0} failed to send request: user={1} topic="{2}", {3}', array(
'{0}' => 'CREATE_REQUEST',
'{1}' => $this->user->ID,
'{2}' => $title,
'{3}' => $text,
));
} else {
$subject = "Request {$ticket}: rating system report";
$message = Twig::factory('handler/report', [
'Title' => $title,
'Text' => $text,
'User' => $this->user,
])->render();
$message = Twig::factory('handler/report', [
'Title' => $title,
'Text' => $text,
'User' => $this->user,
])->render();
$replyToName = $this->user->LastName.' '.$this->user->FirstName.' ('.$this->user->FacultyName.')';
SendMail::send($subject, $message, $to, $to, $this->user->EMail, $replyToName);
$replyToName = $this->user->LastName . ' ' . $this->user->FirstName . ' (' . $this->user->FacultyName . ')';
SendMail::send($subject, $message, $to, $to, $this->user->EMail, $replyToName);
}
$data['success'] = ($ticket > 0);
$this->response->body(json_encode($data));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment