| @@ -1,43 +1,0 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace AcyMailing\Controllers\Mails; | |
| 4 | - | |
| 5 | -use AcyMailing\Classes\MailClass; | |
| 6 | - | |
| 7 | -trait Automation | |
| 8 | -{ | |
| 9 | - public function deleteMailAutomation(): void | |
| 10 | - { | |
| 11 | - $mailClass = new MailClass(); | |
| 12 | - $mailId = acym_getVar('int', 'id', 0); | |
| 13 | - | |
| 14 | - if (!empty($mailId)) { | |
| 15 | - $mailClass->delete($mailId); | |
| 16 | - } | |
| 17 | - | |
| 18 | - exit; | |
| 19 | - } | |
| 20 | - | |
| 21 | - public function duplicateMailAutomation(): void | |
| 22 | - { | |
| 23 | - $mailClass = new MailClass(); | |
| 24 | - $mailId = acym_getVar('int', 'id', 0); | |
| 25 | - $prevMail = acym_getVar('int', 'previousId'); | |
| 26 | - | |
| 27 | - if (!empty($prevMail)) { | |
| 28 | - $mailClass->delete($prevMail); | |
| 29 | - } | |
| 30 | - | |
| 31 | - if (empty($mailId)) { | |
| 32 | - acym_sendAjaxResponse(acym_translationSprintf('ACYM_NOT_FOUND', acym_translation('ACYM_ID')), [], false); | |
| 33 | - } | |
| 34 | - | |
| 35 | - $newMail = $mailClass->duplicateMail($mailId, MailClass::TYPE_AUTOMATION); | |
| 36 | - | |
| 37 | - if (empty($newMail)) { | |
| 38 | - acym_sendAjaxResponse(acym_translation('ACYM_COULD_NOT_DUPLICATE_EMAIL'), [], false); | |
| 39 | - } | |
| 40 | - | |
| 41 | - acym_sendAjaxResponse('', ['newMail' => $newMail]); | |
| 42 | - } | |
| 43 | -} | |