mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-28 00:04:31 +02:00
#335 fix email template editing
This commit is contained in:
parent
b283748c42
commit
c3d1637615
@ -24,7 +24,7 @@ use Respect\Validation\Validator as DataValidator;
|
|||||||
* @apiUse INVALID_SUBJECT
|
* @apiUse INVALID_SUBJECT
|
||||||
* @apiUse INVALID_BODY
|
* @apiUse INVALID_BODY
|
||||||
*
|
*
|
||||||
* @apiSuccess {Object} data Empty object
|
* @apiSuccess {Object} data Empty object
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -60,18 +60,16 @@ class EditMailTemplateController extends Controller {
|
|||||||
$language = Controller::request('language');
|
$language = Controller::request('language');
|
||||||
$templateType = Controller::request('templateType');
|
$templateType = Controller::request('templateType');
|
||||||
$subject = Controller::request('subject', true);
|
$subject = Controller::request('subject', true);
|
||||||
$body = Controller::request('body', true);
|
$body = Controller::request('body');
|
||||||
|
|
||||||
$mailTemplate = MailTemplate::findOne(' language = ? AND type = ?', [$language, $templateType]);
|
$mailTemplate = MailTemplate::findOne(' language = ? AND type = ?', [$language, $templateType]);
|
||||||
if($mailTemplate->isNull()) {
|
if($mailTemplate->isNull()) {
|
||||||
Response::respondError(ERRORS::INVALID_TEMPLATE);
|
throw new Exception(ERRORS::INVALID_TEMPLATE);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
$mailTemplate->subject = $subject;
|
$mailTemplate->subject = $subject;
|
||||||
$mailTemplate->body = $body;
|
$mailTemplate->body = $body;
|
||||||
$mailTemplate->store();
|
$mailTemplate->store();
|
||||||
|
|
||||||
Response::respondSuccess();
|
Response::respondSuccess();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user