diff --git a/.github/dev_bug_report.md b/.github/dev_bug_report.md deleted file mode 100644 index ef93e56..0000000 --- a/.github/dev_bug_report.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Dev Bug Report -about: Create a report to help us improve -title: '' -labels: stat_backlog, type_bug -assignees: '' - ---- - -# Bug Description -A clear and concise description of what the bug is. - -# How to Reproduce - -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -## Minimal Code Example - -``` -// your code ... -``` - -# Expected Behavior -A clear and concise description of what you expected to happen. - -# Screenshots -If applicable, add screenshots to help explain your problem. - -# Additional Information -Add any other context about the problem here. diff --git a/.github/dev_feature_request.md b/.github/dev_feature_request.md deleted file mode 100644 index 9573c35..0000000 --- a/.github/dev_feature_request.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Dev Feature Request -about: Suggest an idea for this project -title: '' -labels: stat_backlog, type_feature -assignees: '' - ---- - -# What is the feature you request -* A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -* A clear and concise description of what you want to happen. - -# Alternatives -A clear and concise description of any alternative solutions or features you've considered. - -# Additional Information -Add any other context or screenshots about the feature request here. diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 6b82bb1..a670532 100755 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -19,7 +19,7 @@ "type": 2, "subtype": 1, "name": "Tickets", - "uri": "{/base}/support/list", + "uri": "{/base}/support/list?{?}", "target": "self", "icon": null, "order": 1, @@ -33,7 +33,7 @@ "type": 3, "subtype": 1, "name": "List", - "uri": "{/base}/support/list", + "uri": "{/base}/support/list?{?}", "target": "self", "icon": null, "order": 1, diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 3f86957..35aabfe 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -161,16 +161,6 @@ final class ApiController extends Controller $handler = $this->app->moduleManager->get('Admin', 'Api')->setUpServerMailHandler(); - /** @var \Model\Setting $emailFrom */ - $emailFrom = $this->app->appSettings->get( - names: AdminSettingsEnum::MAIL_SERVER_ADDR, - module: 'Admin' - ); - - if (empty($emailFrom->content)) { - return; - } - /** @var \Model\Setting $billingTemplate */ $supportTemplate = $this->app->appSettings->get( names: SettingsEnum::SUPPORT_EMAIL_TEMPLATE, @@ -183,36 +173,43 @@ final class ApiController extends Controller ->execute(); $mail = clone $baseEmail; - $mail->setFrom($emailFrom->content); + + $status = false; + if ($mail->id !== 0) { + $status = $this->app->moduleManager->get('Admin', 'Api')->setupEmailDefaults($mail, $this->app->l11nServer->language); + } + $mail->addTo($email); // @todo probably needs to be changed to messageId = \uniqid() . '-' . $ticket->id ?! // Careful, uniqueid is overwritten in the email class, will need check for if empty $mail->addCustomHeader('ticket_id', (string) $ticket->id); - $mailL11n = $baseEmail->getL11nByLanguage($language); - if ($mailL11n->id === 0) { - $mailL11n = $baseEmail->getL11nByLanguage($language = $this->app->l11nServer->language); - } - - if ($mailL11n->id === 0) { - $mailL11n = $baseEmail->getL11nByLanguage($language = 'en'); - } - - $mail->subject = $mailL11n->subject; - $mail->body = $mailL11n->body; - $mail->bodyAlt = $mailL11n->bodyAlt; - $lang = include __DIR__ . '/../../Tasks/Theme/Backend/Lang/' . $language . '.lang.php'; - $mail->template = [ - '{user_name}' => $account->login, - '{ticket_id}' => $ticket->id, - '{ticket_status}' => $lang['Tasks']['S' . $ticket->task->status], - '{ticket_subject}' => $ticket->task->title, - ]; + $mail->template = \array_merge( + $mail->template, + [ + '{user_name}' => $account->login, + '{ticket_id}' => $ticket->id, + '{ticket_status}' => $lang['Tasks']['S' . $ticket->task->status], + '{ticket_subject}' => $ticket->task->title, + ] + ); - $handler->send($mail); + if ($status) { + $status = $handler->send($mail); + } + + if (!$status) { + \phpOMS\Log\FileLogger::getInstance()->error( + \phpOMS\Log\FileLogger::MSG_FULL, [ + 'message' => 'Couldn\'t send mail: ' . $mail->id, + 'line' => __LINE__, + 'file' => self::class, + ] + ); + } } /** diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 77e8a2b..f05c74f 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -76,7 +76,7 @@ final class BackendController extends Controller public function viewSupportList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface { $head = $response->data['Content']->head; - $head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=1.0.0'); + $head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=' . self::VERSION); $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Support/Theme/Backend/support-list'); @@ -261,7 +261,7 @@ final class BackendController extends Controller public function viewPrivateSupportDashboard(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface { $head = $response->data['Content']->head; - $head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=1.0.0'); + $head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=' . self::VERSION); $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Support/Theme/Backend/user-support-dashboard'); diff --git a/Theme/Backend/support-ticket.tpl.php b/Theme/Backend/support-ticket.tpl.php index b85da57..1e05608 100755 --- a/Theme/Backend/support-ticket.tpl.php +++ b/Theme/Backend/support-ticket.tpl.php @@ -106,8 +106,8 @@ echo $this->data['nav']->render(); ?>