diff --git a/CHANGELOG-1.0.md b/CHANGELOG-1.0.md index 24cc679a0..7d0823fb3 100644 --- a/CHANGELOG-1.0.md +++ b/CHANGELOG-1.0.md @@ -3,6 +3,15 @@ CHANGELOG for 1.0.x This changelog references any relevant changes introduced in 1.0 minor versions. +* 1.0.9 (2020-03-17) + * **Misc. Updates:** + * **Added Missing translation** + + * **Bug Fixes:** + * **Issue #285:** No Ticket counts when login as another administrative account. + * **Issue #289:** Error when trying to open Email templates. + * **Issue #288:** Uploading image in branding showing tmp file doesn't exist. + * 1.0.8 (2020-02-12) * **Misc. Updates:** * **#175:** Set default article text color equals to black. diff --git a/Controller/Authentication.php b/Controller/Authentication.php index 48c85091b..2f67c297d 100644 --- a/Controller/Authentication.php +++ b/Controller/Authentication.php @@ -56,12 +56,12 @@ public function forgotPassword(Request $request) ]); $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); - $request->getSession()->getFlashBag()->set('success', 'Please check your mail for password update.'); + $this->addFlash('success', $this->get('translator')->trans('Please check your mail for password update')); return $this->redirect($this->generateUrl('helpdesk_knowledgebase')); } else { - $request->getSession()->getFlashBag()->set('warning', 'This email address is not registered with us.'); + $this->addFlash('warning', $this->get('translator')->trans('This email address is not registered with us')); } } } @@ -75,7 +75,7 @@ public function updateCredentials($email, $verificationCode, Request $request, U $user = $entityManager->getRepository('UVDeskCoreFrameworkBundle:User')->findOneByEmail($email); if (empty($user) || $user->getVerificationCode() != $verificationCode) { - $request->getSession()->getFlashBag()->set('warning', "You have already update password using this link if you wish to change password again click on forget password link here from login page!!"); + $this->addFlash('success', $this->get('translator')->trans('You have already update password using this link if you wish to change password again click on forget password link here from login page')); return $this->redirect($this->generateUrl('helpdesk_knowledgebase')); } @@ -90,11 +90,11 @@ public function updateCredentials($email, $verificationCode, Request $request, U $entityManager->persist($user); $entityManager->flush(); - $request->getSession()->getFlashBag()->set('success', 'Your password has been successfully updated. Login using updated password'); + $this->addFlash('success', $this->get('translator')->trans('Your password has been successfully updated. Login using updated password')); return $this->redirect($this->generateUrl('helpdesk_knowledgebase')); } else { - $request->getSession()->getFlashBag()->set('warning', "Please try again. The passwords do not match."); + $this->addFlash('success', $this->get('translator')->trans('Please try again, The passwords do not match')); } } diff --git a/Controller/Customer.php b/Controller/Customer.php index fffd99152..61ebd2616 100755 --- a/Controller/Customer.php +++ b/Controller/Customer.php @@ -234,13 +234,13 @@ public function bookmarkCustomer(Request $request) $em->persist($userInstance); $em->flush(); $json['alertClass'] = 'success'; - $json['message'] = 'unstarred Action Completed successfully'; + $json['message'] = $this->get('translator')->trans('unstarred Action Completed successfully'); } else { $userInstance->setIsStarred(1); $em->persist($userInstance); $em->flush(); $json['alertClass'] = 'success'; - $json['message'] = 'starred Action Completed successfully'; + $json['message'] = $this->get('translator')->trans('starred Action Completed successfully'); } $response = new Response(json_encode($json)); $response->headers->set('Content-Type', 'application/json'); diff --git a/Controller/CustomerXHR.php b/Controller/CustomerXHR.php index 8a0478179..82f9e3c8e 100644 --- a/Controller/CustomerXHR.php +++ b/Controller/CustomerXHR.php @@ -53,10 +53,10 @@ public function removeCustomerXHR(Request $request) $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); $json['alertClass'] = 'success'; - $json['alertMessage'] = ('Success ! Customer removed successfully.'); + $json['alertMessage'] = $this->get('translator')->trans('Success ! Customer removed successfully.'); } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = ('Error ! Invalid customer id.'); + $json['alertMessage'] = $this->get('translator')->trans('Error ! Invalid customer id.'); $json['statusCode'] = Response::HTTP_NOT_FOUND; } } diff --git a/Controller/Email.php b/Controller/Email.php index 6711ddd19..a6619325e 100755 --- a/Controller/Email.php +++ b/Controller/Email.php @@ -76,9 +76,10 @@ public function templateForm(Request $request) $entityManager->flush(); if ($request->attributes->get('template')) { - $message = 'Success! Template has been updated successfully.'; + $message = $this->get('translator')->trans('Success! Template has been updated successfully.'); } else { - $message = 'Success! Template has been added successfully.'; + $message = $this->get('translator')->trans('Success! Template has been added successfully.'); + } $this->addFlash('success', $message); diff --git a/Controller/EmailSettingsXHR.php b/Controller/EmailSettingsXHR.php index 79a3625a9..31fe0cac7 100644 --- a/Controller/EmailSettingsXHR.php +++ b/Controller/EmailSettingsXHR.php @@ -12,8 +12,17 @@ class EmailSettingsXHR extends Controller public function updateSettingsXHR(Request $request) { $filePath = $this->get('kernel')->getProjectDir() . '/config/packages/uvdesk.yaml'; + $app_locales = 'en|fr|it'; //default app_locales values + + foreach ( file($filePath) as $val) { + $exploded = explode(":", trim($val)); + if($exploded[0] == 'app_locales' && ($app_locales != $exploded[1])) + { + $app_locales = trim($exploded[1]); + } + } + $supportEmailConfiguration = json_decode($request->getContent(), true); - $mailer_id = ( $supportEmailConfiguration['mailer_id'] == 'None Selected' ? '~' : $supportEmailConfiguration['mailer_id'] ); $file_content_array = strtr(require __DIR__ . "/../Templates/uvdesk.php", [ @@ -21,6 +30,7 @@ public function updateSettingsXHR(Request $request) '{{ SUPPORT_EMAIL_NAME }}' => $supportEmailConfiguration['name'], '{{ SUPPORT_EMAIL_MAILER_ID }}' => $mailer_id, '{{ SITE_URL }}' => $this->container->getParameter('uvdesk.site_url'), + '{{ APP_LOCALES }}' => $app_locales, ]); // update uvdesk.yaml file @@ -33,7 +43,7 @@ public function updateSettingsXHR(Request $request) 'name' => $supportEmailConfiguration['name'], 'mailer_id' => $supportEmailConfiguration['mailer_id'], ], - 'alertMessage' => "Success ! Email settings are updated successfully.", + 'alertMessage' => $this->get('translator')->trans('Success ! Email settings are updated successfully.'), ]; return new Response(json_encode($result), 200, ['Content-Type' => 'application/json']); diff --git a/Controller/Privilege.php b/Controller/Privilege.php index c390c3d77..0dbd4e526 100755 --- a/Controller/Privilege.php +++ b/Controller/Privilege.php @@ -40,7 +40,6 @@ public function createPrivilege(Request $request) $this->addFlash('success', $this->get('translator')->trans('Success ! Privilege information saved successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_privilege_collection')); - } return $this->render('@UVDeskCoreFramework/Privileges/createSupportPrivelege.html.twig', [ @@ -78,8 +77,8 @@ public function editPrivilege($supportPrivilegeId) $entityManager->persist($supportPrivilege); $entityManager->flush(); - $this->addFlash('success', 'Privilege updated successfully.'); - + $this->addFlash('success', $this->get('translator')->trans('Privilege updated successfully.')); + return $this->redirect($this->generateUrl('helpdesk_member_privilege_collection')); } diff --git a/Controller/PrivilegeXHR.php b/Controller/PrivilegeXHR.php index 6e722e096..66fdf9aee 100644 --- a/Controller/PrivilegeXHR.php +++ b/Controller/PrivilegeXHR.php @@ -44,7 +44,7 @@ public function deletePrivilegeXHR($supportPrivilegeId) return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => 'Support Privilege removed successfully.', + 'alertMessage' => $this->get('translator')->trans('Support Privilege removed successfully'), ]), 200, ['Content-Type' => 'application/json']); } } diff --git a/Controller/SavedReplies.php b/Controller/SavedReplies.php index a4877e067..ac4725441 100755 --- a/Controller/SavedReplies.php +++ b/Controller/SavedReplies.php @@ -114,7 +114,8 @@ public function updateSavedReplies(Request $request) $em->persist($template); $em->flush(); - $this->addFlash('success', $request->attributes->get('template') ? 'Success! Reply has been updated successfully.': 'Success! Reply has been added successfully.'); + $this->addFlash('success', $request->attributes->get('template') ? $this->get('translator')->trans('Success! Reply has been updated successfully.'): $this->get('translator')->trans('Success! Reply has been added successfully.')); + return $this->redirectToRoute('helpdesk_member_saved_replies'); } @@ -153,7 +154,7 @@ public function savedRepliesXHR(Request $request) $responseContent = [ 'alertClass' => 'success', - 'alertMessage' => 'Success! Saved Reply has been deleted successfully.' + 'alertMessage' => $this->get('translator')->trans('Success! Saved Reply has been deleted successfully.') ]; } diff --git a/Controller/SwiftMailer.php b/Controller/SwiftMailer.php index 8d3971d32..79782ed1e 100644 --- a/Controller/SwiftMailer.php +++ b/Controller/SwiftMailer.php @@ -36,8 +36,7 @@ public function createMailerConfiguration(Request $request) try { $swiftmailer->writeSwiftMailerConfigurations($configurations); - - $this->addFlash('success', 'SwiftMailer configuration created successfully.'); + $this->addFlash('success', $this->get('translator')->trans('SwiftMailer configuration created successfully.')); return new RedirectResponse($this->generateUrl('helpdesk_member_swiftmailer_settings')); } catch (\Exception $e) { $this->addFlash('warning', $e->getMessage()); @@ -78,7 +77,7 @@ public function updateMailerConfiguration($id, Request $request) $swiftmailerConfigurations[$index] = $swiftmailerConfiguration; $swiftmailerService->writeSwiftMailerConfigurations($swiftmailerConfigurations); - $this->addFlash('success', 'SwiftMailer configuration updated successfully.'); + $this->addFlash('success', $this->get('translator')->trans('SwiftMailer configuration updated successfully.')); return new RedirectResponse($this->generateUrl('helpdesk_member_swiftmailer_settings')); } diff --git a/Controller/SwiftMailerXHR.php b/Controller/SwiftMailerXHR.php index 40ae4c69a..db7b4bbbd 100644 --- a/Controller/SwiftMailerXHR.php +++ b/Controller/SwiftMailerXHR.php @@ -53,14 +53,14 @@ public function removeMailerConfiguration(Request $request) return new JsonResponse([ 'alertClass' => 'success', - 'alertMessage' => 'Swiftmailer configuration removed successfully.', + 'alertMessage' => $this->get('translator')->trans('Swiftmailer configuration removed successfully.'), ]); } } return new JsonResponse([ 'alertClass' => 'error', - 'alertMessage' => 'No swiftmailer configurations found for mailer id: ' . $params['id'], + 'alertMessage' => $this->get('translator')->trans('No swiftmailer configurations found for mailer id:') . $params['id'], ], 404); } } diff --git a/Controller/Team.php b/Controller/Team.php index bb393336a..db983a6e1 100755 --- a/Controller/Team.php +++ b/Controller/Team.php @@ -93,7 +93,8 @@ public function createTeam(Request $request) $em->persist($supportTeam); $em->flush(); - $this->addFlash('success', $this->translator->trans('Success ! Team information saved successfully.')); + $this->addFlash('success', $this->get('translator')->trans('Success ! Team information saved successfully.')); + return $this->redirect($this->generateUrl('helpdesk_member_support_team_collection')); } diff --git a/Controller/TeamXHR.php b/Controller/TeamXHR.php index 7c56ff5d3..a42d3d9a7 100755 --- a/Controller/TeamXHR.php +++ b/Controller/TeamXHR.php @@ -41,10 +41,10 @@ public function deleteTeamXHR($supportTeamId, TranslatorInterface $translator) if (!empty($supportTeam)) { $entityManager->remove($supportTeam); $entityManager->flush(); - + return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $translator->trans('Support Team removed successfully.'), + 'alertMessage' => $this->get('translator')->trans('Support Team removed successfully.'), ]), 200, ['Content-Type' => 'application/json']); } } diff --git a/Controller/Thread.php b/Controller/Thread.php index ee6aadef1..63a625614 100755 --- a/Controller/Thread.php +++ b/Controller/Thread.php @@ -44,7 +44,7 @@ public function saveThread($ticketId, Request $request) $parsedMessage = str_replace(' ', '', $parsedMessage); if (null == $parsedMessage) { - $this->addFlash('warning', "Reply content cannot be left blank."); + $this->addFlash('warning', $this->get('translator')->trans('Reply content cannot be left blank.')); } // @TODO: Validate file attachments @@ -100,7 +100,7 @@ public function saveThread($ticketId, Request $request) $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); // @TODO: Render response on the basis of event response (if propogation was stopped or not) - $request->getSession()->getFlashBag()->set('success', 'Note added to ticket successfully.'); + $this->addFlash('success', $this->get('translator')->trans('Note added to ticket successfully.')); break; case 'reply': $event = new GenericEvent(CoreWorkflowEvents\Ticket\AgentReply::getId(), [ @@ -111,7 +111,7 @@ public function saveThread($ticketId, Request $request) $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); // @TODO: Render response on the basis of event response (if propogation was stopped or not) - $request->getSession()->getFlashBag()->set('success', 'Reply added to ticket successfully.'); + $this->addFlash('success', $this->get('translator')->trans('Reply added to ticket successfully.')); break; case 'forward': // Prepare headers @@ -145,7 +145,7 @@ public function saveThread($ticketId, Request $request) } // @TODO: Render response on the basis of event response (if propogation was stopped or not) - $request->getSession()->getFlashBag()->set('success', 'Reply added to the ticket and forwarded successfully.'); + $this->addFlash('success', $this->translator->trans('Reply added to the ticket and forwarded successfully.')); break; default: break; diff --git a/Controller/Ticket.php b/Controller/Ticket.php index dcd514d70..f7065bb1b 100755 --- a/Controller/Ticket.php +++ b/Controller/Ticket.php @@ -182,7 +182,7 @@ public function saveTicket(Request $request) return $this->redirect($this->generateUrl('helpdesk_member_ticket', ['ticketId' => $ticket->getId()])); } } else { - $request->getSession()->getFlashBag()->set('warning', 'Could not create ticket, invalid details.'); + $this->addFlash('warning', $this->get('translator')->trans('Could not create ticket, invalid details.')); } return $this->redirect(!empty($referralURL) ? $referralURL : $this->generateUrl('helpdesk_member_ticket_collection')); @@ -230,9 +230,9 @@ public function ticketType(Request $request) $em->flush(); if (!$request->attributes->get('ticketTypeId')) { - $this->addFlash('success', sprintf('Success! Ticket type saved successfully.')); + $this->addFlash('success', $this->get('translator')->trans('Success! Ticket type saved successfully.')); } else { - $this->addFlash('success', sprintf('Success! Ticket type updated successfully.')); + $this->addFlash('success', $this->get('translator')->trans('Success! Ticket type updated successfully.')); } return $this->redirect($this->generateUrl('helpdesk_member_ticket_type_collection')); diff --git a/Controller/TicketXHR.php b/Controller/TicketXHR.php index 6b8e898e3..3939f39b9 100755 --- a/Controller/TicketXHR.php +++ b/Controller/TicketXHR.php @@ -354,7 +354,7 @@ public function updateTicketAttributes($ticketId) return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => 'Ticket assigned to support group ' . $supportGroup->getName(), + 'alertMessage' => $this->get('translator')->trans('Ticket assigned to support group '). $supportGroup->getName(), ]), 200, ['Content-Type' => 'application/json']); } break; diff --git a/Dashboard/Segments/HomepageSection.php b/Dashboard/Segments/HomepageSection.php index 83b98307d..26b83a587 100644 --- a/Dashboard/Segments/HomepageSection.php +++ b/Dashboard/Segments/HomepageSection.php @@ -2,6 +2,10 @@ namespace Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments; +use Symfony\Component\Translation\Translator; +use Symfony\Component\Translation\Loader\YamlFileLoader; +use Symfony\Component\HttpFoundation\Request; + abstract class HomepageSection implements HomepageSectionInterface { private $collection = []; @@ -25,4 +29,54 @@ public function getItemCollection() : array { return $this->collection; } + + public static function dynamicTranslation($data) : string + { + $request = Request::createFromGlobals(); + $path = $request->getPathInfo(); + $locale = explode("/", $path); + $translator = new Translator($locale[1]); + + switch($locale[1]) + { + case 'en': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.en.yml", 'en'); + break; + case 'es': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.es.yml", 'es'); + break; + case 'fr': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.fr.yml", 'fr'); + break; + case 'da': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.da.yml", 'da'); + break; + case 'de': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.de.yml", 'de'); + break; + case 'it': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.it.yml", 'it'); + break; + case 'ar': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.ar.yml", 'ar'); + break; + case 'tr': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.tr.yml", 'tr'); + break; + default: + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.en.yml", 'en'); + break; + } + + return $translator->trans($data); + } } diff --git a/Dashboard/Segments/HomepageSectionItem.php b/Dashboard/Segments/HomepageSectionItem.php index c559c390a..c83fc9d83 100644 --- a/Dashboard/Segments/HomepageSectionItem.php +++ b/Dashboard/Segments/HomepageSectionItem.php @@ -2,6 +2,10 @@ namespace Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments; +use Symfony\Component\Translation\Translator; +use Symfony\Component\Translation\Loader\YamlFileLoader; +use Symfony\Component\HttpFoundation\Request; + abstract class HomepageSectionItem implements HomepageSectionItemInterface { CONST SVG = <<getPathInfo(); + $locale = explode("/", $path); + $translator = new Translator($locale[1]); + + switch($locale[1]) + { + case 'en': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.en.yml", 'en'); + break; + case 'es': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.es.yml", 'es'); + break; + case 'fr': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.fr.yml", 'fr'); + break; + case 'da': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.da.yml", 'da'); + break; + case 'de': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.de.yml", 'de'); + break; + case 'it': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.it.yml", 'it'); + break; + case 'ar': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.ar.yml", 'ar'); + break; + case 'tr': + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../translations/messages.tr.yml", 'tr'); + break; + default: + $translator->addLoader('yaml', new YamlFileLoader()); + $translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.en.yml", 'en'); + break; + } + + return $translator->trans($data); + } + public abstract static function getTitle() : string; public abstract static function getRouteName() : string; public abstract static function getSectionReferenceId() : string; diff --git a/PreparedResponse/Actions/Agent/MailAgent.php b/PreparedResponse/Actions/Agent/MailAgent.php index 23a071c6d..0292dfa3b 100644 --- a/PreparedResponse/Actions/Agent/MailAgent.php +++ b/PreparedResponse/Actions/Agent/MailAgent.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Mail to agent'; + return self::dynamicTranslation("Mail to agent"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Agent/TransferTickets.php b/PreparedResponse/Actions/Agent/TransferTickets.php index 14dde0484..edc892ed6 100644 --- a/PreparedResponse/Actions/Agent/TransferTickets.php +++ b/PreparedResponse/Actions/Agent/TransferTickets.php @@ -15,7 +15,7 @@ public static function getId() public static function getDescription() { - return 'Transfer Tickets'; + return self::dynamicTranslation("Transfer Tickets"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Customer/MailCustomer.php b/PreparedResponse/Actions/Customer/MailCustomer.php index c5b6503a5..5dddbe216 100644 --- a/PreparedResponse/Actions/Customer/MailCustomer.php +++ b/PreparedResponse/Actions/Customer/MailCustomer.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Mail to customer'; + return self::dynamicTranslation("Mail to customer"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/AddNote.php b/PreparedResponse/Actions/Ticket/AddNote.php index d2e90c9da..6a0de9918 100644 --- a/PreparedResponse/Actions/Ticket/AddNote.php +++ b/PreparedResponse/Actions/Ticket/AddNote.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Add Note'; + return self::dynamicTranslation("Add Note"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/Delete.php b/PreparedResponse/Actions/Ticket/Delete.php index b041bcad3..84671aa1c 100644 --- a/PreparedResponse/Actions/Ticket/Delete.php +++ b/PreparedResponse/Actions/Ticket/Delete.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Delete Ticket'; + return self::dynamicTranslation("Delete Ticket"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/MailAgent.php b/PreparedResponse/Actions/Ticket/MailAgent.php index c9e212abc..2afd63156 100644 --- a/PreparedResponse/Actions/Ticket/MailAgent.php +++ b/PreparedResponse/Actions/Ticket/MailAgent.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Mail to agent'; + return self::dynamicTranslation("Mail to agent"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/MailCustomer.php b/PreparedResponse/Actions/Ticket/MailCustomer.php index 31eed7388..8441e2b5b 100644 --- a/PreparedResponse/Actions/Ticket/MailCustomer.php +++ b/PreparedResponse/Actions/Ticket/MailCustomer.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Mail to customer'; + return self::dynamicTranslation("Mail to customer"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/MailGroup.php b/PreparedResponse/Actions/Ticket/MailGroup.php index 01659c6f2..5d8d30bac 100644 --- a/PreparedResponse/Actions/Ticket/MailGroup.php +++ b/PreparedResponse/Actions/Ticket/MailGroup.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Mail to group'; + return self::dynamicTranslation("Mail to group"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/MailLastCollaborator.php b/PreparedResponse/Actions/Ticket/MailLastCollaborator.php index 8071c14d4..b0d5d846a 100644 --- a/PreparedResponse/Actions/Ticket/MailLastCollaborator.php +++ b/PreparedResponse/Actions/Ticket/MailLastCollaborator.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Mail to last collaborator'; + return self::dynamicTranslation("Mail to last collaborator"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/MailTeam.php b/PreparedResponse/Actions/Ticket/MailTeam.php index 553d2e583..9178848ad 100644 --- a/PreparedResponse/Actions/Ticket/MailTeam.php +++ b/PreparedResponse/Actions/Ticket/MailTeam.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Mail to team'; + return self::dynamicTranslation("Mail to team"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/MarkSpam.php b/PreparedResponse/Actions/Ticket/MarkSpam.php index 2f2bd7e1b..afbcce15a 100644 --- a/PreparedResponse/Actions/Ticket/MarkSpam.php +++ b/PreparedResponse/Actions/Ticket/MarkSpam.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Mark Spam'; + return self::dynamicTranslation("Mark Spam"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/UpdateAgent.php b/PreparedResponse/Actions/Ticket/UpdateAgent.php index 8b71d64a2..985644515 100644 --- a/PreparedResponse/Actions/Ticket/UpdateAgent.php +++ b/PreparedResponse/Actions/Ticket/UpdateAgent.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Assign to agent'; + return self::dynamicTranslation("Assign to agent"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/UpdateGroup.php b/PreparedResponse/Actions/Ticket/UpdateGroup.php index 17f993716..f9f9fce20 100644 --- a/PreparedResponse/Actions/Ticket/UpdateGroup.php +++ b/PreparedResponse/Actions/Ticket/UpdateGroup.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Assign to group'; + return self::dynamicTranslation("Assign to group"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/UpdatePriority.php b/PreparedResponse/Actions/Ticket/UpdatePriority.php index 10f7f44eb..6ce55559e 100644 --- a/PreparedResponse/Actions/Ticket/UpdatePriority.php +++ b/PreparedResponse/Actions/Ticket/UpdatePriority.php @@ -17,6 +17,7 @@ public static function getId() public static function getDescription() { return 'Set Priority As'; + return self::dynamicTranslation("Set Priority As"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/UpdateStatus.php b/PreparedResponse/Actions/Ticket/UpdateStatus.php index 8f45f16a5..7b788dc4d 100644 --- a/PreparedResponse/Actions/Ticket/UpdateStatus.php +++ b/PreparedResponse/Actions/Ticket/UpdateStatus.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Set Status As'; + return self::dynamicTranslation("Set Status As"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/UpdateTag.php b/PreparedResponse/Actions/Ticket/UpdateTag.php index a0b5156d6..cb487188c 100644 --- a/PreparedResponse/Actions/Ticket/UpdateTag.php +++ b/PreparedResponse/Actions/Ticket/UpdateTag.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Set Tag As'; + return self::dynamicTranslation("Set Tag As"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/UpdateTeam.php b/PreparedResponse/Actions/Ticket/UpdateTeam.php index 6dd369637..95fc9edb8 100644 --- a/PreparedResponse/Actions/Ticket/UpdateTeam.php +++ b/PreparedResponse/Actions/Ticket/UpdateTeam.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Assign to team'; + return self::dynamicTranslation("Assign to team"); } public static function getFunctionalGroup() diff --git a/PreparedResponse/Actions/Ticket/UpdateType.php b/PreparedResponse/Actions/Ticket/UpdateType.php index fab7f9597..5c787e773 100644 --- a/PreparedResponse/Actions/Ticket/UpdateType.php +++ b/PreparedResponse/Actions/Ticket/UpdateType.php @@ -16,7 +16,7 @@ public static function getId() public static function getDescription() { - return 'Set Type As'; + return self::dynamicTranslation("Set Type As"); } public static function getFunctionalGroup() diff --git a/Repository/TicketRepository.php b/Repository/TicketRepository.php index 412e60c98..b2cd907ff 100644 --- a/Repository/TicketRepository.php +++ b/Repository/TicketRepository.php @@ -392,7 +392,7 @@ public function getTicketTabDetails($user, array $params) ->groupBy('status'); // applyFilter according to params - if ($user->getRoles()[0] != 'ROLE_SUPER_ADMIN') { + if ($user->getRoles()[0] != 'ROLE_SUPER_ADMIN' && $user->getRoles()[0] != 'ROLE_ADMIN') { $queryBuilder->andwhere('agent = ' . $user->getId()); } diff --git a/Resources/config/services/automations.yaml b/Resources/config/services/automations.yaml index 643e3390c..6b65f9452 100644 --- a/Resources/config/services/automations.yaml +++ b/Resources/config/services/automations.yaml @@ -15,4 +15,8 @@ services: resource: '../../../PreparedResponse/Actions/*' arguments: ['@service_container', '@request_stack', '@doctrine.orm.entity_manager'] tags: - - { name: uvdesk.automations.prepared_response.actions } \ No newline at end of file + - { name: uvdesk.automations.prepared_response.actions } + + # Webkul\UVDesk\CoreFrameworkBundle\Segments\: + # resource: '../../../Segments/HomepageSectionItem' + # arguments: ['@service_container', '@request_stack'] \ No newline at end of file diff --git a/Resources/views/Agents/createSupportAgent.html.twig b/Resources/views/Agents/createSupportAgent.html.twig index 753e09cb5..55cdcf382 100644 --- a/Resources/views/Agents/createSupportAgent.html.twig +++ b/Resources/views/Agents/createSupportAgent.html.twig @@ -45,17 +45,17 @@ {{ uvdesk_extensibles.getRegisteredComponent(asideTemplate).renderSidebar(asideSidebarReference) | raw }}
-

Create Agent

+

{{ 'Create Agent'|trans }}

{# Registeration Form #}
{# Registeration Form Tabs #}
    -
  • General
  • -
  • Groups
  • +
  • {{ 'General'|trans }}
  • +
  • {{ 'Groups'|trans }}
  • {% if "ROLE_SUPER_ADMIN" not in user.roles %} -
  • Permission
  • +
  • {{ 'Permission'|trans }}
  • {% endif %}
@@ -79,14 +79,14 @@
- +
- +
@@ -139,8 +139,8 @@
- - Assigning group(s) to user to view tickets regardless assignment. + + {{ 'Assigning group(s) to user to view tickets regardless assignment.'|trans }}
@@ -346,41 +346,41 @@ validation: { 'user_form[firstName]': [{ required: true, - msg: 'This field is mandatory' + msg: '{{ "This field is mandatory" | trans}}' }, { pattern: /^[A-Za-z][A-Za-z]*[\sA-Za-z]*$/, - msg: 'This field must have characters only' + msg: '{{ "This field must have characters only" | trans}}' },{ maxLength:40, - msg:'Maximum character length is 40' + msg: '{{ "Maximum character length is 40" | trans}}' }], 'user_form[lastName]': [{ required: true, - msg: 'This field is mandatory' + msg: '{{ "This field is mandatory" | trans}}' }, { pattern: /^[A-Za-z][A-Za-z]*[\sA-Za-z]*$/, - msg: 'This field must have characters only' + msg: '{{ "This field must have characters only" | trans}}' },{ maxLength:40, - msg:'Maximum character length is 40' + msg: '{{ "Maximum character length is 40" | trans}}' }], 'user_form[email]': [{ required: true, - msg: 'This field is mandatory' + msg: '{{ "This field is mandatory" | trans}}' },{ pattern: /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/, - msg: 'This is not a valid email address' + msg: '{{ "This is not a valid email address" | trans}}' }], 'user_form[contactNumber]': function(value) { if(value != undefined && value !== '') { if(!value.match('^[0-9]*$')) - return 'This field must be a number'; + return '{{ "This field must be a number" | trans}}'; } }, 'user_form[password][first]' : function(value) { if(value != undefined && value !== '') { if(value.length < 8) - return 'Password must contains 8 Characters'; + return '{{ "Password must contains 8 Characters" | trans}}'; } }, 'user_form[password][second]': { @@ -394,7 +394,7 @@ }, 'user_form[groups][]': { required: true, - msg: 'This field is mandatory' + msg: '{{ "This field is mandatory" | trans}}' }, 'user_form[agentPrivilege][]' : { fn: function(value) { @@ -405,7 +405,7 @@ return false; }, - msg: 'This field is mandatory' + msg: '{{ "This field is mandatory" | trans}}' }, 'user_form[ticketView]': { fn: function(value) { @@ -416,7 +416,7 @@ return false; }, - msg: 'This field is mandatory' + msg: '{{ "This field is mandatory" | trans}}' }, } }); diff --git a/Resources/views/Agents/listSupportAgents.html.twig b/Resources/views/Agents/listSupportAgents.html.twig index 76867e634..88be7cfd5 100755 --- a/Resources/views/Agents/listSupportAgents.html.twig +++ b/Resources/views/Agents/listSupportAgents.html.twig @@ -13,8 +13,7 @@ {{ uvdesk_extensibles.getRegisteredComponent(asideTemplate).renderSidebar(asideSidebarReference) | raw }}
-

Agents

- +

{{ 'Agents'|trans }}

{# Sort Agents #} @@ -46,7 +45,7 @@
{# Search Agent #} - + {# Create New Agent #} {{ 'New Agent'|trans }} diff --git a/Resources/views/Agents/updateSupportAgent.html.twig b/Resources/views/Agents/updateSupportAgent.html.twig index 73b27b965..0dff2361b 100644 --- a/Resources/views/Agents/updateSupportAgent.html.twig +++ b/Resources/views/Agents/updateSupportAgent.html.twig @@ -397,22 +397,22 @@ validation: { 'user_form[firstName]': [{ required: true, - msg: 'This field is mandatory' + msg: '{{ "This field is mandatory" | trans}}' },{ pattern: /^[A-Za-z][A-Za-z]*[\sA-Za-z]*$/, - msg: 'This field must have characters only' + msg: '{{ "This field must have characters only" | trans}}' },{ maxLength:40, - msg:'Maximum character length is 40' + msg: '{{ "Maximum character length is 40" | trans}}' }], 'user_form[lastName]': function(value) { if(value != undefined && value !== '') { [{ pattern: /^[A-Za-z][A-Za-z]*[\sA-Za-z]*$/, - msg: 'This field must have characters only' + msg: '{{ "This field must have characters only" | trans}}' },{ maxLength:40, - msg:'Maximum character length is 40' + msg: '{{ "Maximum character length is 40" | trans}}' }] } }, diff --git a/Resources/views/Customers/createSupportCustomer.html.twig b/Resources/views/Customers/createSupportCustomer.html.twig index 7cad26a1a..2081d7763 100644 --- a/Resources/views/Customers/createSupportCustomer.html.twig +++ b/Resources/views/Customers/createSupportCustomer.html.twig @@ -131,22 +131,22 @@ validation: { 'customer_form[firstName]': [{ required: true, - msg: 'This field is mandatory' + msg: '{{ "This field is mandatory"|trans }}' },{ pattern: /^[A-Za-z][A-Za-z]*[\sA-Za-z]*$/, - msg: 'This field must have characters only' + msg: '{{ "This field must have characters only"|trans }}' },{ maxLength:40, - msg:'Maximum character length is 40' + msg: '{{ "Maximum character length is 40"|trans }}' }], 'customer_form[lastName]': function(value) { if(value != undefined && value !== '') { [{ pattern: /^[A-Za-z][A-Za-z]*[\sA-Za-z]*$/, - msg: 'This field must have characters only' + msg: '{{ "This field must have characters only"|trans }}' },{ maxLength:40, - msg:'Maximum character length is 40' + msg: '{{ "Maximum character length is 40"|trans }}' }] } }, diff --git a/Resources/views/Customers/updateSupportCustomer.html.twig b/Resources/views/Customers/updateSupportCustomer.html.twig index c087685a3..11f1113d4 100644 --- a/Resources/views/Customers/updateSupportCustomer.html.twig +++ b/Resources/views/Customers/updateSupportCustomer.html.twig @@ -134,22 +134,22 @@ validation: { 'customer_form[firstName]': [{ required: true, - msg: 'This field is mandatory' + msg: '{{ "This field is mandatory"|trans }}' },{ pattern: /^[A-Za-z][A-Za-z]*[\sA-Za-z]*$/, - msg: 'This field must have characters only' + msg: '{{ "This field must have characters only"|trans }}' },{ maxLength:40, - msg:'Maximum character length is 40' + msg: '{{ "Maximum character length is 40"|trans }}' }], 'customer_form[lastName]': function(value) { if(value != undefined && value !== '') { [{ pattern: /^[A-Za-z][A-Za-z]*[\sA-Za-z]*$/, - msg: 'This field must have characters only' + msg: '{{ "This field must have characters only"|trans }}' },{ maxLength:40, - msg:'Maximum character length is 40' + msg: '{{ "Maximum character length is 40"|trans }}' }] } }, diff --git a/Resources/views/Groups/createSupportGroup.html.twig b/Resources/views/Groups/createSupportGroup.html.twig index 17fe21d9d..1c75dc71f 100644 --- a/Resources/views/Groups/createSupportGroup.html.twig +++ b/Resources/views/Groups/createSupportGroup.html.twig @@ -141,13 +141,13 @@ validation: { 'name': [{ required: true, - msg: 'This field is mandatory' + msg: "{{ 'This field is mandatory'|trans }}" },{ pattern: /^((?![!@#$%^&*()<_+]).)*$/, - msg: 'This field must have characters only' + msg: "{{ 'This field must have characters only'|trans }}" },{ maxLength:50, - msg:'Maximum character length is 50' + msg: "{{ 'Maximum character length is 50'|trans }}" }], 'description': { required: true, diff --git a/Resources/views/Groups/updateSupportGroup.html.twig b/Resources/views/Groups/updateSupportGroup.html.twig index 51baff68f..42a70e3ca 100644 --- a/Resources/views/Groups/updateSupportGroup.html.twig +++ b/Resources/views/Groups/updateSupportGroup.html.twig @@ -141,13 +141,13 @@ validation: { 'name': [{ required: true, - msg: 'This field is mandatory' + msg: "{{ 'This field is mandatory'|trans }}" },{ pattern: /^((?![!@#$%^&*()<_+]).)*$/, - msg: 'This field must have characters only' + msg: "{{ 'This field must have characters only'|trans }}" },{ maxLength:50, - msg:'Maximum character length is 50' + msg: "{{ 'Maximum character length is 50'|trans }}" }], 'description': { required: true, diff --git a/Resources/views/Privileges/createSupportPrivelege.html.twig b/Resources/views/Privileges/createSupportPrivelege.html.twig index caf6fbb1d..5ff0cc264 100644 --- a/Resources/views/Privileges/createSupportPrivelege.html.twig +++ b/Resources/views/Privileges/createSupportPrivelege.html.twig @@ -11,20 +11,20 @@ {{ uvdesk_extensibles.getRegisteredComponent(asideTemplate).renderSidebar(asideSidebarReference) | raw }}
-

Add Privilege

+

{{ 'Add Privilege'|trans }}

{# Create Support Privilege Form #} {# Basic Details #}
- +
- +
@@ -33,13 +33,13 @@ {# Agent Resources #}
- - Choose set of privileges which will be available to the agent. + + {{ 'Choose set of privileges which will be available to the agent.'|trans }}
@@ -61,15 +61,15 @@ {# Mass Action #}
{# Advanced Resources #}
@@ -91,8 +91,8 @@ {# Mass Action #}
@@ -115,23 +115,23 @@ validation: { 'privilege_form[name]': [{ required: true, - msg: "This field is mandatory" + msg: "{{ 'This field is mandatory'|trans }}" }, { pattern: '^((?![!@#$%^&*()<>]).)*$', - msg: 'Privilege Name must have characters only' + msg: "{{ 'Privilege Name must have characters only'|trans }}" },{ maxLength:50, - msg:'Maximum character length is 50' + msg: "{{ 'Maximum character length is 50'|trans }}" }], 'privilege_form[description]': { required: true, - msg: 'This field is mandatory' + msg: "{{ 'This field is mandatory'|trans }}" }, 'privilege_form[privileges][]': { fn: function() { return !$("input[name='privilege_form[privileges][]']:checked").length ? true : false; }, - msg: 'This field is mandatory' + msg: "{{ 'This field is mandatory'|trans }}" }, } }); diff --git a/Resources/views/Privileges/updateSupportPrivelege.html.twig b/Resources/views/Privileges/updateSupportPrivelege.html.twig index 03f84e406..442f75faf 100644 --- a/Resources/views/Privileges/updateSupportPrivelege.html.twig +++ b/Resources/views/Privileges/updateSupportPrivelege.html.twig @@ -117,7 +117,7 @@ msg: "{{ 'Privilege Name must have characters only' }}" },{ maxLength:50, - msg:'Maximum character length is 50' + msg: "{{ 'Maximum character length is 50'|trans }}" }], 'privilege_form[description]': { required: true, diff --git a/Resources/views/Snippets/createMemberTicket.html.twig b/Resources/views/Snippets/createMemberTicket.html.twig index 4efcce853..077021850 100644 --- a/Resources/views/Snippets/createMemberTicket.html.twig +++ b/Resources/views/Snippets/createMemberTicket.html.twig @@ -9,71 +9,70 @@ {% if not isTicketViewPage %} {# Name #}
- +
- Customer full name + {{ 'Customer full name'|trans }}
{# Email #}
- +
- Customer email address + {{ 'Customer email address'|trans }}
{% else %} {# Retrieve customer details from the current ticket being visited #} - Ticket will be created with current ticket's customer + {{ "Ticket will be created with current ticket's customer"|trans }} {% endif %} {# Ticket Type #}
- +
- - Choose ticket type + {{ 'Choose ticket type'|trans }}
{# Ticket Subject #}
- +
- Ticket subject + {{ 'Ticket subject'|trans }}
{# Ticket Message #}
- +
- Query message + {{ 'Ticket query message'|trans }}
{# Ticket Attachment #}
- +
@@ -110,28 +109,28 @@ {% if not isTicketViewPage %} 'name' : { required : true, - msg : 'This field is mandatory' + msg : "{{ 'This field is mandatory'|trans }}" }, 'from' : [{ required : true, - msg : 'This field is mandatory' + msg : "{{ 'This field is mandatory'|trans }}" },{ pattern : /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/, - msg : 'Email address is invalid' + msg : "{{ 'Email address is invalid'|trans }}" }], {% endif %} 'type' : { required : true, - msg : 'This field is mandatory' + msg : "{{ 'This field is mandatory'|trans }}" }, 'subject' : { required : true, - msg : 'This field is mandatory' + msg : "{{ 'This field is mandatory'|trans }}" }, 'reply' : { required : true, - msg : 'This field is mandatory' + msg : "{{ 'This field is mandatory'|trans }}" }, }, urlRoot : "{{ path('helpdesk_member_create_ticket') }}" diff --git a/Resources/views/SwiftMailer/listConfigurations.html.twig b/Resources/views/SwiftMailer/listConfigurations.html.twig index 0b746d956..37b075109 100644 --- a/Resources/views/SwiftMailer/listConfigurations.html.twig +++ b/Resources/views/SwiftMailer/listConfigurations.html.twig @@ -30,11 +30,11 @@
-

SwiftMailer Configurations

+

{{ 'SwiftMailer Configurations'|trans }}

@@ -42,11 +42,11 @@ - - - - - + + + + + @@ -75,9 +75,9 @@ <% if (isActive) { %> - + <% } else { %> - + <% } %>
IDEmailTypeStatusAction{{ 'ID'|trans }}{{ 'Email'|trans }}{{ 'Type'|trans }}{{ 'Status'|trans }}{{ 'Action'|trans }}
<%- transport %>Enabled{{ 'Enabled'|trans }}Disabled{{ 'Disabled'|trans }} diff --git a/Resources/views/SwiftMailer/manageConfigurations.html.twig b/Resources/views/SwiftMailer/manageConfigurations.html.twig index 25381075e..00f9f26f6 100644 --- a/Resources/views/SwiftMailer/manageConfigurations.html.twig +++ b/Resources/views/SwiftMailer/manageConfigurations.html.twig @@ -14,9 +14,9 @@
{% if configuration is defined and configuration.id is not empty %} -

Update configuration

+

{{ 'Update configuration'|trans }}

{% else %} -

Add configuration

+

{{ 'Add configuration'|trans }}

{% endif %}
@@ -25,32 +25,32 @@
{# Mailer Id #}
- +
{% if configuration is defined and configuration.id is not empty %} - + {% else %} - + {% endif %}
{# Transport Type #}
- + {% if configuration is defined and configuration is not empty %} {% else %} {% endif %}
@@ -68,7 +68,7 @@
- Enable Delivery + {{ 'Enable Delivery'|trans }}
@@ -90,7 +90,7 @@