From 2cf35e350142feef62dfaa59d10ae9bf291b1b75 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 20 Aug 2020 17:50:11 +0530 Subject: [PATCH 01/85] depricated controller updates --- Controller/Account.php | 4 ++-- Controller/AccountXHR.php | 4 ++-- Controller/Authentication.php | 4 ++-- Controller/Customer.php | 4 ++-- Controller/CustomerXHR.php | 4 ++-- Controller/Email.php | 4 ++-- Controller/EmailSettings.php | 4 ++-- Controller/EmailSettingsXHR.php | 4 ++-- Controller/Group.php | 4 ++-- Controller/GroupXHR.php | 4 ++-- Controller/Privilege.php | 4 ++-- Controller/PrivilegeXHR.php | 4 ++-- Controller/SavedReplies.php | 4 ++-- Controller/SwiftMailer.php | 4 ++-- Controller/SwiftMailerXHR.php | 4 ++-- Controller/Team.php | 4 ++-- Controller/TeamXHR.php | 4 ++-- Controller/Theme.php | 4 ++-- Controller/Thread.php | 4 ++-- Controller/ThreadXHR.php | 4 ++-- Controller/Ticket.php | 4 ++-- Controller/TicketXHR.php | 4 ++-- 22 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Controller/Account.php b/Controller/Account.php index 0028f39a0..a340b54cb 100755 --- a/Controller/Account.php +++ b/Controller/Account.php @@ -8,12 +8,12 @@ use Symfony\Component\EventDispatcher\GenericEvent; use Webkul\UVDesk\CoreFrameworkBundle\Form\UserAccount; use Webkul\UVDesk\CoreFrameworkBundle\Form\UserProfile; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; -class Account extends Controller +class Account extends AbstractController { private function encodePassword(User $user, $plainPassword) { diff --git a/Controller/AccountXHR.php b/Controller/AccountXHR.php index 4d9180c02..ba26961e7 100755 --- a/Controller/AccountXHR.php +++ b/Controller/AccountXHR.php @@ -7,11 +7,11 @@ use Symfony\Component\HttpFoundation\Response; use Webkul\UVDesk\CoreFrameworkBundle\Entity\SavedFilters; use Symfony\Component\EventDispatcher\GenericEvent; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; -class AccountXHR extends Controller +class AccountXHR extends AbstractController { public function listAgentsXHR(Request $request) { diff --git a/Controller/Authentication.php b/Controller/Authentication.php index 2f67c297d..755143c27 100644 --- a/Controller/Authentication.php +++ b/Controller/Authentication.php @@ -8,12 +8,12 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\User; use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\Form\Extension\Core\Type\EmailType; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Utils\TokenGenerator; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; -class Authentication extends Controller +class Authentication extends AbstractController { public function login(Request $request) { diff --git a/Controller/Customer.php b/Controller/Customer.php index 61ebd2616..c255dd5ec 100755 --- a/Controller/Customer.php +++ b/Controller/Customer.php @@ -6,10 +6,10 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\EventDispatcher\GenericEvent; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; -class Customer extends Controller +class Customer extends AbstractController { public function listCustomers(Request $request) { diff --git a/Controller/CustomerXHR.php b/Controller/CustomerXHR.php index 82f9e3c8e..aa31e47e3 100644 --- a/Controller/CustomerXHR.php +++ b/Controller/CustomerXHR.php @@ -6,11 +6,11 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\EventDispatcher\GenericEvent; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; -class CustomerXHR extends Controller +class CustomerXHR extends AbstractController { public function listCustomersXHR(Request $request) { diff --git a/Controller/Email.php b/Controller/Email.php index a6619325e..82f0420ba 100755 --- a/Controller/Email.php +++ b/Controller/Email.php @@ -3,7 +3,7 @@ namespace Webkul\UVDesk\CoreFrameworkBundle\Controller; use Doctrine\Common\Collections\Criteria; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Routing\Router; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -11,7 +11,7 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity; use Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance; -class Email extends Controller +class Email extends AbstractController { const LIMIT = 10; diff --git a/Controller/EmailSettings.php b/Controller/EmailSettings.php index 4ebef8c5b..2fc8c408a 100644 --- a/Controller/EmailSettings.php +++ b/Controller/EmailSettings.php @@ -3,10 +3,10 @@ namespace Webkul\UVDesk\CoreFrameworkBundle\Controller; use Symfony\Component\Yaml\Yaml; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Core\Exception\AccessDeniedException; -class EmailSettings extends Controller +class EmailSettings extends AbstractController { public function loadSettings() { diff --git a/Controller/EmailSettingsXHR.php b/Controller/EmailSettingsXHR.php index 1ef9797ea..222c39773 100644 --- a/Controller/EmailSettingsXHR.php +++ b/Controller/EmailSettingsXHR.php @@ -5,9 +5,9 @@ use Symfony\Component\Yaml\Yaml; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class EmailSettingsXHR extends Controller +class EmailSettingsXHR extends AbstractController { public function updateSettingsXHR(Request $request) { diff --git a/Controller/Group.php b/Controller/Group.php index 6c55cfbae..6b621b41e 100755 --- a/Controller/Group.php +++ b/Controller/Group.php @@ -10,9 +10,9 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportGroup; use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportTeam; use Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class Group extends Controller +class Group extends AbstractController { public function listGroups(Request $request) { diff --git a/Controller/GroupXHR.php b/Controller/GroupXHR.php index a70c27774..4b15b99d2 100644 --- a/Controller/GroupXHR.php +++ b/Controller/GroupXHR.php @@ -3,9 +3,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class GroupXHR extends Controller +class GroupXHR extends AbstractController { public function listGroupsXHR(Request $request) { diff --git a/Controller/Privilege.php b/Controller/Privilege.php index 0dbd4e526..789403493 100755 --- a/Controller/Privilege.php +++ b/Controller/Privilege.php @@ -5,9 +5,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportPrivilege; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class Privilege extends Controller +class Privilege extends AbstractController { public function listPrivilege(Request $request) { diff --git a/Controller/PrivilegeXHR.php b/Controller/PrivilegeXHR.php index 66fdf9aee..b49206b40 100644 --- a/Controller/PrivilegeXHR.php +++ b/Controller/PrivilegeXHR.php @@ -6,10 +6,10 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportPrivilege; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; -class PrivilegeXHR extends Controller +class PrivilegeXHR extends AbstractController { public function listPrivilegeXHR(Request $request) { diff --git a/Controller/SavedReplies.php b/Controller/SavedReplies.php index ac4725441..f96110f78 100755 --- a/Controller/SavedReplies.php +++ b/Controller/SavedReplies.php @@ -4,12 +4,12 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Webkul\UVDesk\CoreFrameworkBundle\Form as CoreFrameworkBundleForms; use Webkul\UVDesk\CoreFrameworkBundle\Entity as CoreFrameworkBundleEntities; -class SavedReplies extends Controller +class SavedReplies extends AbstractController { const LIMIT = 10; const ROLE_REQUIRED = 'saved_replies'; diff --git a/Controller/SwiftMailer.php b/Controller/SwiftMailer.php index 79782ed1e..f601fd830 100644 --- a/Controller/SwiftMailer.php +++ b/Controller/SwiftMailer.php @@ -5,11 +5,11 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\Event\ConfigurationUpdatedEvent; -class SwiftMailer extends Controller +class SwiftMailer extends AbstractController { public function loadMailers() { diff --git a/Controller/SwiftMailerXHR.php b/Controller/SwiftMailerXHR.php index db7b4bbbd..614331b8f 100644 --- a/Controller/SwiftMailerXHR.php +++ b/Controller/SwiftMailerXHR.php @@ -4,10 +4,10 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\Event\ConfigurationRemovedEvent; -class SwiftMailerXHR extends Controller +class SwiftMailerXHR extends AbstractController { public function loadMailersXHR(Request $request) { diff --git a/Controller/Team.php b/Controller/Team.php index db983a6e1..1a6f73c1d 100755 --- a/Controller/Team.php +++ b/Controller/Team.php @@ -8,10 +8,10 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportTeam; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; -class Team extends Controller +class Team extends AbstractController { /** * @var TranslatorInterface diff --git a/Controller/TeamXHR.php b/Controller/TeamXHR.php index a42d3d9a7..b9d95a28d 100755 --- a/Controller/TeamXHR.php +++ b/Controller/TeamXHR.php @@ -6,10 +6,10 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\User; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; -class TeamXHR extends Controller +class TeamXHR extends AbstractController { public function listTeamsXHR(Request $request) { diff --git a/Controller/Theme.php b/Controller/Theme.php index b34d0d094..fba8da4d1 100644 --- a/Controller/Theme.php +++ b/Controller/Theme.php @@ -3,9 +3,9 @@ namespace Webkul\UVDesk\CoreFrameworkBundle\Controller; use Symfony\Component\HttpFoundation\Request; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class Theme extends Controller +class Theme extends AbstractController { public function updateHelpdeskTheme(Request $request) { diff --git a/Controller/Thread.php b/Controller/Thread.php index f955f17bb..d3cc3703e 100755 --- a/Controller/Thread.php +++ b/Controller/Thread.php @@ -8,12 +8,12 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\Ticket; use Symfony\Component\EventDispatcher\EventDispatcher; use Webkul\UVDesk\CoreFrameworkBundle\Entity\Attachment; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Entity\TicketStatus; use Webkul\UVDesk\CoreFrameworkBundle\Entity\Thread as TicketThread; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; -class Thread extends Controller +class Thread extends AbstractController { public function saveThread($ticketId, Request $request) { diff --git a/Controller/ThreadXHR.php b/Controller/ThreadXHR.php index e66a5a63a..d4afe6376 100644 --- a/Controller/ThreadXHR.php +++ b/Controller/ThreadXHR.php @@ -4,9 +4,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class ThreadXHR extends Controller +class ThreadXHR extends AbstractController { public function listTicketThreadCollectionXHR($ticketId) { diff --git a/Controller/Ticket.php b/Controller/Ticket.php index 32ca68249..22742f9ae 100755 --- a/Controller/Ticket.php +++ b/Controller/Ticket.php @@ -6,14 +6,14 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\EventDispatcher\GenericEvent; use Webkul\UVDesk\CoreFrameworkBundle\Form as CoreFrameworkBundleForms; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Entity as CoreFrameworkBundleEntities; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Webkul\UVDesk\CoreFrameworkBundle\DataProxies as CoreFrameworkBundleDataProxies; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Webkul\UVDesk\CoreFrameworkBundle\Tickets\QuickActionButtonCollection; -class Ticket extends Controller +class Ticket extends AbstractController { public function listTicketCollection(Request $request) { diff --git a/Controller/TicketXHR.php b/Controller/TicketXHR.php index 3939f39b9..42fb12863 100755 --- a/Controller/TicketXHR.php +++ b/Controller/TicketXHR.php @@ -7,13 +7,13 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity as CoreFrameworkBundleEntities; use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportLabel; use Symfony\Component\EventDispatcher\GenericEvent; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Webkul\UVDesk\CoreFrameworkBundle\Form as CoreFrameworkBundleForms; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Webkul\UVDesk\CoreFrameworkBundle\DataProxies as CoreFrameworkBundleDataProxies; -class TicketXHR extends Controller +class TicketXHR extends AbstractController { public function loadTicketXHR($ticketId) { From e571fdf57a26f0e815c19ec8f7ebe8a100a006bc Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Tue, 25 Aug 2020 10:13:49 +0530 Subject: [PATCH 02/85] email template issue with users --- Repository/EmailTemplatesRepository.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Repository/EmailTemplatesRepository.php b/Repository/EmailTemplatesRepository.php index 73ee284cb..789180331 100644 --- a/Repository/EmailTemplatesRepository.php +++ b/Repository/EmailTemplatesRepository.php @@ -13,12 +13,9 @@ class EmailTemplatesRepository extends EntityRepository public function getEmailTemplates(\Symfony\Component\HttpFoundation\ParameterBag $obj = null, $container) { - $user_id = $container->get('security.token_storage')->getToken()->getUser()->getId(); $json = array(); $qb = $this->getEntityManager()->createQueryBuilder(); - $qb->select('sr')->from($this->getEntityName(), 'sr') - ->orWhere('sr.user IS NULL ') - ->orWhere('sr.user='.$user_id); + $qb->select('sr')->from($this->getEntityName(), 'sr'); $data = $obj->all(); $data = array_reverse($data); From 8706ef3017aca6750601342faf06bf990a0fb1a3 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Mon, 31 Aug 2020 19:52:59 +0530 Subject: [PATCH 03/85] updating depriciation for controllers --- Controller/Account.php | 66 ++++++++++----- Controller/AccountXHR.php | 33 +++++--- Controller/Authentication.php | 35 ++++++-- Controller/Customer.php | 47 +++++++---- Controller/CustomerXHR.php | 12 +-- Controller/Email.php | 14 ++-- Controller/EmailSettings.php | 2 +- Controller/EmailSettingsXHR.php | 2 +- Controller/Group.php | 10 +-- Controller/GroupXHR.php | 4 +- Controller/Privilege.php | 14 ++-- Controller/PrivilegeXHR.php | 6 +- Controller/SavedReplies.php | 6 +- Controller/SwiftMailer.php | 6 +- Controller/SwiftMailerXHR.php | 4 +- Controller/Team.php | 8 +- Controller/TeamXHR.php | 6 +- Controller/Thread.php | 34 ++++---- Controller/Ticket.php | 30 +++---- Controller/TicketXHR.php | 140 ++++++++++++++++---------------- 20 files changed, 273 insertions(+), 206 deletions(-) diff --git a/Controller/Account.php b/Controller/Account.php index a340b54cb..4c161c97a 100755 --- a/Controller/Account.php +++ b/Controller/Account.php @@ -12,12 +12,34 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UVDeskService; +use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; +use Symfony\Component\Translation\TranslatorInterface; + class Account extends AbstractController { + private $userService; + private $authenticationUtils; + private $eventDispatcher; + private $translator; + private $passwordEncoder; + private $uvdeskService; + + public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator, UserPasswordEncoderInterface $passwordEncoder, UVDeskService $uvdeskService) + { + $this->userService = $userService; + $this->eventDispatcher = $eventDispatcher; + $this->translator = $translator; + $this->passwordEncoder = $passwordEncoder; + $this->uvdeskService = $uvdeskService; + } + private function encodePassword(User $user, $plainPassword) { - $encodedPassword = $this->container->get('security.password_encoder')->encodePassword($user, $plainPassword); + $encodedPassword = $this->passwordEncoder->encodePassword($user, $plainPassword); } public function loadDashboard(Request $request) @@ -27,7 +49,7 @@ public function loadDashboard(Request $request) public function listAgents(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -51,7 +73,7 @@ public function loadProfile(Request $request) $validMimeType = ['image/jpeg', 'image/png', 'image/jpg']; if(isset($dataFiles['profileImage'])){ if(!in_array($dataFiles['profileImage']->getMimeType(), $validMimeType)){ - $this->addFlash('warning', $this->get('translator')->trans('Error ! Profile image is not valid, please upload a valid format')); + $this->addFlash('warning', $this->translator->trans('Error ! Profile image is not valid, please upload a valid format')); return $this->redirect($this->generateUrl('helpdesk_member_profile')); } } @@ -75,7 +97,7 @@ public function loadProfile(Request $request) if ($form->isValid()) { if ($data != null) { $submittedPassword = $data['password']['first']; - $encoder = $this->container->get('security.password_encoder'); + $encoder = $this->passwordEncoder; // save previous password if password is blank or null provided $encodedPassword = empty($submittedPassword) ? $password : $encoder->encodePassword($user, $submittedPassword); @@ -83,7 +105,7 @@ public function loadProfile(Request $request) if (!empty($encodedPassword) ) { $user->setPassword($encodedPassword); } else { - $this->addFlash('warning', $this->get('translator')->trans('Error! Given current password is incorrect.')); + $this->addFlash('warning', $this->translator->trans('Error! Given current password is incorrect.')); return $this->redirect($this->generateUrl('helpdesk_member_profile')); } } @@ -110,7 +132,7 @@ public function loadProfile(Request $request) $em->persist($userInstance); $em->flush(); - $this->addFlash('success', $this->get('translator')->trans('Success ! Profile update successfully.')); + $this->addFlash('success', $this->translator->trans('Success ! Profile update successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_profile')); } else { @@ -120,7 +142,7 @@ public function loadProfile(Request $request) $errors = $this->getFormErrors($form); } } else { - $this->addFlash('warning', $this->get('translator')->trans('Error ! User with same email is already exist.')); + $this->addFlash('warning', $this->translator->trans('Error ! User with same email is already exist.')); return $this->redirect($this->generateUrl('helpdesk_member_profile')); } @@ -134,7 +156,7 @@ public function loadProfile(Request $request) public function editAgent($agentId) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -142,7 +164,7 @@ public function editAgent($agentId) $em = $this->getDoctrine()->getManager(); $request = $this->container->get('request_stack')->getCurrentRequest(); - $activeUser = $this->get('user.service')->getSessionUser(); + $activeUser = $this->userService->getSessionUser(); $user = $em->getRepository('UVDeskCoreFrameworkBundle:User')->find($agentId); $instanceRole = $user->getAgentInstance()->getSupportRole()->getCode(); @@ -161,7 +183,7 @@ public function editAgent($agentId) if(isset($dataFiles['profileImage'])){ if(!in_array($dataFiles['profileImage']->getMimeType(), $validMimeType)){ - $this->addFlash('warning', $this->get('translator')->trans('Error ! Profile image is not valid, please upload a valid format')); + $this->addFlash('warning', $this->translator->trans('Error ! Profile image is not valid, please upload a valid format')); $response = $this->render('@UVDeskCoreFramework/Agents/updateSupportAgent.html.twig', [ 'user' => $user, 'instanceRole' => $instanceRole, @@ -182,7 +204,7 @@ public function editAgent($agentId) isset($data['password']['first']) && !empty(trim($data['password']['first'])) && isset($data['password']['second']) && !empty(trim($data['password']['second'])) && trim($data['password']['first']) == trim($data['password']['second'])) { - $encodedPassword = $this->container->get('security.password_encoder')->encodePassword($user, $data['password']['first']); + $encodedPassword = $this->passwordEncoder->encodePassword($user, $data['password']['first']); $user->setPassword($encodedPassword); } @@ -220,7 +242,7 @@ public function editAgent($agentId) if(isset($data['userSubGroup'])){ foreach ($data['userSubGroup'] as $userSubGroup) { - if($userSubGrp = $this->get('uvdesk.service')->getEntityManagerResult( + if($userSubGrp = $this->uvdeskService->getEntityManagerResult( 'UVDeskCoreFrameworkBundle:SupportTeam', 'findOneBy', [ 'id' => $userSubGroup @@ -242,7 +264,7 @@ public function editAgent($agentId) if(isset($data['groups'])){ foreach ($data['groups'] as $userGroup) { - if($userGrp = $this->get('uvdesk.service')->getEntityManagerResult( + if($userGrp = $this->uvdeskService->getEntityManagerResult( 'UVDeskCoreFrameworkBundle:SupportGroup', 'findOneBy', [ 'id' => $userGroup @@ -265,7 +287,7 @@ public function editAgent($agentId) if(isset($data['agentPrivilege'])){ foreach ($data['agentPrivilege'] as $supportPrivilege) { - if($supportPlg = $this->get('uvdesk.service')->getEntityManagerResult( + if($supportPlg = $this->uvdeskService->getEntityManagerResult( 'UVDeskCoreFrameworkBundle:SupportPrivilege', 'findOneBy', [ 'id' => $supportPrivilege @@ -295,12 +317,12 @@ public function editAgent($agentId) 'entity' => $user, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); - $this->addFlash('success', $this->get('translator')->trans('Success ! Agent updated successfully.')); + $this->addFlash('success', $this->translator->trans('Success ! Agent updated successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_account_collection')); } else { - $this->addFlash('warning', $this->get('translator')->trans('Error ! User with same email is already exist.')); + $this->addFlash('warning', $this->translator->trans('Error ! User with same email is already exist.')); } $response = $this->render('@UVDeskCoreFramework/Agents/updateSupportAgent.html.twig', [ @@ -324,12 +346,12 @@ public function editAgent($agentId) public function createAgent(Request $request) { // @TODO: Refactor - if(!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT')){ + if(!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } $user = new User(); - $userServiceContainer = $this->get('user.service'); + $userServiceContainer = $this->userService; if ('POST' == $request->getMethod()) { $formDetails = $request->request->get('user_form'); @@ -340,7 +362,7 @@ public function createAgent(Request $request) $validMimeType = ['image/jpeg', 'image/png', 'image/jpg']; if(isset($uploadedFiles['profileImage'])){ if(!in_array($uploadedFiles['profileImage']->getMimeType(), $validMimeType)){ - $this->addFlash('warning', $this->get('translator')->trans('Error ! Profile image is not valid, please upload a valid format')); + $this->addFlash('warning', $this->translator->trans('Error ! Profile image is not valid, please upload a valid format')); return $this->redirect($this->generateUrl('helpdesk_member_create_account')); } } @@ -408,11 +430,11 @@ public function createAgent(Request $request) $entityManager->persist($userInstance); $entityManager->flush(); - $this->addFlash('success', $this->get('translator')->trans('Success ! Agent added successfully.')); + $this->addFlash('success', $this->translator->trans('Success ! Agent added successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_account_collection')); } } else { - $this->addFlash('warning', $this->get('translator')->trans('Error ! User with same email already exist.')); + $this->addFlash('warning', $this->translator->trans('Error ! User with same email already exist.')); } } diff --git a/Controller/AccountXHR.php b/Controller/AccountXHR.php index ba26961e7..a6bbc3c8c 100755 --- a/Controller/AccountXHR.php +++ b/Controller/AccountXHR.php @@ -10,12 +10,25 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; +use Symfony\Component\Translation\TranslatorInterface; class AccountXHR extends AbstractController { + private $eventDispatcher; + private $translator; + + public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator) + { + $this->eventDispatcher = $eventDispatcher; + $this->translator = $translator; + } + public function listAgentsXHR(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -45,24 +58,24 @@ public function deleteAgent(Request $request) if ($user) { if($user->getAgentInstance()->getSupportRole() != "ROLE_SUPER_ADMIN") { - $this->get('user.service')->removeAgent($user); + $this->userService->removeAgent($user); // Trigger agent delete event $event = new GenericEvent(CoreWorkflowEvents\Agent\Delete::getId(), [ 'entity' => $user, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Agent removed successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Agent removed successfully.'); } else { $json['alertClass'] = 'warning'; - $json['alertMessage'] = $this->get('translator')->trans("Warning ! You are allowed to remove account owner's account."); + $json['alertMessage'] = $this->translator->trans("Warning ! You are allowed to remove account owner's account."); } } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Invalid user id.'); + $json['alertMessage'] = $this->translator->trans('Error ! Invalid user id.'); } } $response = new Response(json_encode($json)); @@ -75,7 +88,7 @@ public function savedFiltersXHR(Request $request) $json = array(); $em = $this->getDoctrine()->getManager(); - $user = $this->get('user.service')->getCurrentUser(); + $user = $this->userService->getCurrentUser(); $userData = $user->getAgentInstance(); if($request->getMethod() == 'POST') { @@ -95,7 +108,7 @@ public function savedFiltersXHR(Request $request) $json['filter'] = ['id' => $filter->getId(), 'name' => $filter->getName(), 'route' => $filter->getRoute(), 'is_default' => isset($content['is_default'])]; $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Filter has been saved successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Filter has been saved successfully.'); } elseif($request->getMethod() == 'PUT' || $request->getMethod() == 'PATCH') { $content = $request->request->all(); $filter = $em->getRepository('UVDeskCoreFrameworkBundle:SavedFilters')->find($content['id']); @@ -113,7 +126,7 @@ public function savedFiltersXHR(Request $request) $json['filter'] = ['id' => $filter->getId(), 'name' => $filter->getName(), 'route' => $filter->getRoute(), 'is_default' => isset($content['is_default']) ? 1 : 0 ]; $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Filter has been updated successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Filter has been updated successfully.'); } elseif($request->getMethod() == 'DELETE') { $id = $request->attributes->get('filterId'); @@ -128,7 +141,7 @@ public function savedFiltersXHR(Request $request) // $em->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Filter has been removed successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Filter has been removed successfully.'); } $response = new Response(json_encode($json)); diff --git a/Controller/Authentication.php b/Controller/Authentication.php index 755143c27..bfaccb21b 100644 --- a/Controller/Authentication.php +++ b/Controller/Authentication.php @@ -12,15 +12,32 @@ use Webkul\UVDesk\CoreFrameworkBundle\Utils\TokenGenerator; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; +use Symfony\Component\Translation\TranslatorInterface; class Authentication extends AbstractController { + private $userService; + private $authenticationUtils; + private $eventDispatcher; + private $translator; + + public function __construct(UserService $userService, AuthenticationUtils $authenticationUtils, EventDispatcher $eventDispatcher, TranslatorInterface $translator) + { + $this->userService = $userService; + $this->authenticationUtils = $authenticationUtils; + $this->eventDispatcher = $eventDispatcher; + $this->translator = $translator; + } + public function login(Request $request) { - if (null == $this->get('user.service')->getSessionUser()) { + if (null == $this->userService->getSessionUser()) { return $this->render('@UVDeskCoreFramework//login.html.twig', [ - 'last_username' => $this->get('security.authentication_utils')->getLastUsername(), - 'error' => $this->get('security.authentication_utils')->getLastAuthenticationError(), + 'last_username' => $this->authenticationUtils->getLastUsername(), + 'error' => $this->authenticationUtils->getLastAuthenticationError(), ]); } @@ -55,13 +72,13 @@ public function forgotPassword(Request $request) 'entity' => $user, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); - $this->addFlash('success', $this->get('translator')->trans('Please check your mail for password update')); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); + $this->addFlash('success', $this->translator->trans('Please check your mail for password update')); return $this->redirect($this->generateUrl('helpdesk_knowledgebase')); } else { - $this->addFlash('warning', $this->get('translator')->trans('This email address is not registered with us')); + $this->addFlash('warning', $this->translator->trans('This email address is not registered with us')); } } } @@ -75,7 +92,7 @@ public function updateCredentials($email, $verificationCode, Request $request, U $user = $entityManager->getRepository('UVDeskCoreFrameworkBundle:User')->findOneByEmail($email); if (empty($user) || $user->getVerificationCode() != $verificationCode) { - $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')); + $this->addFlash('success', $this->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 +107,11 @@ public function updateCredentials($email, $verificationCode, Request $request, U $entityManager->persist($user); $entityManager->flush(); - $this->addFlash('success', $this->get('translator')->trans('Your password has been successfully updated. Login using updated password')); + $this->addFlash('success', $this->translator->trans('Your password has been successfully updated. Login using updated password')); return $this->redirect($this->generateUrl('helpdesk_knowledgebase')); } else { - $this->addFlash('success', $this->get('translator')->trans('Please try again, The passwords do not match')); + $this->addFlash('success', $this->translator->trans('Please try again, The passwords do not match')); } } diff --git a/Controller/Customer.php b/Controller/Customer.php index c255dd5ec..18518a142 100755 --- a/Controller/Customer.php +++ b/Controller/Customer.php @@ -8,12 +8,27 @@ use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; +use Symfony\Component\Translation\TranslatorInterface; class Customer extends AbstractController -{ +{ + private $userService; + private $eventDispatcher; + private $translator; + + public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator) + { + $this->userService = $userService; + $this->eventDispatcher = $eventDispatcher; + $this->translator = $translator; + } + public function listCustomers(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -22,7 +37,7 @@ public function listCustomers(Request $request) public function createCustomer(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -35,7 +50,7 @@ public function createCustomer(Request $request) $validMimeType = ['image/jpeg', 'image/png', 'image/jpg']; if(isset($uploadedFiles['profileImage'])){ if(!in_array($uploadedFiles['profileImage']->getMimeType(), $validMimeType)){ - $this->addFlash('warning', $this->get('translator')->trans('Error ! Profile image is not valid, please upload a valid format')); + $this->addFlash('warning', $this->translator->trans('Error ! Profile image is not valid, please upload a valid format')); return $this->redirect($this->generateUrl('helpdesk_member_create_customer_account')); } } @@ -55,12 +70,12 @@ public function createCustomer(Request $request) 'image' => $uploadedFiles['profileImage'], ]); - $this->addFlash('success', $this->get('translator')->trans('Success ! Customer saved successfully.')); + $this->addFlash('success', $this->translator->trans('Success ! Customer saved successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_manage_customer_account_collection')); } } else { - $this->addFlash('warning', $this->get('translator')->trans('Error ! User with same email already exist.')); + $this->addFlash('warning', $this->translator->trans('Error ! User with same email already exist.')); } } @@ -72,7 +87,7 @@ public function createCustomer(Request $request) public function editCustomer(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -91,7 +106,7 @@ public function editCustomer(Request $request) $validMimeType = ['image/jpeg', 'image/png', 'image/jpg']; if(isset($contentFile['profileImage'])){ if(!in_array($contentFile['profileImage']->getMimeType(), $validMimeType)){ - $this->addFlash('warning', $this->get('translator')->trans('Error ! Profile image is not valid, please upload a valid format')); + $this->addFlash('warning', $this->translator->trans('Error ! Profile image is not valid, please upload a valid format')); return $this->render('@UVDeskCoreFramework/Customers/updateSupportCustomer.html.twig', ['user' => $user,'errors' => json_encode([])]); } } @@ -144,12 +159,12 @@ public function editCustomer(Request $request) 'entity' => $user, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); - $this->addFlash('success', $this->get('translator')->trans('Success ! Customer information updated successfully.')); + $this->addFlash('success', $this->translator->trans('Success ! Customer information updated successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_manage_customer_account_collection')); } else { - $this->addFlash('warning', $this->get('translator')->trans('Error ! User with same email is already exist.')); + $this->addFlash('warning', $this->translator->trans('Error ! User with same email is already exist.')); } } } elseif($request->getMethod() == "PUT") { @@ -185,10 +200,10 @@ public function editCustomer(Request $request) $em->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Customer updated successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Customer updated successfully.'); } else { $json['alertClass'] = 'error'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Customer with same email already exist.'); + $json['alertMessage'] = $this->translator->trans('Error ! Customer with same email already exist.'); } return new Response(json_encode($json), 200, []); @@ -210,7 +225,7 @@ protected function encodePassword(User $user, $plainPassword) public function bookmarkCustomer(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -234,13 +249,13 @@ public function bookmarkCustomer(Request $request) $em->persist($userInstance); $em->flush(); $json['alertClass'] = 'success'; - $json['message'] = $this->get('translator')->trans('unstarred Action Completed successfully'); + $json['message'] = $this->translator->trans('unstarred Action Completed successfully'); } else { $userInstance->setIsStarred(1); $em->persist($userInstance); $em->flush(); $json['alertClass'] = 'success'; - $json['message'] = $this->get('translator')->trans('starred Action Completed successfully'); + $json['message'] = $this->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 aa31e47e3..f07086422 100644 --- a/Controller/CustomerXHR.php +++ b/Controller/CustomerXHR.php @@ -14,7 +14,7 @@ class CustomerXHR extends AbstractController { public function listCustomersXHR(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -32,7 +32,7 @@ public function listCustomersXHR(Request $request) public function removeCustomerXHR(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -44,19 +44,19 @@ public function removeCustomerXHR(Request $request) if($user) { - $this->get('user.service')->removeCustomer($user); + $this->userService->removeCustomer($user); // Trigger customer created event $event = new GenericEvent(CoreWorkflowEvents\Customer\Delete::getId(), [ 'entity' => $user, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Customer removed successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Customer removed successfully.'); } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Invalid customer id.'); + $json['alertMessage'] = $this->translator->trans('Error ! Invalid customer id.'); $json['statusCode'] = Response::HTTP_NOT_FOUND; } } diff --git a/Controller/Email.php b/Controller/Email.php index 82f0420ba..a05ec589f 100755 --- a/Controller/Email.php +++ b/Controller/Email.php @@ -33,7 +33,7 @@ protected function getTemplate($request) public function templates(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_EMAIL_TEMPLATE')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_EMAIL_TEMPLATE')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -42,7 +42,7 @@ public function templates(Request $request) public function templateForm(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_EMAIL_TEMPLATE')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_EMAIL_TEMPLATE')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -76,9 +76,9 @@ public function templateForm(Request $request) $entityManager->flush(); if ($request->attributes->get('template')) { - $message = $this->get('translator')->trans('Success! Template has been updated successfully.'); + $message = $this->translator->trans('Success! Template has been updated successfully.'); } else { - $message = $this->get('translator')->trans('Success! Template has been added successfully.'); + $message = $this->translator->trans('Success! Template has been added successfully.'); } @@ -94,7 +94,7 @@ public function templateForm(Request $request) public function templatesxhr(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_EMAIL_TEMPLATE')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_EMAIL_TEMPLATE')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -118,7 +118,7 @@ public function templatesxhr(Request $request) $error = true; } else{ $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Warning! resource not found.'); + $json['alertMessage'] = $this->translator->trans('Warning! resource not found.'); $json['statusCode'] = Response::HTTP_NO_FOUND; } } @@ -127,7 +127,7 @@ public function templatesxhr(Request $request) if($error) { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Warning! You can not remove predefined email template which is being used in workflow(s).'); + $json['alertMessage'] = $this->translator->trans('Warning! You can not remove predefined email template which is being used in workflow(s).'); } $response = new Response(json_encode($json)); diff --git a/Controller/EmailSettings.php b/Controller/EmailSettings.php index 2fc8c408a..a765c28ff 100644 --- a/Controller/EmailSettings.php +++ b/Controller/EmailSettings.php @@ -10,7 +10,7 @@ class EmailSettings extends AbstractController { public function loadSettings() { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_ADMIN')) { + if (!$this->userService->isAccessAuthorized('ROLE_ADMIN')) { throw new AccessDeniedException("Insufficient account privileges"); } diff --git a/Controller/EmailSettingsXHR.php b/Controller/EmailSettingsXHR.php index 222c39773..a11bdefbc 100644 --- a/Controller/EmailSettingsXHR.php +++ b/Controller/EmailSettingsXHR.php @@ -49,7 +49,7 @@ public function updateSettingsXHR(Request $request) 'name' => $supportEmailConfiguration['name'], 'mailer_id' => $supportEmailConfiguration['mailer_id'], ], - 'alertMessage' => $this->get('translator')->trans('Success ! Email settings are updated successfully.'), + 'alertMessage' => $this->translator->trans('Success ! Email settings are updated successfully.'), ]; return new Response(json_encode($result), 200, ['Content-Type' => 'application/json']); diff --git a/Controller/Group.php b/Controller/Group.php index 6b621b41e..2ddf9932d 100755 --- a/Controller/Group.php +++ b/Controller/Group.php @@ -16,7 +16,7 @@ class Group extends AbstractController { public function listGroups(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -25,7 +25,7 @@ public function listGroups(Request $request) public function editGroup(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -123,7 +123,7 @@ public function editGroup(Request $request) $em->persist($group); $em->flush(); - $this->addFlash('success', $this->get('translator')->trans('Success ! Group information updated successfully.')); + $this->addFlash('success', $this->translator->trans('Success ! Group information updated successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_support_group_collection')); } @@ -135,7 +135,7 @@ public function editGroup(Request $request) public function createGroup(Request $request) { - if(!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')){ + if(!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -197,7 +197,7 @@ public function createGroup(Request $request) $em->persist($group); $em->flush(); - $this->addFlash('success', $this->get('translator')->trans('Success ! Group information saved successfully.')); + $this->addFlash('success', $this->translator->trans('Success ! Group information saved successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_support_group_collection')); } diff --git a/Controller/GroupXHR.php b/Controller/GroupXHR.php index 4b15b99d2..e4ec51ba6 100644 --- a/Controller/GroupXHR.php +++ b/Controller/GroupXHR.php @@ -9,7 +9,7 @@ class GroupXHR extends AbstractController { public function listGroupsXHR(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -24,7 +24,7 @@ public function listGroupsXHR(Request $request) public function deleteGroupXHR($supportGroupId) { - if(!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')) { + if(!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } diff --git a/Controller/Privilege.php b/Controller/Privilege.php index 789403493..725e24998 100755 --- a/Controller/Privilege.php +++ b/Controller/Privilege.php @@ -11,7 +11,7 @@ class Privilege extends AbstractController { public function listPrivilege(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -20,13 +20,13 @@ public function listPrivilege(Request $request) public function createPrivilege(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } $formErrors = []; $supportPrivilege = new SupportPrivilege(); - $supportPrivilegeResources = $this->get('uvdesk.service')->getSupportPrivelegesResources(); + $supportPrivilegeResources = $this->uvdeskService->getSupportPrivelegesResources(); if ('POST' == $request->getMethod()) { $entityManager = $this->getDoctrine()->getManager(); @@ -38,7 +38,7 @@ public function createPrivilege(Request $request) $entityManager->persist($supportPrivilege); $entityManager->flush(); - $this->addFlash('success', $this->get('translator')->trans('Success ! Privilege information saved successfully.')); + $this->addFlash('success', $this->translator->trans('Success ! Privilege information saved successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_privilege_collection')); } @@ -51,7 +51,7 @@ public function createPrivilege(Request $request) public function editPrivilege($supportPrivilegeId) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -65,7 +65,7 @@ public function editPrivilege($supportPrivilegeId) } $formErrors = []; - $supportPrivilegeResources = $this->get('uvdesk.service')->getSupportPrivelegesResources(); + $supportPrivilegeResources = $this->uvdeskService->getSupportPrivelegesResources(); if ('POST' == $request->getMethod()) { $supportPrivilegeDetails = $request->request->get('privilege_form'); @@ -77,7 +77,7 @@ public function editPrivilege($supportPrivilegeId) $entityManager->persist($supportPrivilege); $entityManager->flush(); - $this->addFlash('success', $this->get('translator')->trans('Privilege updated successfully.')); + $this->addFlash('success', $this->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 b49206b40..f9b4620cc 100644 --- a/Controller/PrivilegeXHR.php +++ b/Controller/PrivilegeXHR.php @@ -13,7 +13,7 @@ class PrivilegeXHR extends AbstractController { public function listPrivilegeXHR(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -28,7 +28,7 @@ public function listPrivilegeXHR(Request $request) public function deletePrivilegeXHR($supportPrivilegeId) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -44,7 +44,7 @@ public function deletePrivilegeXHR($supportPrivilegeId) return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Support Privilege removed successfully'), + 'alertMessage' => $this->translator->trans('Support Privilege removed successfully'), ]), 200, ['Content-Type' => 'application/json']); } } diff --git a/Controller/SavedReplies.php b/Controller/SavedReplies.php index f96110f78..263cbea25 100755 --- a/Controller/SavedReplies.php +++ b/Controller/SavedReplies.php @@ -42,7 +42,7 @@ public function updateSavedReplies(Request $request) $errors = []; if ($request->getMethod() == 'POST') { if (empty($request->request->get('message'))) { - $this->addFlash('warning', $this->get('translator')->trans('Error! Saved reply body can not be blank')); + $this->addFlash('warning', $this->translator->trans('Error! Saved reply body can not be blank')); return $this->render('@UVDeskCoreFramework//savedReplyForm.html.twig', [ 'template' => $template, @@ -114,7 +114,7 @@ public function updateSavedReplies(Request $request) $em->persist($template); $em->flush(); - $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.')); + $this->addFlash('success', $request->attributes->get('template') ? $this->translator->trans('Success! Reply has been updated successfully.'): $this->translator->trans('Success! Reply has been added successfully.')); return $this->redirectToRoute('helpdesk_member_saved_replies'); } @@ -154,7 +154,7 @@ public function savedRepliesXHR(Request $request) $responseContent = [ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Success! Saved Reply has been deleted successfully.') + 'alertMessage' => $this->translator->trans('Success! Saved Reply has been deleted successfully.') ]; } diff --git a/Controller/SwiftMailer.php b/Controller/SwiftMailer.php index f601fd830..bbdae6efd 100644 --- a/Controller/SwiftMailer.php +++ b/Controller/SwiftMailer.php @@ -13,7 +13,7 @@ class SwiftMailer extends AbstractController { public function loadMailers() { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_ADMIN')) { + if (!$this->userService->isAccessAuthorized('ROLE_ADMIN')) { throw new AccessDeniedException("Insufficient account privileges"); } @@ -36,7 +36,7 @@ public function createMailerConfiguration(Request $request) try { $swiftmailer->writeSwiftMailerConfigurations($configurations); - $this->addFlash('success', $this->get('translator')->trans('SwiftMailer configuration created successfully.')); + $this->addFlash('success', $this->translator->trans('SwiftMailer configuration created successfully.')); return new RedirectResponse($this->generateUrl('helpdesk_member_swiftmailer_settings')); } catch (\Exception $e) { $this->addFlash('warning', $e->getMessage()); @@ -77,7 +77,7 @@ public function updateMailerConfiguration($id, Request $request) $swiftmailerConfigurations[$index] = $swiftmailerConfiguration; $swiftmailerService->writeSwiftMailerConfigurations($swiftmailerConfigurations); - $this->addFlash('success', $this->get('translator')->trans('SwiftMailer configuration updated successfully.')); + $this->addFlash('success', $this->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 614331b8f..78fa6605f 100644 --- a/Controller/SwiftMailerXHR.php +++ b/Controller/SwiftMailerXHR.php @@ -53,14 +53,14 @@ public function removeMailerConfiguration(Request $request) return new JsonResponse([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Swiftmailer configuration removed successfully.'), + 'alertMessage' => $this->translator->trans('Swiftmailer configuration removed successfully.'), ]); } } return new JsonResponse([ 'alertClass' => 'error', - 'alertMessage' => $this->get('translator')->trans('No swiftmailer configurations found for mailer id:') . $params['id'], + 'alertMessage' => $this->translator->trans('No swiftmailer configurations found for mailer id:') . $params['id'], ], 404); } } diff --git a/Controller/Team.php b/Controller/Team.php index 1a6f73c1d..54f1e1f7a 100755 --- a/Controller/Team.php +++ b/Controller/Team.php @@ -25,7 +25,7 @@ public function __construct(TranslatorInterface $translator) public function listTeams(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -34,7 +34,7 @@ public function listTeams(Request $request) public function createTeam(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -93,7 +93,7 @@ public function createTeam(Request $request) $em->persist($supportTeam); $em->flush(); - $this->addFlash('success', $this->get('translator')->trans('Success ! Team information saved successfully.')); + $this->addFlash('success', $this->translator->trans('Success ! Team information saved successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_support_team_collection')); } @@ -106,7 +106,7 @@ public function createTeam(Request $request) public function editTeam(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } diff --git a/Controller/TeamXHR.php b/Controller/TeamXHR.php index b9d95a28d..29f153fed 100755 --- a/Controller/TeamXHR.php +++ b/Controller/TeamXHR.php @@ -13,7 +13,7 @@ class TeamXHR extends AbstractController { public function listTeamsXHR(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -28,7 +28,7 @@ public function listTeamsXHR(Request $request) public function deleteTeamXHR($supportTeamId, TranslatorInterface $translator) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -44,7 +44,7 @@ public function deleteTeamXHR($supportTeamId, TranslatorInterface $translator) return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Support Team removed successfully.'), + 'alertMessage' => $this->translator->trans('Support Team removed successfully.'), ]), 200, ['Content-Type' => 'application/json']); } } diff --git a/Controller/Thread.php b/Controller/Thread.php index d3cc3703e..3d1a30065 100755 --- a/Controller/Thread.php +++ b/Controller/Thread.php @@ -30,7 +30,7 @@ public function saveThread($ticketId, Request $request) if (empty($params)) { return $this->redirect($request->headers->get('referer') ?: $this->generateUrl('helpdesk_member_ticket_collection')); - } else if ('note' == $params['threadType'] && false == $this->get('user.service')->isAccessAuthorized('ROLE_AGENT_ADD_NOTE')) { + } else if ('note' == $params['threadType'] && false == $this->userService->isAccessAuthorized('ROLE_AGENT_ADD_NOTE')) { // Insufficient user privilege to create a note throw new \Exception('Insufficient Permisions', 400); } @@ -44,7 +44,7 @@ public function saveThread($ticketId, Request $request) $parsedMessage = str_replace(' ', '', $parsedMessage); if (null == $parsedMessage) { - $this->addFlash('warning', $this->get('translator')->trans('Reply content cannot be left blank.')); + $this->addFlash('warning', $this->translator->trans('Reply content cannot be left blank.')); } // @TODO: Validate file attachments @@ -97,10 +97,10 @@ public function saveThread($ticketId, Request $request) 'thread' => $thread ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); // @TODO: Render response on the basis of event response (if propogation was stopped or not) - $this->addFlash('success', $this->get('translator')->trans('Note added to ticket successfully.')); + $this->addFlash('success', $this->translator->trans('Note added to ticket successfully.')); break; case 'reply': $event = new GenericEvent(CoreWorkflowEvents\Ticket\AgentReply::getId(), [ @@ -108,10 +108,10 @@ public function saveThread($ticketId, Request $request) 'thread' => $thread ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); // @TODO: Render response on the basis of event response (if propogation was stopped or not) - $this->addFlash('success', $this->get('translator')->trans('Reply added to ticket successfully.')); + $this->addFlash('success', $this->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) - $this->addFlash('success', $this->get('translator')->trans('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; @@ -154,7 +154,7 @@ public function saveThread($ticketId, Request $request) // Check if ticket status needs to be updated $updateTicketToStatus = !empty($params['status']) ? (trim($params['status']) ?: null) : null; - if (!empty($updateTicketToStatus) && $this->get('user.service')->isAccessAuthorized('ROLE_AGENT_UPDATE_TICKET_STATUS')) { + if (!empty($updateTicketToStatus) && $this->userService->isAccessAuthorized('ROLE_AGENT_UPDATE_TICKET_STATUS')) { $ticketStatus = $entityManager->getRepository(TicketStatus::class)->findOneById($updateTicketToStatus); if (!empty($ticketStatus) && $ticketStatus->getId() === $ticket->getStatus()->getId()) { @@ -197,12 +197,12 @@ public function updateThreadXHR(Request $request) 'entity' => $ticket, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); - $json['alertMessage'] = $this->get('translator')->trans('Success ! Thread updated successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Thread updated successfully.'); $json['alertClass'] = 'success'; } else { - $json['alertMessage'] = $this->get('translator')->trans('Error ! Reply field can not be blank.'); + $json['alertMessage'] = $this->translator->trans('Error ! Reply field can not be blank.'); $json['alertClass'] = 'error'; } } @@ -224,15 +224,15 @@ public function threadXHR(Request $request) // $event = new GenericEvent(CoreWorkflowEvents\Ticket\ThreadUpdate::getId(), [ // 'entity' => $ticket, // ]); - // $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + // $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); $em->remove($thread); $em->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Thread removed successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Thread removed successfully.'); } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Invalid thread.'); + $json['alertMessage'] = $this->translator->trans('Error ! Invalid thread.'); } } elseif ($request->getMethod() == "PATCH") { $thread = $em->getRepository(TicketThread::class)->findOneBy(array('id' => $request->attributes->get('threadId'), 'ticket' => $content['ticketId'])); @@ -243,19 +243,19 @@ public function threadXHR(Request $request) $em->persist($thread); $em->flush(); - $json['alertMessage'] = $this->get('translator')->trans($content['isLocked'] ? 'Success ! Thread locked successfully.' : 'Success ! Thread unlocked successfully.'); + $json['alertMessage'] = $this->translator->trans($content['isLocked'] ? 'Success ! Thread locked successfully.' : 'Success ! Thread unlocked successfully.'); $json['alertClass'] = 'success'; } elseif ($content['updateType'] == 'bookmark') { $thread->setIsBookmarked($content['bookmark']); $em->persist($thread); $em->flush(); - $json['alertMessage'] = $this->get('translator')->trans($content['bookmark'] ? 'Success ! Thread pinned successfully.' : 'Success ! unpinned removed successfully.'); + $json['alertMessage'] = $this->translator->trans($content['bookmark'] ? 'Success ! Thread pinned successfully.' : 'Success ! unpinned removed successfully.'); $json['alertClass'] = 'success'; } } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Invalid thread.'); + $json['alertMessage'] = $this->translator->trans('Error ! Invalid thread.'); } } diff --git a/Controller/Ticket.php b/Controller/Ticket.php index 22742f9ae..dbe4d30ad 100755 --- a/Controller/Ticket.php +++ b/Controller/Ticket.php @@ -38,7 +38,7 @@ public function loadTicket($ticketId, QuickActionButtonCollection $quickActionBu throw new \Exception('Page not found'); } - $user = $this->get('user.service')->getSessionUser(); + $user = $this->userService->getSessionUser(); // Proceed only if user has access to the resource if (false == $this->get('ticket.service')->isTicketAccessGranted($ticket, $user)) { @@ -82,7 +82,7 @@ public function saveTicket(Request $request) $entityManager = $this->getDoctrine()->getManager(); $response = $this->redirect($this->generateUrl('helpdesk_member_ticket_collection')); - if ($request->getMethod() != 'POST' || false == $this->get('user.service')->isAccessAuthorized('ROLE_AGENT_CREATE_TICKET')) { + if ($request->getMethod() != 'POST' || false == $this->userService->isAccessAuthorized('ROLE_AGENT_CREATE_TICKET')) { return $response; } @@ -134,7 +134,7 @@ public function saveTicket(Request $request) $role = $entityManager->getRepository('UVDeskCoreFrameworkBundle:SupportRole')->findOneByCode('ROLE_CUSTOMER'); // Create User Instance - $customer = $this->get('user.service')->createUserInstance($ticketProxy->getFrom(), $ticketProxy->getName(), $role, [ + $customer = $this->userService->createUserInstance($ticketProxy->getFrom(), $ticketProxy->getName(), $role, [ 'source' => 'website', 'active' => true ]); @@ -169,7 +169,7 @@ public function saveTicket(Request $request) 'entity' => $thread->getTicket(), ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); } catch (\Exception $e) { // Skip Automation } @@ -178,11 +178,11 @@ public function saveTicket(Request $request) $ticket = $thread->getTicket(); $request->getSession()->getFlashBag()->set('success', sprintf('Success! Ticket #%s has been created successfully.', $ticket->getId())); - if ($this->get('user.service')->isAccessAuthorized('ROLE_ADMIN')) { + if ($this->userService->isAccessAuthorized('ROLE_ADMIN')) { return $this->redirect($this->generateUrl('helpdesk_member_ticket', ['ticketId' => $ticket->getId()])); } } else { - $this->addFlash('warning', $this->get('translator')->trans('Could not create ticket, invalid details.')); + $this->addFlash('warning', $this->translator->trans('Could not create ticket, invalid details.')); } return $this->redirect(!empty($referralURL) ? $referralURL : $this->generateUrl('helpdesk_member_ticket_collection')); @@ -190,7 +190,7 @@ public function saveTicket(Request $request) public function listTicketTypeCollection(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_TICKET_TYPE')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_TICKET_TYPE')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -199,7 +199,7 @@ public function listTicketTypeCollection(Request $request) public function ticketType(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_TICKET_TYPE')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_TICKET_TYPE')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -230,9 +230,9 @@ public function ticketType(Request $request) $em->flush(); if (!$request->attributes->get('ticketTypeId')) { - $this->addFlash('success', $this->get('translator')->trans('Success! Ticket type saved successfully.')); + $this->addFlash('success', $this->translator->trans('Success! Ticket type saved successfully.')); } else { - $this->addFlash('success', $this->get('translator')->trans('Success! Ticket type updated successfully.')); + $this->addFlash('success', $this->translator->trans('Success! Ticket type updated successfully.')); } return $this->redirect($this->generateUrl('helpdesk_member_ticket_type_collection')); @@ -247,7 +247,7 @@ public function ticketType(Request $request) public function listTagCollection(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_TAG')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_TAG')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -260,7 +260,7 @@ public function listTagCollection(Request $request) public function removeTicketTagXHR($tagId, Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_TAG')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_TAG')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -272,7 +272,7 @@ public function removeTicketTagXHR($tagId, Request $request) $em->remove($tag); $em->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Tag removed successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Tag removed successfully.'); } } @@ -303,8 +303,8 @@ public function trashTicket(Request $request) 'entity' => $ticket, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); - $this->addFlash('success', $this->get('translator')->trans('Success ! Ticket moved to trash successfully.')); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); + $this->addFlash('success', $this->translator->trans('Success ! Ticket moved to trash successfully.')); return $this->redirectToRoute('helpdesk_member_ticket_collection'); } diff --git a/Controller/TicketXHR.php b/Controller/TicketXHR.php index 42fb12863..323c75fa2 100755 --- a/Controller/TicketXHR.php +++ b/Controller/TicketXHR.php @@ -54,12 +54,12 @@ public function ticketLabelXHR(Request $request) $label->setName($data['name']); if(isset($data['colorCode'])) $label->setColorCode($data['colorCode']); - $label->setUser($this->get('user.service')->getCurrentUser()); + $label->setUser($this->userService->getCurrentUser()); $em->persist($label); $em->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Label created successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Label created successfully.'); $json['label'] = json_encode([ 'id' => $label->getId(), 'name' => $label->getName(), @@ -68,7 +68,7 @@ public function ticketLabelXHR(Request $request) ]); } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Label name can not be blank.'); + $json['alertMessage'] = $this->translator->trans('Error ! Label name can not be blank.'); } } elseif($method == "PUT") { $data = json_decode($content, true); @@ -88,10 +88,10 @@ public function ticketLabelXHR(Request $request) 'labelUser' => $label->getUser()->getId(), ]); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Label updated successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Label updated successfully.'); } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Invalid label id.'); + $json['alertMessage'] = $this->translator->trans('Error ! Invalid label id.'); } } elseif($method == "DELETE") { $label = $em->getRepository('UVDeskCoreFrameworkBundle:SupportLabel')->findOneBy(array('id' => $request->attributes->get('ticketLabelId'))); @@ -99,10 +99,10 @@ public function ticketLabelXHR(Request $request) $em->remove($label); $em->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Label removed successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Label removed successfully.'); } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Invalid label id.'); + $json['alertMessage'] = $this->translator->trans('Error ! Invalid label id.'); } } @@ -122,10 +122,10 @@ public function updateTicketDetails(Request $request) $message = ''; if ($request->request->get('subject') == '') { $error = true; - $message = $this->get('translator')->trans('Error! Subject field is mandatory'); + $message = $this->translator->trans('Error! Subject field is mandatory'); } elseif ($request->request->get('reply') == '') { $error = true; - $message = $this->get('translator')->trans('Error! Reply field is mandatory'); + $message = $this->translator->trans('Error! Reply field is mandatory'); } if (!$error) { @@ -138,7 +138,7 @@ public function updateTicketDetails(Request $request) $entityManager->persist($ticket); $entityManager->flush(); - $this->addFlash('success', $this->get('translator')->trans('Success ! Ticket has been updated successfully.')); + $this->addFlash('success', $this->translator->trans('Success ! Ticket has been updated successfully.')); } else { $this->addFlash('warning', $message); } @@ -160,7 +160,7 @@ public function updateTicketAttributes($ticketId) if (empty($ticket)) { $responseContent = [ 'alertClass' => 'danger', - 'alertMessage' => $this->get('translator')->trans('Unable to retrieve details for ticket #%ticketId%.', [ + 'alertMessage' => $this->translator->trans('Unable to retrieve details for ticket #%ticketId%.', [ '%ticketId%' => $ticketId, ]), ]; @@ -169,7 +169,7 @@ public function updateTicketAttributes($ticketId) } else if (!isset($requestContent['attribute'])) { $responseContent = [ 'alertClass' => 'danger', - 'alertMessage' => $this->get('translator')->trans('Insufficient details provided.'), + 'alertMessage' => $this->translator->trans('Insufficient details provided.'), ]; return new Response(json_encode($responseContent), 400, ['Content-Type' => 'application/json']); } @@ -183,7 +183,7 @@ public function updateTicketAttributes($ticketId) // User does not exist return new Response(json_encode([ 'alertClass' => 'danger', - 'alertMessage' => $this->get('translator')->trans('Unable to retrieve agent details'), + 'alertMessage' => $this->translator->trans('Unable to retrieve agent details'), ]), 404, ['Content-Type' => 'application/json']); } else { // Check if an agent instance exists for the user @@ -193,7 +193,7 @@ public function updateTicketAttributes($ticketId) // Agent does not exist return new Response(json_encode([ 'alertClass' => 'danger', - 'alertMessage' => $this->get('translator')->trans('Unable to retrieve agent details'), + 'alertMessage' => $this->translator->trans('Unable to retrieve agent details'), ]), 404, ['Content-Type' => 'application/json']); } } @@ -204,7 +204,7 @@ public function updateTicketAttributes($ticketId) if ($ticket->getAgent() && $agent->getId() === $ticket->getAgent()->getId()) { return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Ticket already assigned to %agent%', [ + 'alertMessage' => $this->translator->trans('Ticket already assigned to %agent%', [ '%agent%' => $agentDetails['name'], ]), ]), 200, ['Content-Type' => 'application/json']); @@ -219,11 +219,11 @@ public function updateTicketAttributes($ticketId) 'entity' => $ticket, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Ticket successfully assigned to %agent%', [ + 'alertMessage' => $this->translator->trans('Ticket successfully assigned to %agent%', [ '%agent%' => $agentDetails['name'], ]), ]), 200, ['Content-Type' => 'application/json']); @@ -236,14 +236,14 @@ public function updateTicketAttributes($ticketId) // Selected ticket status does not exist return new Response(json_encode([ 'alertClass' => 'danger', - 'alertMessage' => $this->get('translator')->trans('Unable to retrieve status details'), + 'alertMessage' => $this->translator->trans('Unable to retrieve status details'), ]), 404, ['Content-Type' => 'application/json']); } if ($ticketStatus->getId() === $ticket->getStatus()->getId()) { return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Ticket status already set to %status%', [ + 'alertMessage' => $this->translator->trans('Ticket status already set to %status%', [ '%status%' => $ticketStatus->getDescription() ]), ]), 200, ['Content-Type' => 'application/json']); @@ -258,11 +258,11 @@ public function updateTicketAttributes($ticketId) 'entity' => $ticket, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Ticket status update to %status%', [ + 'alertMessage' => $this->translator->trans('Ticket status update to %status%', [ '%status%' => $ticketStatus->getDescription() ]), ]), 200, ['Content-Type' => 'application/json']); @@ -276,14 +276,14 @@ public function updateTicketAttributes($ticketId) // Selected ticket priority does not exist return new Response(json_encode([ 'alertClass' => 'danger', - 'alertMessage' => $this->get('translator')->trans('Unable to retrieve priority details'), + 'alertMessage' => $this->translator->trans('Unable to retrieve priority details'), ]), 404, ['Content-Type' => 'application/json']); } if ($ticketPriority->getId() === $ticket->getPriority()->getId()) { return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Ticket priority already set to %priority%', [ + 'alertMessage' => $this->translator->trans('Ticket priority already set to %priority%', [ '%priority%' => $ticketPriority->getDescription() ]), ]), 200, ['Content-Type' => 'application/json']); @@ -298,11 +298,11 @@ public function updateTicketAttributes($ticketId) 'entity' => $ticket, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Ticket priority updated to %priority%', [ + 'alertMessage' => $this->translator->trans('Ticket priority updated to %priority%', [ '%priority%' => $ticketPriority->getDescription() ]), ]), 200, ['Content-Type' => 'application/json']); @@ -322,13 +322,13 @@ public function updateTicketAttributes($ticketId) $responseCode = 200; $response = [ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Ticket support group updated successfully'), + 'alertMessage' => $this->translator->trans('Ticket support group updated successfully'), ]; } else { $responseCode = 404; $response = [ 'alertClass' => 'danger', - 'alertMessage' => $this->get('translator')->trans('Unable to retrieve support group details'), + 'alertMessage' => $this->translator->trans('Unable to retrieve support group details'), ]; } @@ -350,11 +350,11 @@ public function updateTicketAttributes($ticketId) 'entity' => $ticket, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Ticket assigned to support group '). $supportGroup->getName(), + 'alertMessage' => $this->translator->trans('Ticket assigned to support group '). $supportGroup->getName(), ]), 200, ['Content-Type' => 'application/json']); } break; @@ -372,13 +372,13 @@ public function updateTicketAttributes($ticketId) $responseCode = 200; $response = [ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Ticket support team updated successfully'), + 'alertMessage' => $this->translator->trans('Ticket support team updated successfully'), ]; } else { $responseCode = 404; $response = [ 'alertClass' => 'danger', - 'alertMessage' => $this->get('translator')->trans('Unable to retrieve support team details'), + 'alertMessage' => $this->translator->trans('Unable to retrieve support team details'), ]; } @@ -400,7 +400,7 @@ public function updateTicketAttributes($ticketId) 'entity' => $ticket, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); return new Response(json_encode([ 'alertClass' => 'success', @@ -436,7 +436,7 @@ public function updateTicketAttributes($ticketId) 'entity' => $ticket, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); return new Response(json_encode([ 'alertClass' => 'success', @@ -453,7 +453,7 @@ public function updateTicketAttributes($ticketId) return new Response(json_encode([ 'alertClass' => 'success', - 'alertMessage' => $this->get('translator')->trans('Success ! Ticket to label removed successfully.'), + 'alertMessage' => $this->translator->trans('Success ! Ticket to label removed successfully.'), ]), 200, ['Content-Type' => 'application/json']); } break; @@ -500,7 +500,7 @@ public function saveTicketLabel(Request $request) if ('POST' == $request->getMethod()) { $responseContent = []; - $user = $this->get('user.service')->getSessionUser(); + $user = $this->userService->getSessionUser(); $supportLabel = $entityManager->getRepository('UVDeskCoreFrameworkBundle:SupportLabel')->findOneBy([ 'user' => $user->getId(), 'name' => $requestContent['name'], @@ -523,7 +523,7 @@ public function saveTicketLabel(Request $request) $entityManager->flush(); $responseContent['alertClass'] = 'success'; - $responseContent['alertMessage'] = $this->get('translator')->trans( + $responseContent['alertMessage'] = $this->translator->trans( 'Label %label% added to ticket successfully', [ '%label%' => $supportLabel->getName(), ]); @@ -542,13 +542,13 @@ public function saveTicketLabel(Request $request) $entityManager->flush(); $responseContent['alertClass'] = 'success'; - $responseContent['alertMessage'] = $this->get('translator')->trans( + $responseContent['alertMessage'] = $this->translator->trans( 'Label %label% added to ticket successfully', [ '%label%' => $supportLabel->getName(), ]); } else { $responseContent['alertClass'] = 'warning'; - $responseContent['alertMessage'] = $this->get('translator')->trans( + $responseContent['alertMessage'] = $this->translator->trans( 'Label %label% already added to ticket', [ '%label%' => $supportLabel->getName(), ]); @@ -593,16 +593,16 @@ public function loadTicketSearchFilterOptions(Request $request) if (true === $request->isXmlHttpRequest()) { switch ($request->query->get('type')) { case 'agent': - $filtersResponse = $this->get('user.service')->getAgentPartialDataCollection($request); + $filtersResponse = $this->userService->getAgentPartialDataCollection($request); break; case 'customer': - $filtersResponse = $this->get('user.service')->getCustomersPartial($request); + $filtersResponse = $this->userService->getCustomersPartial($request); break; case 'group': - $filtersResponse = $this->get('user.service')->getGroups($request); + $filtersResponse = $this->userService->getGroups($request); break; case 'team': - $filtersResponse = $this->get('user.service')->getSubGroups($request); + $filtersResponse = $this->userService->getSubGroups($request); break; case 'tag': $filtersResponse = $this->get('ticket.service')->getTicketTags($request); @@ -613,7 +613,7 @@ public function loadTicketSearchFilterOptions(Request $request) $supportLabelQuery = $entityManager->createQueryBuilder()->select('supportLabel') ->from('UVDeskCoreFrameworkBundle:SupportLabel', 'supportLabel') - ->where('supportLabel.user = :user')->setParameter('user', $this->get('user.service')->getSessionUser()); + ->where('supportLabel.user = :user')->setParameter('user', $this->userService->getSessionUser()); if (!empty($searchTerm)) { $supportLabelQuery->andWhere('supportLabel.name LIKE :labelName')->setParameter('labelName', '%' . urldecode($searchTerm) . '%'); @@ -635,13 +635,13 @@ public function loadTicketCollectionSearchFilterOptionsXHR(Request $request) $json = []; if ($request->isXmlHttpRequest()) { if ($request->query->get('type') == 'agent') { - $json = $this->get('user.service')->getAgentsPartialDetails($request); + $json = $this->userService->getAgentsPartialDetails($request); } elseif ($request->query->get('type') == 'customer') { - $json = $this->get('user.service')->getCustomersPartial($request); + $json = $this->userService->getCustomersPartial($request); } elseif ($request->query->get('type') == 'group') { - $json = $this->get('user.service')->getGroups($request); + $json = $this->userService->getGroups($request); } elseif ($request->query->get('type') == 'team') { - $json = $this->get('user.service')->getSubGroups($request); + $json = $this->userService->getSubGroups($request); } elseif ($request->query->get('type') == 'tag') { $json = $this->get('ticket.service')->getTicketTags($request); } elseif ($request->query->get('type') == 'label') { @@ -654,7 +654,7 @@ public function loadTicketCollectionSearchFilterOptionsXHR(Request $request) public function listTicketTypeCollectionXHR(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_TICKET_TYPE')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_TICKET_TYPE')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -669,7 +669,7 @@ public function listTicketTypeCollectionXHR(Request $request) public function removeTicketTypeXHR($typeId, Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_TICKET_TYPE')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_TICKET_TYPE')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -688,7 +688,7 @@ public function removeTicketTypeXHR($typeId, Request $request) $em->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Type removed successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Type removed successfully.'); } $response = new Response(json_encode($json)); @@ -698,7 +698,7 @@ public function removeTicketTypeXHR($typeId, Request $request) public function listTagCollectionXHR(Request $request) { - if (!$this->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_TAG')) { + if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_TAG')) { return $this->redirect($this->generateUrl('helpdesk_member_dashboard')); } @@ -721,8 +721,8 @@ public function applyTicketPreparedResponseXHR(Request $request) 'entity' => $ticket ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.prepared_response.execute', $event); - $this->addFlash('success', $this->get('translator')->trans('Success ! Prepared Response applied successfully.')); + $this->eventDispatcher->dispatch('uvdesk.automation.prepared_response.execute', $event); + $this->addFlash('success', $this->translator->trans('Success ! Prepared Response applied successfully.')); return $this->redirect($this->generateUrl('helpdesk_member_ticket',['ticketId' => $ticketId])); } @@ -764,10 +764,10 @@ public function createTicketTagXHR(Request $request) $em->persist($ticket); $em->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Tag added successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Tag added successfully.'); } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Please enter tag name.'); + $json['alertMessage'] = $this->translator->trans('Please enter tag name.'); } } elseif($request->getMethod() == "DELETE") { $tag = $em->getRepository('UVDeskCoreFrameworkBundle:Tag')->findOneBy(array('id' => $request->attributes->get('id'))); @@ -782,11 +782,11 @@ public function createTicketTagXHR(Request $request) $em->persist($ticket); $em->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Tag unassigned successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Tag unassigned successfully.'); } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Invalid tag.'); + $json['alertMessage'] = $this->translator->trans('Error ! Invalid tag.'); } } @@ -800,13 +800,13 @@ public function getSearchFilterOptionsXhr(Request $request) $json = []; if ($request->isXmlHttpRequest()) { if($request->query->get('type') == 'agent') { - $json = $this->get('user.service')->getAgentsPartialDetails($request); + $json = $this->userService->getAgentsPartialDetails($request); } elseif($request->query->get('type') == 'customer') { - $json = $this->get('user.service')->getCustomersPartial($request); + $json = $this->userService->getCustomersPartial($request); } elseif($request->query->get('type') == 'group') { - $json = $this->get('user.service')->getSupportGroups($request); + $json = $this->userService->getSupportGroups($request); } elseif($request->query->get('type') == 'team') { - $json = $this->get('user.service')->getSupportTeams($request); + $json = $this->userService->getSupportTeams($request); } elseif($request->query->get('type') == 'tag') { $json = $this->get('ticket.service')->getTicketTags($request); } elseif($request->query->get('type') == 'label') { @@ -828,7 +828,7 @@ public function updateCollaboratorXHR(Request $request) if($request->getMethod() == "POST") { if($content['email'] == $ticket->getCustomer()->getEmail()) { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Customer can not be added as collaborator.'); + $json['alertMessage'] = $this->translator->trans('Error ! Customer can not be added as collaborator.'); } else { $data = array( 'from' => $content['email'], @@ -839,7 +839,7 @@ public function updateCollaboratorXHR(Request $request) $supportRole = $em->getRepository('UVDeskCoreFrameworkBundle:SupportRole')->findOneByCode('ROLE_CUSTOMER'); - $collaborator = $this->get('user.service')->createUserInstance($data['from'], $data['firstName'], $supportRole, $extras = ["active" => true]); + $collaborator = $this->userService->createUserInstance($data['from'], $data['firstName'], $supportRole, $extras = ["active" => true]); $checkTicket = $em->getRepository('UVDeskCoreFrameworkBundle:Ticket')->isTicketCollaborator($ticket, $content['email']); if (!$checkTicket) { @@ -858,14 +858,14 @@ public function updateCollaboratorXHR(Request $request) 'entity' => $ticket, ]); - $this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event); + $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Collaborator added successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Collaborator added successfully.'); } else { $json['alertClass'] = 'danger'; $message = "Collaborator is already added."; - $json['alertMessage'] = $this->get('translator')->trans('Error ! ' . $message); + $json['alertMessage'] = $this->translator->trans('Error ! ' . $message); } } } elseif($request->getMethod() == "DELETE") { @@ -876,10 +876,10 @@ public function updateCollaboratorXHR(Request $request) $em->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Collaborator removed successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Collaborator removed successfully.'); } else { $json['alertClass'] = 'danger'; - $json['alertMessage'] = $this->get('translator')->trans('Error ! Invalid Collaborator.'); + $json['alertMessage'] = $this->translator->trans('Error ! Invalid Collaborator.'); } } @@ -917,7 +917,7 @@ public function updateTicketTagXHR(Request $request, $tagId) } $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Tag updated successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Tag updated successfully.'); } $response = new Response(json_encode($json)); @@ -935,7 +935,7 @@ public function removeTicketTagXHR($tagId) $entityManager->flush(); $json['alertClass'] = 'success'; - $json['alertMessage'] = $this->get('translator')->trans('Success ! Tag removed successfully.'); + $json['alertMessage'] = $this->translator->trans('Success ! Tag removed successfully.'); } $response = new Response(json_encode($json)); From afecf7769827c4dc61c32b5ccb562392798f0302 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Tue, 1 Sep 2020 18:24:59 +0530 Subject: [PATCH 04/85] controller updates --- Controller/Account.php | 14 ++++++++----- Controller/AccountXHR.php | 3 ++- Controller/Customer.php | 9 ++++++--- Controller/CustomerXHR.php | 15 +++++++++++++- Controller/Email.php | 14 ++++++++++++- Controller/EmailSettings.php | 16 ++++++++++++++- Controller/EmailSettingsXHR.php | 20 +++++++++++++++--- Controller/Group.php | 12 +++++++++++ Controller/GroupXHR.php | 11 ++++++++++ Controller/Privilege.php | 14 +++++++++++++ Controller/PrivilegeXHR.php | 11 ++++++++++ Controller/SavedReplies.php | 13 +++++++++++- Controller/SwiftMailer.php | 18 +++++++++++++++-- Controller/SwiftMailerXHR.php | 15 ++++++++++++-- Controller/Team.php | 12 +++++------ Controller/TeamXHR.php | 12 ++++++++++- Controller/Thread.php | 24 ++++++++++++++++++++-- Controller/ThreadXHR.php | 11 ++++++++-- Controller/Ticket.php | 21 +++++++++++++++++++ Controller/TicketXHR.php | 21 +++++++++++++++++++ Repository/TicketRepository.php | 4 ++-- Services/TicketService.php | 36 ++++++++++++++++----------------- 22 files changed, 275 insertions(+), 51 deletions(-) diff --git a/Controller/Account.php b/Controller/Account.php index 4c161c97a..4ec65fce3 100755 --- a/Controller/Account.php +++ b/Controller/Account.php @@ -15,6 +15,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Webkul\UVDesk\CoreFrameworkBundle\Services\UVDeskService; +use Webkul\UVDesk\CoreFrameworkBundle\FileSystem\FileSystem; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Component\Translation\TranslatorInterface; @@ -27,14 +28,17 @@ class Account extends AbstractController private $translator; private $passwordEncoder; private $uvdeskService; + private $fileSystem; - public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator, UserPasswordEncoderInterface $passwordEncoder, UVDeskService $uvdeskService) + public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator, UserPasswordEncoderInterface $passwordEncoder, UVDeskService $uvdeskService, FileSystem $fileSystem) { $this->userService = $userService; $this->eventDispatcher = $eventDispatcher; $this->translator = $translator; $this->passwordEncoder = $passwordEncoder; $this->uvdeskService = $uvdeskService; + $this->fileSystem = $fileSystem; + } private function encodePassword(User $user, $plainPassword) @@ -120,10 +124,10 @@ public function loadProfile(Request $request) $em->flush(); $userInstance = $em->getRepository('UVDeskCoreFrameworkBundle:UserInstance')->findOneBy(array('user' => $user->getId())); - $userInstance = $this->container->get('user.service')->getUserDetailById($user->getId()); + $userInstance = $this->userService->getUserDetailById($user->getId()); if (isset($dataFiles['profileImage'])) { - $assetDetails = $this->container->get('uvdesk.core.file_system.service')->getUploadManager()->uploadFile($dataFiles['profileImage'], 'profile'); + $assetDetails = $this->filesystem->getUploadManager()->uploadFile($dataFiles['profileImage'], 'profile'); $userInstance->setProfileImagePath($assetDetails['path']); } @@ -233,7 +237,7 @@ public function editAgent($agentId) $userInstance->setSource('website'); if (isset($dataFiles['profileImage'])) { - $assetDetails = $this->container->get('uvdesk.core.file_system.service')->getUploadManager()->uploadFile($dataFiles['profileImage'], 'profile'); + $assetDetails = $this->fileSystem->getUploadManager()->uploadFile($dataFiles['profileImage'], 'profile'); $userInstance->setProfileImagePath($assetDetails['path']); } @@ -375,7 +379,7 @@ public function createAgent(Request $request) $fullname = trim(implode(' ', [$formDetails['firstName'], $formDetails['lastName']])); $supportRole = $entityManager->getRepository('UVDeskCoreFrameworkBundle:SupportRole')->findOneByCode($formDetails['role']); - $user = $this->container->get('user.service')->createUserInstance($formDetails['email'], $fullname, $supportRole, [ + $user = $this->userService->createUserInstance($formDetails['email'], $fullname, $supportRole, [ 'contact' => $formDetails['contactNumber'], 'source' => 'website', 'active' => !empty($formDetails['isActive']) ? true : false, diff --git a/Controller/AccountXHR.php b/Controller/AccountXHR.php index a6bbc3c8c..97d773799 100755 --- a/Controller/AccountXHR.php +++ b/Controller/AccountXHR.php @@ -12,18 +12,19 @@ use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\EventDispatcher\EventDispatcher; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; -use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Component\Translation\TranslatorInterface; class AccountXHR extends AbstractController { private $eventDispatcher; private $translator; + private $userService; public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator) { $this->eventDispatcher = $eventDispatcher; $this->translator = $translator; + $this->userService = $userService; } public function listAgentsXHR(Request $request) diff --git a/Controller/Customer.php b/Controller/Customer.php index 18518a142..20bcbe4b9 100755 --- a/Controller/Customer.php +++ b/Controller/Customer.php @@ -10,6 +10,7 @@ use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Symfony\Component\EventDispatcher\EventDispatcher; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Webkul\UVDesk\CoreFrameworkBundle\FileSystem\FileSystem; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Component\Translation\TranslatorInterface; @@ -18,12 +19,14 @@ class Customer extends AbstractController private $userService; private $eventDispatcher; private $translator; + private $fileSystem; - public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator) + public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator, FileSystem $fileSystem) { $this->userService = $userService; $this->eventDispatcher = $eventDispatcher; $this->translator = $translator; + $this->fileSystem = $fileSystem; } public function listCustomers(Request $request) @@ -63,7 +66,7 @@ public function createCustomer(Request $request) $fullname = trim(implode(' ', [$formDetails['firstName'], $formDetails['lastName']])); $supportRole = $entityManager->getRepository('UVDeskCoreFrameworkBundle:SupportRole')->findOneByCode('ROLE_CUSTOMER'); - $user = $this->container->get('user.service')->createUserInstance($formDetails['email'], $fullname, $supportRole, [ + $user = $this->userService->createUserInstance($formDetails['email'], $fullname, $supportRole, [ 'contact' => $formDetails['contactNumber'], 'source' => 'website', 'active' => !empty($formDetails['isActive']) ? true : false, @@ -143,7 +146,7 @@ public function editCustomer(Request $request) $userInstance->setContactNumber($data['contactNumber']); } if(isset($contentFile['profileImage'])){ - $assetDetails = $this->container->get('uvdesk.core.file_system.service')->getUploadManager()->uploadFile($contentFile['profileImage'], 'profile'); + $assetDetails = $this->filesystem->getUploadManager()->uploadFile($contentFile['profileImage'], 'profile'); $userInstance->setProfileImagePath($assetDetails['path']); } diff --git a/Controller/CustomerXHR.php b/Controller/CustomerXHR.php index f07086422..4084798ef 100644 --- a/Controller/CustomerXHR.php +++ b/Controller/CustomerXHR.php @@ -8,10 +8,23 @@ use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; class CustomerXHR extends AbstractController { + private $userService; + private $eventDispatcher; + private $translator; + + public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator) + { + $this->userService = $userService; + $this->eventDispatcher = $eventDispatcher; + $this->translator = $translator; + } + public function listCustomersXHR(Request $request) { if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) { diff --git a/Controller/Email.php b/Controller/Email.php index a05ec589f..7ae7306ed 100755 --- a/Controller/Email.php +++ b/Controller/Email.php @@ -10,10 +10,22 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Webkul\UVDesk\CoreFrameworkBundle\Entity; use Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; + class Email extends AbstractController { const LIMIT = 10; + + private $userService; + private $translator; + + public function __construct(UserService $userService, TranslatorInterface $translator) + { + $this->userService = $userService; + $this->translator = $translator; + } protected function getTemplate($request) { @@ -21,7 +33,7 @@ protected function getTemplate($request) $data = $emailTemplateRepository->findOneby([ 'id' => $request->attributes->get('template'), - 'user' => $this->container->get('user.service')->getCurrentUser()->getId() + 'user' => $this->userService->getCurrentUser()->getId() ]); $default = $emailTemplateRepository->findOneby([ diff --git a/Controller/EmailSettings.php b/Controller/EmailSettings.php index a765c28ff..be61434d5 100644 --- a/Controller/EmailSettings.php +++ b/Controller/EmailSettings.php @@ -5,9 +5,23 @@ use Symfony\Component\Yaml\Yaml; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Core\Exception\AccessDeniedException; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; +use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\SwiftMailer; class EmailSettings extends AbstractController { + private $userService; + private $translator; + private $swiftMailer; + + public function __construct(UserService $userService, TranslatorInterface $translator,SwiftMailer $swiftMailer) + { + $this->userService = $userService; + $this->translator = $translator; + $this->swiftMailer = $swiftMailer; + } + public function loadSettings() { if (!$this->userService->isAccessAuthorized('ROLE_ADMIN')) { @@ -16,7 +30,7 @@ public function loadSettings() $swiftmailerConfigurations = array_map(function ($configuartion) { return $configuartion->getId(); - }, $this->get('swiftmailer.service')->parseSwiftMailerConfigurations()); + }, $this->swiftMailer->parseSwiftMailerConfigurations()); return $this->render('@UVDeskCoreFramework//Email//emailSettings.html.twig', [ 'swiftmailers' => $swiftmailerConfigurations, diff --git a/Controller/EmailSettingsXHR.php b/Controller/EmailSettingsXHR.php index a11bdefbc..081876e77 100644 --- a/Controller/EmailSettingsXHR.php +++ b/Controller/EmailSettingsXHR.php @@ -6,15 +6,29 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; +use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\SwiftMailer; class EmailSettingsXHR extends AbstractController { + private $userService; + private $translator; + private $swiftMailer; + + public function __construct(UserService $userService, TranslatorInterface $translator,SwiftMailer $swiftMailer) + { + $this->userService = $userService; + $this->translator = $translator; + $this->swiftMailer = $swiftMailer; + } + public function updateSettingsXHR(Request $request) { $filePath = $this->get('kernel')->getProjectDir() . '/config/packages/uvdesk.yaml'; - $memberPrefix = $this->container->getParameter('uvdesk_site_path.member_prefix') ?? 'member'; - $customerPrefix = $this->container->getParameter('uvdesk_site_path.knowledgebase_customer_prefix') ?? 'customer'; + $memberPrefix = $this->getParameter('uvdesk_site_path.member_prefix') ?? 'member'; + $customerPrefix = $this->getParameter('uvdesk_site_path.knowledgebase_customer_prefix') ?? 'customer'; $app_locales = 'en|fr|it'; //default app_locales values @@ -33,7 +47,7 @@ public function updateSettingsXHR(Request $request) '{{ SUPPORT_EMAIL_ID }}' => $supportEmailConfiguration['id'], '{{ SUPPORT_EMAIL_NAME }}' => $supportEmailConfiguration['name'], '{{ SUPPORT_EMAIL_MAILER_ID }}' => $mailer_id, - '{{ SITE_URL }}' => $this->container->getParameter('uvdesk.site_url'), + '{{ SITE_URL }}' => $this->getParameter('uvdesk.site_url'), '{{ APP_LOCALES }}' => $app_locales, '{{ MEMBER_PANEL_PREFIX }}' => $memberPrefix, '{{ CUSTOMER_PANEL_PREFIX }}' => $customerPrefix, diff --git a/Controller/Group.php b/Controller/Group.php index 2ddf9932d..15c1c4927 100755 --- a/Controller/Group.php +++ b/Controller/Group.php @@ -11,9 +11,21 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportTeam; use Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; +use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\SwiftMailer; class Group extends AbstractController { + private $userService; + private $translator; + + public function __construct(UserService $userService, TranslatorInterface $translator) + { + $this->userService = $userService; + $this->translator = $translator; + } + public function listGroups(Request $request) { if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')){ diff --git a/Controller/GroupXHR.php b/Controller/GroupXHR.php index e4ec51ba6..78017de12 100644 --- a/Controller/GroupXHR.php +++ b/Controller/GroupXHR.php @@ -4,9 +4,20 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; class GroupXHR extends AbstractController { + private $userService; + private $translator; + + public function __construct(UserService $userService, TranslatorInterface $translator) + { + $this->userService = $userService; + $this->translator = $translator; + } + public function listGroupsXHR(Request $request) { if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_GROUP')) { diff --git a/Controller/Privilege.php b/Controller/Privilege.php index 725e24998..5ad10ca38 100755 --- a/Controller/Privilege.php +++ b/Controller/Privilege.php @@ -6,9 +6,23 @@ use Symfony\Component\HttpFoundation\Response; use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportPrivilege; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UVDeskService; class Privilege extends AbstractController { + private $userService; + private $translator; + private $uvdeskService; + + public function __construct(UserService $userService, TranslatorInterface $translator, UVDeskService $uvdeskService) + { + $this->userService = $userService; + $this->translator = $translator; + $this->uvdeskService = $uvdeskService; + } + public function listPrivilege(Request $request) { if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ diff --git a/Controller/PrivilegeXHR.php b/Controller/PrivilegeXHR.php index f9b4620cc..62cba014b 100644 --- a/Controller/PrivilegeXHR.php +++ b/Controller/PrivilegeXHR.php @@ -8,9 +8,20 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; class PrivilegeXHR extends AbstractController { + private $userService; + private $translator; + + public function __construct(UserService $userService, TranslatorInterface $translator) + { + $this->userService = $userService; + $this->translator = $translator; + } + public function listPrivilegeXHR(Request $request) { if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_PRIVILEGE')){ diff --git a/Controller/SavedReplies.php b/Controller/SavedReplies.php index 263cbea25..69982eaad 100755 --- a/Controller/SavedReplies.php +++ b/Controller/SavedReplies.php @@ -8,15 +8,26 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Webkul\UVDesk\CoreFrameworkBundle\Form as CoreFrameworkBundleForms; use Webkul\UVDesk\CoreFrameworkBundle\Entity as CoreFrameworkBundleEntities; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; class SavedReplies extends AbstractController { const LIMIT = 10; const ROLE_REQUIRED = 'saved_replies'; + private $userService; + private $translator; + + public function __construct(UserService $userService, TranslatorInterface $translator) + { + $this->userService = $userService; + $this->translator = $translator; + } + public function loadSavedReplies(Request $request) { - $savedReplyReferenceIds = $this->container->get('user.service')->getUserSavedReplyReferenceIds(); + $savedReplyReferenceIds = $this->userService->getUserSavedReplyReferenceIds(); return $this->render('@UVDeskCoreFramework//savedRepliesList.html.twig', [ 'savedReplyReferenceIds' => array_unique($savedReplyReferenceIds), diff --git a/Controller/SwiftMailer.php b/Controller/SwiftMailer.php index bbdae6efd..6be36c1f9 100644 --- a/Controller/SwiftMailer.php +++ b/Controller/SwiftMailer.php @@ -8,9 +8,23 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\Event\ConfigurationUpdatedEvent; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; +use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\SwiftMailer as SwiftMailerService; class SwiftMailer extends AbstractController { + private $userService; + private $translator; + private $swiftMailer; + + public function __construct(UserService $userService, TranslatorInterface $translator,SwiftMailerService $swiftMailer) + { + $this->userService = $userService; + $this->translator = $translator; + $this->swiftMailer = $swiftMailer; + } + public function loadMailers() { if (!$this->userService->isAccessAuthorized('ROLE_ADMIN')) { @@ -24,7 +38,7 @@ public function createMailerConfiguration(Request $request) { if ($request->getMethod() == 'POST') { $params = $request->request->all(); - $swiftmailer = $this->get('swiftmailer.service'); + $swiftmailer = $this->swiftmailer; $swiftmailerConfiguration = $swiftmailer->createConfiguration($params['transport'], $params['id']); @@ -49,7 +63,7 @@ public function createMailerConfiguration(Request $request) public function updateMailerConfiguration($id, Request $request) { - $swiftmailerService = $this->get('swiftmailer.service'); + $swiftmailerService = $this->swiftmailer;; $swiftmailerConfigurations = $swiftmailerService->parseSwiftMailerConfigurations(); foreach ($swiftmailerConfigurations as $index => $configuration) { diff --git a/Controller/SwiftMailerXHR.php b/Controller/SwiftMailerXHR.php index 78fa6605f..810a07d79 100644 --- a/Controller/SwiftMailerXHR.php +++ b/Controller/SwiftMailerXHR.php @@ -6,9 +6,20 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\Event\ConfigurationRemovedEvent; +use Symfony\Component\Translation\TranslatorInterface; +use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\SwiftMailer as SwiftMailerService; class SwiftMailerXHR extends AbstractController { + private $translator; + private $swiftMailer; + + public function __construct(TranslatorInterface $translator,SwiftMailerService $swiftMailer) + { + $this->translator = $translator; + $this->swiftMailer = $swiftMailer; + } + public function loadMailersXHR(Request $request) { if (true === $request->isXmlHttpRequest()) { @@ -19,7 +30,7 @@ public function loadMailersXHR(Request $request) 'transport' => $configuartion->getTransportName(), 'isActive' => $configuartion->getDeliveryStatus(), ]; - }, $this->get('swiftmailer.service')->parseSwiftMailerConfigurations()); + }, $this->swiftMailer->parseSwiftMailerConfigurations()); return new JsonResponse($collection); } @@ -30,7 +41,7 @@ public function loadMailersXHR(Request $request) public function removeMailerConfiguration(Request $request) { $params = $request->query->all(); - $swiftmailer = $this->get('swiftmailer.service'); + $swiftmailer = $this->swiftMailer; $configurations = $swiftmailer->parseSwiftMailerConfigurations(); if (!empty($configurations)) { diff --git a/Controller/Team.php b/Controller/Team.php index 54f1e1f7a..0566febac 100755 --- a/Controller/Team.php +++ b/Controller/Team.php @@ -2,7 +2,6 @@ namespace Webkul\UVDesk\CoreFrameworkBundle\Controller; -use Symfony\Component\Translation\TranslatorInterface; use Webkul\UVDesk\CoreFrameworkBundle\Form; use Webkul\UVDesk\CoreFrameworkBundle\Entity\User; use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportTeam; @@ -10,16 +9,17 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; class Team extends AbstractController { - /** - * @var TranslatorInterface - */ + private $userService; private $translator; - - public function __construct(TranslatorInterface $translator) + + public function __construct(UserService $userService, TranslatorInterface $translator) { + $this->userService = $userService; $this->translator = $translator; } diff --git a/Controller/TeamXHR.php b/Controller/TeamXHR.php index 29f153fed..f75a10ef3 100755 --- a/Controller/TeamXHR.php +++ b/Controller/TeamXHR.php @@ -2,15 +2,25 @@ namespace Webkul\UVDesk\CoreFrameworkBundle\Controller; -use Symfony\Component\Translation\TranslatorInterface; use Webkul\UVDesk\CoreFrameworkBundle\Entity\User; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; class TeamXHR extends AbstractController { + private $userService; + private $translator; + + public function __construct(UserService $userService, TranslatorInterface $translator) + { + $this->userService = $userService; + $this->translator = $translator; + } + public function listTeamsXHR(Request $request) { if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_SUB_GROUP')){ diff --git a/Controller/Thread.php b/Controller/Thread.php index 3d1a30065..47f202b39 100755 --- a/Controller/Thread.php +++ b/Controller/Thread.php @@ -12,9 +12,29 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\TicketStatus; use Webkul\UVDesk\CoreFrameworkBundle\Entity\Thread as TicketThread; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UVDeskService; +use Webkul\UVDesk\CoreFrameworkBundle\Services\TicketService; +use Webkul\UVDesk\CoreFrameworkBundle\Services\EmailService; class Thread extends AbstractController { + private $userService; + private $translator; + private $eventDispatcher; + private $ticketService; + private $emailService; + + public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcher $eventDispatcher) + { + $this->userService = $userService; + $this->emailService = $emailService; + $this->translator = $translator; + $this->ticketService = $ticketService; + $this->eventDispatcher = $eventDispatcher; + } + public function saveThread($ticketId, Request $request) { $params = $request->request->all(); @@ -82,7 +102,7 @@ public function saveThread($ticketId, Request $request) } // Create Thread - $thread = $this->get('ticket.service')->createThread($ticket, $threadDetails); + $thread = $this->ticketService->createThread($ticket, $threadDetails); // $this->addFlash('success', ucwords($params['threadType']) . " added successfully."); // @TODO: Remove Agent Draft Thread @@ -131,7 +151,7 @@ public function saveThread($ticketId, Request $request) // Forward thread to users try { - $messageId = $this->get('email.service')->sendMail($params['subject'] ?? ("Forward: " . $ticket->getSubject()), $thread->getMessage(), $thread->getReplyTo(), $headers, $ticket->getMailboxEmail(), $attachments ?? [], $thread->getCc() ?: [], $thread->getBcc() ?: []); + $messageId = $this->emailService->sendMail($params['subject'] ?? ("Forward: " . $ticket->getSubject()), $thread->getMessage(), $thread->getReplyTo(), $headers, $ticket->getMailboxEmail(), $attachments ?? [], $thread->getCc() ?: [], $thread->getBcc() ?: []); if (!empty($messageId)) { $thread->setMessageId($messageId); diff --git a/Controller/ThreadXHR.php b/Controller/ThreadXHR.php index d4afe6376..b4cdc207f 100644 --- a/Controller/ThreadXHR.php +++ b/Controller/ThreadXHR.php @@ -5,12 +5,19 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Webkul\UVDesk\CoreFrameworkBundle\Services\TicketService; class ThreadXHR extends AbstractController { + private $ticketService; + + public function __construct(TicketService $ticketService) + { + $this->ticketService = $ticketService; + } + public function listTicketThreadCollectionXHR($ticketId) { - $entityManager = $this->getDoctrine()->getManager(); $request = $this->container->get('request_stack')->getCurrentRequest(); @@ -18,7 +25,7 @@ public function listTicketThreadCollectionXHR($ticketId) $ticket = $entityManager->getRepository('UVDeskCoreFrameworkBundle:Ticket')->findOneById($ticketId); if (!empty($ticket)) { - $paginationResponse = $this->get('ticket.service')->paginateMembersTicketThreadCollection($ticket, $request); + $paginationResponse = $this->ticketService->paginateMembersTicketThreadCollection($ticket, $request); return new Response(json_encode($paginationResponse), 200, ['Content-Type' => 'application/json']); } diff --git a/Controller/Ticket.php b/Controller/Ticket.php index dbe4d30ad..4dd81ecec 100755 --- a/Controller/Ticket.php +++ b/Controller/Ticket.php @@ -12,9 +12,30 @@ use Webkul\UVDesk\CoreFrameworkBundle\DataProxies as CoreFrameworkBundleDataProxies; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Webkul\UVDesk\CoreFrameworkBundle\Tickets\QuickActionButtonCollection; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UVDeskService; +use Webkul\UVDesk\CoreFrameworkBundle\Services\TicketService; +use Webkul\UVDesk\CoreFrameworkBundle\Services\EmailService; +use Symfony\Component\EventDispatcher\EventDispatcher; class Ticket extends AbstractController { + private $userService; + private $translator; + private $eventDispatcher; + private $ticketService; + private $emailService; + + public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcher $eventDispatcher) + { + $this->userService = $userService; + $this->emailService = $emailService; + $this->translator = $translator; + $this->ticketService = $ticketService; + $this->eventDispatcher = $eventDispatcher; + } + public function listTicketCollection(Request $request) { $entityManager = $this->getDoctrine()->getManager(); diff --git a/Controller/TicketXHR.php b/Controller/TicketXHR.php index 323c75fa2..d8ac0bb3d 100755 --- a/Controller/TicketXHR.php +++ b/Controller/TicketXHR.php @@ -12,9 +12,30 @@ use Webkul\UVDesk\CoreFrameworkBundle\Form as CoreFrameworkBundleForms; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Webkul\UVDesk\CoreFrameworkBundle\DataProxies as CoreFrameworkBundleDataProxies; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UVDeskService; +use Webkul\UVDesk\CoreFrameworkBundle\Services\TicketService; +use Webkul\UVDesk\CoreFrameworkBundle\Services\EmailService; +use Symfony\Component\EventDispatcher\EventDispatcher; class TicketXHR extends AbstractController { + private $userService; + private $translator; + private $eventDispatcher; + private $ticketService; + private $emailService; + + public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcher $eventDispatcher) + { + $this->userService = $userService; + $this->emailService = $emailService; + $this->translator = $translator; + $this->ticketService = $ticketService; + $this->eventDispatcher = $eventDispatcher; + } + public function loadTicketXHR($ticketId) { $entityManager = $this->getDoctrine()->getManager(); diff --git a/Repository/TicketRepository.php b/Repository/TicketRepository.php index 1bbf53b8c..36dc508f5 100644 --- a/Repository/TicketRepository.php +++ b/Repository/TicketRepository.php @@ -541,7 +541,7 @@ public function getCustomerMoreTicketsSidebar($customerId, $container) { ->andwhere("a IS NULL OR ad.supportRole != 4") ->orderBy('t.id', Criteria::DESC); - // $currentUser = $this->container->get('user.service')->getCurrentUser(); + // $currentUser = $this->userService->getCurrentUser(); // if($currentUser->getRole() == "ROLE_AGENT" && $currentUser->detail['agent']->getTicketView() != UserData::GLOBAL_ACCESS) { // $this->em->getRepository('WebkulTicketBundle:Ticket')->addPermissionFilter($qb, $this->container, false); // $qb->addSelect('gr.name as groupName'); @@ -627,7 +627,7 @@ public function prepareTicketListQueryWithParams($queryBuilder, $params) case 'after': $date = \DateTime::createFromFormat('d-m-Y H:i', $fieldValue.' 23:59'); if ($date) { - // $date = \DateTime::createFromFormat('d-m-Y H:i', $this->container->get('user.service')->convertTimezoneToServer($date, 'd-m-Y H:i')); + // $date = \DateTime::createFromFormat('d-m-Y H:i', $this->userService->convertTimezoneToServer($date, 'd-m-Y H:i')); $queryBuilder->andwhere('ticket.createdAt > :afterDate'); $queryBuilder->setParameter('afterDate', $date); } diff --git a/Services/TicketService.php b/Services/TicketService.php index aca649c18..0acfbde11 100644 --- a/Services/TicketService.php +++ b/Services/TicketService.php @@ -110,7 +110,7 @@ public function getRandomRefrenceId($email = null) // @TODO: Refactor this out of this service. Use UserService::getSessionUser() instead. public function getUser() { - return $this->container->get('user.service')->getCurrentUser(); + return $this->userService->getCurrentUser(); } public function getDefaultType() @@ -174,7 +174,7 @@ public function createTicket(array $params = []) } // Create User Instance - $user = $this->container->get('user.service')->createUserInstance($params['from'], $params['name'], $role, [ + $user = $this->userService->createUserInstance($params['from'], $params['name'], $role, [ 'source' => strtolower($params['source']), 'active' => true, ]); @@ -445,7 +445,7 @@ public function getTicketTags($request = null) public function paginateMembersTicketCollection(Request $request) { $params = $request->query->all(); - $activeUser = $this->container->get('user.service')->getSessionUser(); + $activeUser = $this->userService->getSessionUser(); $agentTimeZone = $activeUser->getTimezone(); $agentTimeFormat = $activeUser->getTimeformat(); @@ -643,7 +643,7 @@ public function paginateMembersTicketThreadCollection(Ticket $ticket, Request $r { $params = $request->query->all(); $entityManager = $this->entityManager; - $activeUser = $this->container->get('user.service')->getSessionUser(); + $activeUser = $this->userService->getSessionUser(); $agentTimeZone = $activeUser->getTimezone(); $agentTimeFormat = $activeUser->getTimeformat(); @@ -652,7 +652,7 @@ public function paginateMembersTicketThreadCollection(Ticket $ticket, Request $r $uvdeskFileSystemService = $this->container->get('uvdesk.core.file_system.service'); // Get base query - $enableLockedThreads = $this->container->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_LOCK_AND_UNLOCK_THREAD'); + $enableLockedThreads = $this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_LOCK_AND_UNLOCK_THREAD'); $baseQuery = $threadRepository->prepareBasePaginationRecentThreadsQuery($ticket, $params, $enableLockedThreads); // Apply Pagination @@ -918,14 +918,14 @@ public function getNotePlaceholderValues($ticket, $type = "customer") $variables['ticket.team'] = ($ticket->getSupportTeam() ? $ticket->getSupportTeam()->getName() : ''); - $customer = $this->container->get('user.service')->getCustomerPartialDetailById($ticket->getCustomer()->getId()); + $customer = $this->userService->getCustomerPartialDetailById($ticket->getCustomer()->getId()); $variables['ticket.customerName'] = $customer['name']; - $userService = $this->container->get('user.service'); + $userService = $this->userService; $variables['ticket.agentName'] = ''; $variables['ticket.agentEmail'] = ''; if ($ticket->getAgent()) { - $agent = $this->container->get('user.service')->getAgentDetailById($ticket->getAgent()->getId()); + $agent = $this->userService->getAgentDetailById($ticket->getAgent()->getId()); if($agent) { $variables['ticket.agentName'] = $agent['name']; $variables['ticket.agentEmail'] = $agent['email']; @@ -1092,7 +1092,7 @@ public function getCreateReply($ticketId, $firewall = 'member') if((!empty($threadResponse[0][0]))) { $threadDetails = $threadResponse[0][0]; - $userService = $this->container->get('user.service'); + $userService = $this->userService; if ($threadDetails['createdBy'] == 'agent') { $threadDetails['user'] = $userService->getAgentDetailById($threadResponse[0]['userId']); @@ -1246,7 +1246,7 @@ public function getManualWorkflow() $preparedResponseIds = []; $groupIds = []; $teamIds = []; - $userId = $this->container->get('user.service')->getCurrentUser()->getAgentInstance()->getId(); + $userId = $this->userService->getCurrentUser()->getAgentInstance()->getId(); $preparedResponseRepo = $this->entityManager->getRepository('UVDeskAutomationBundle:PreparedResponses')->findAll(); @@ -1319,7 +1319,7 @@ public function getSavedReplies() $savedReplyIds = []; $groupIds = []; $teamIds = []; - $userId = $this->container->get('user.service')->getCurrentUser()->getAgentInstance()->getId(); + $userId = $this->userService->getCurrentUser()->getAgentInstance()->getId(); $savedReplyRepo = $this->entityManager->getRepository('UVDeskCoreFrameworkBundle:SavedReplies')->findAll(); @@ -1454,7 +1454,7 @@ public function getLastReply($ticketId, $userType = null) if (!empty($threadResponse[0][0])) { $threadDetails = $threadResponse[0][0]; - $userService = $this->container->get('user.service'); + $userService = $this->userService; if ($threadDetails['createdBy'] == 'agent') { $threadDetails['user'] = $userService->getAgentDetailById($threadResponse[0]['userId']); @@ -1504,14 +1504,14 @@ public function getSavedReplyPlaceholderValues($ticket, $type = "customer") $variables['ticket.team'] = ($ticket->getSupportTeam() ? $ticket->getSupportTeam()->getName() : ''); - $customer = $this->container->get('user.service')->getCustomerPartialDetailById($ticket->getCustomer()->getId()); + $customer = $this->userService->getCustomerPartialDetailById($ticket->getCustomer()->getId()); $variables['ticket.customerName'] = $customer['name']; - $userService = $this->container->get('user.service'); + $userService = $this->userService; $variables['ticket.agentName'] = ''; $variables['ticket.agentEmail'] = ''; if ($ticket->getAgent()) { - $agent = $this->container->get('user.service')->getAgentDetailById($ticket->getAgent()->getId()); + $agent = $this->userService->getAgentDetailById($ticket->getAgent()->getId()); if($agent) { $variables['ticket.agentName'] = $agent['name']; $variables['ticket.agentEmail'] = $agent['email']; @@ -1540,7 +1540,7 @@ public function isEmailBlocked($email, $website) $flag = false; $email = strtolower($email); $knowlegeBaseWebsite = $this->entityManager->getRepository('UVDeskSupportCenterBundle:KnowledgebaseWebsite')->findOneBy(['website' => $website->getId(), 'isActive' => 1]); - $list = $this->container->get('user.service')->getWebsiteSpamDetails($knowlegeBaseWebsite); + $list = $this->userService->getWebsiteSpamDetails($knowlegeBaseWebsite); // Blacklist if (!empty($list['blackList']['email']) && in_array($email, $list['blackList']['email'])) { @@ -1580,7 +1580,7 @@ public function timeZoneConverter($dateFlag) $timeZone = $website->getTimezone(); $timeFormat = $website->getTimeformat(); - $activeUser = $this->container->get('user.service')->getSessionUser(); + $activeUser = $this->userService->getSessionUser(); $agentTimeZone = !empty($activeUser) ? $activeUser->getTimezone() : null; $agentTimeFormat = !empty($activeUser) ? $activeUser->getTimeformat() : null; @@ -1638,7 +1638,7 @@ public function isTicketAccessGranted(Ticket $ticket, User $user = null, $firewa { // @TODO: Take current firewall into consideration (access check on behalf of agent/customer) if (empty($user)) { - $user = $this->container->get('user.service')->getSessionUser(); + $user = $this->userService->getSessionUser(); } if (empty($user)) { From 8151e850c578bd2f643826e72fa10e960a6b8310 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Mon, 7 Sep 2020 14:21:52 +0530 Subject: [PATCH 05/85] update event dispatcher interface --- Controller/Account.php | 4 ++-- Controller/AccountXHR.php | 4 ++-- Controller/Authentication.php | 4 ++-- Controller/Customer.php | 4 ++-- Controller/CustomerXHR.php | 4 ++-- Controller/Thread.php | 4 ++-- Controller/Ticket.php | 4 ++-- Controller/TicketXHR.php | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Controller/Account.php b/Controller/Account.php index 4ec65fce3..f1ecabc67 100755 --- a/Controller/Account.php +++ b/Controller/Account.php @@ -12,7 +12,7 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Webkul\UVDesk\CoreFrameworkBundle\Services\UVDeskService; use Webkul\UVDesk\CoreFrameworkBundle\FileSystem\FileSystem; @@ -30,7 +30,7 @@ class Account extends AbstractController private $uvdeskService; private $fileSystem; - public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator, UserPasswordEncoderInterface $passwordEncoder, UVDeskService $uvdeskService, FileSystem $fileSystem) + public function __construct(UserService $userService, EventDispatcherInterface $eventDispatcher, TranslatorInterface $translator, UserPasswordEncoderInterface $passwordEncoder, UVDeskService $uvdeskService, FileSystem $fileSystem) { $this->userService = $userService; $this->eventDispatcher = $eventDispatcher; diff --git a/Controller/AccountXHR.php b/Controller/AccountXHR.php index 97d773799..26391483c 100755 --- a/Controller/AccountXHR.php +++ b/Controller/AccountXHR.php @@ -10,7 +10,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Translation\TranslatorInterface; @@ -20,7 +20,7 @@ class AccountXHR extends AbstractController private $translator; private $userService; - public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator) + public function __construct(UserService $userService, EventDispatcherInterface $eventDispatcher, TranslatorInterface $translator) { $this->eventDispatcher = $eventDispatcher; $this->translator = $translator; diff --git a/Controller/Authentication.php b/Controller/Authentication.php index bfaccb21b..e3b9d7315 100644 --- a/Controller/Authentication.php +++ b/Controller/Authentication.php @@ -12,7 +12,7 @@ use Webkul\UVDesk\CoreFrameworkBundle\Utils\TokenGenerator; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Component\Translation\TranslatorInterface; @@ -24,7 +24,7 @@ class Authentication extends AbstractController private $eventDispatcher; private $translator; - public function __construct(UserService $userService, AuthenticationUtils $authenticationUtils, EventDispatcher $eventDispatcher, TranslatorInterface $translator) + public function __construct(UserService $userService, AuthenticationUtils $authenticationUtils, EventDispatcherInterface $eventDispatcher, TranslatorInterface $translator) { $this->userService = $userService; $this->authenticationUtils = $authenticationUtils; diff --git a/Controller/Customer.php b/Controller/Customer.php index 20bcbe4b9..1fc82216b 100755 --- a/Controller/Customer.php +++ b/Controller/Customer.php @@ -8,7 +8,7 @@ use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Webkul\UVDesk\CoreFrameworkBundle\FileSystem\FileSystem; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; @@ -21,7 +21,7 @@ class Customer extends AbstractController private $translator; private $fileSystem; - public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator, FileSystem $fileSystem) + public function __construct(UserService $userService, EventDispatcherInterface $eventDispatcher, TranslatorInterface $translator, FileSystem $fileSystem) { $this->userService = $userService; $this->eventDispatcher = $eventDispatcher; diff --git a/Controller/CustomerXHR.php b/Controller/CustomerXHR.php index 4084798ef..fe8da4e0a 100644 --- a/Controller/CustomerXHR.php +++ b/Controller/CustomerXHR.php @@ -8,7 +8,7 @@ use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Translation\TranslatorInterface; @@ -18,7 +18,7 @@ class CustomerXHR extends AbstractController private $eventDispatcher; private $translator; - public function __construct(UserService $userService, EventDispatcher $eventDispatcher, TranslatorInterface $translator) + public function __construct(UserService $userService, EventDispatcherInterface $eventDispatcher, TranslatorInterface $translator) { $this->userService = $userService; $this->eventDispatcher = $eventDispatcher; diff --git a/Controller/Thread.php b/Controller/Thread.php index 47f202b39..3e038e324 100755 --- a/Controller/Thread.php +++ b/Controller/Thread.php @@ -6,7 +6,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\EventDispatcher\GenericEvent; use Webkul\UVDesk\CoreFrameworkBundle\Entity\Ticket; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Webkul\UVDesk\CoreFrameworkBundle\Entity\Attachment; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Webkul\UVDesk\CoreFrameworkBundle\Entity\TicketStatus; @@ -26,7 +26,7 @@ class Thread extends AbstractController private $ticketService; private $emailService; - public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcher $eventDispatcher) + public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcherInterface $eventDispatcher) { $this->userService = $userService; $this->emailService = $emailService; diff --git a/Controller/Ticket.php b/Controller/Ticket.php index 4dd81ecec..54839195f 100755 --- a/Controller/Ticket.php +++ b/Controller/Ticket.php @@ -17,7 +17,7 @@ use Webkul\UVDesk\CoreFrameworkBundle\Services\UVDeskService; use Webkul\UVDesk\CoreFrameworkBundle\Services\TicketService; use Webkul\UVDesk\CoreFrameworkBundle\Services\EmailService; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; class Ticket extends AbstractController { @@ -27,7 +27,7 @@ class Ticket extends AbstractController private $ticketService; private $emailService; - public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcher $eventDispatcher) + public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcherInterface $eventDispatcher) { $this->userService = $userService; $this->emailService = $emailService; diff --git a/Controller/TicketXHR.php b/Controller/TicketXHR.php index d8ac0bb3d..705f9b6d0 100755 --- a/Controller/TicketXHR.php +++ b/Controller/TicketXHR.php @@ -17,7 +17,7 @@ use Webkul\UVDesk\CoreFrameworkBundle\Services\UVDeskService; use Webkul\UVDesk\CoreFrameworkBundle\Services\TicketService; use Webkul\UVDesk\CoreFrameworkBundle\Services\EmailService; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; class TicketXHR extends AbstractController { @@ -27,7 +27,7 @@ class TicketXHR extends AbstractController private $ticketService; private $emailService; - public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcher $eventDispatcher) + public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcherInterface $eventDispatcher) { $this->userService = $userService; $this->emailService = $emailService; From e3284b64bf79934ed9c57c8c76357ed40737df62 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Tue, 8 Sep 2020 12:19:09 +0530 Subject: [PATCH 06/85] event dispatcher interface class updated --- SwiftMailer/Event/ConfigurationRemovedEvent.php | 2 +- SwiftMailer/Event/ConfigurationUpdatedEvent.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SwiftMailer/Event/ConfigurationRemovedEvent.php b/SwiftMailer/Event/ConfigurationRemovedEvent.php index 752d75640..60602d86c 100644 --- a/SwiftMailer/Event/ConfigurationRemovedEvent.php +++ b/SwiftMailer/Event/ConfigurationRemovedEvent.php @@ -2,7 +2,7 @@ namespace Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\Event; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; use Webkul\UVDesk\CoreFrameworkBundle\Utils\SwiftMailer\BaseConfiguration; /** diff --git a/SwiftMailer/Event/ConfigurationUpdatedEvent.php b/SwiftMailer/Event/ConfigurationUpdatedEvent.php index 72f92bc6c..09ee48d71 100644 --- a/SwiftMailer/Event/ConfigurationUpdatedEvent.php +++ b/SwiftMailer/Event/ConfigurationUpdatedEvent.php @@ -2,7 +2,7 @@ namespace Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\Event; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; use Webkul\UVDesk\CoreFrameworkBundle\Utils\SwiftMailer\BaseConfiguration; /** From 3e8d8ae07f8950e85f5e6566ec33ac135279cf01 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 9 Sep 2020 17:32:41 +0530 Subject: [PATCH 07/85] changed encription method to auto for encoder --- Templates/security.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/security.yaml b/Templates/security.yaml index 6806cdb5a..37e9487de 100644 --- a/Templates/security.yaml +++ b/Templates/security.yaml @@ -10,7 +10,7 @@ security: id: user.provider encoders: - Webkul\UVDesk\CoreFrameworkBundle\Entity\User: bcrypt + Webkul\UVDesk\CoreFrameworkBundle\Entity\User: auto firewalls: back_support: From b18dd5f176e92a09bd39006a5611df7136abc43b Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 9 Sep 2020 18:17:45 +0530 Subject: [PATCH 08/85] ticket controller service argument updated --- Controller/Ticket.php | 6 +++--- Controller/TicketXHR.php | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Controller/Ticket.php b/Controller/Ticket.php index 54839195f..de6ec6f50 100755 --- a/Controller/Ticket.php +++ b/Controller/Ticket.php @@ -62,7 +62,7 @@ public function loadTicket($ticketId, QuickActionButtonCollection $quickActionBu $user = $this->userService->getSessionUser(); // Proceed only if user has access to the resource - if (false == $this->get('ticket.service')->isTicketAccessGranted($ticket, $user)) { + if (false == $this->ticketService->isTicketAccessGranted($ticket, $user)) { throw new \Exception('Access Denied', 403); } @@ -83,7 +83,7 @@ public function loadTicket($ticketId, QuickActionButtonCollection $quickActionBu 'ticket' => $ticket, 'totalReplies' => $ticketRepository->countTicketTotalThreads($ticket->getId()), 'totalCustomerTickets' => ($ticketRepository->countCustomerTotalTickets($customer) - 1), - 'initialThread' => $this->get('ticket.service')->getTicketInitialThreadDetails($ticket), + 'initialThread' => $this->ticketService->getTicketInitialThreadDetails($ticket), 'ticketAgent' => !empty($agent) ? $agent->getAgentInstance()->getPartialDetails() : null, 'customer' => $customer->getCustomerInstance()->getPartialDetails(), 'currentUserDetails' => $user->getAgentInstance()->getPartialDetails(), @@ -182,7 +182,7 @@ public function saveTicket(Request $request) 'attachments' => $request->files->get('attachments'), ]; - $thread = $this->get('ticket.service')->createTicketBase($ticketData); + $thread = $this->ticketService->createTicketBase($ticketData); // Trigger ticket created event try { diff --git a/Controller/TicketXHR.php b/Controller/TicketXHR.php index 705f9b6d0..f832553b9 100755 --- a/Controller/TicketXHR.php +++ b/Controller/TicketXHR.php @@ -151,7 +151,7 @@ public function updateTicketDetails(Request $request) if (!$error) { $ticket->setSubject($request->request->get('subject')); - $createThread = $this->get('ticket.service')->getCreateReply($ticket->getId(), false); + $createThread = $this->ticketService->getCreateReply($ticket->getId(), false); $createThread = $entityManager->getRepository('UVDeskCoreFrameworkBundle:Thread')->find($createThread['id']); $createThread->setMessage($request->request->get('reply')); @@ -488,7 +488,7 @@ public function updateTicketAttributes($ticketId) public function listTicketCollectionXHR(Request $request) { if ($request->isXmlHttpRequest()) { - $paginationResponse = $this->get('ticket.service')->paginateMembersTicketCollection($request); + $paginationResponse = $this->ticketService->paginateMembersTicketCollection($request); return new Response(json_encode($paginationResponse), 200, ['Content-Type' => 'application/json']); } @@ -499,7 +499,7 @@ public function listTicketCollectionXHR(Request $request) public function updateTicketCollectionXHR(Request $request) { if ($request->isXmlHttpRequest()) { - $massResponse = $this->get('ticket.service')->massXhrUpdate($request); + $massResponse = $this->ticketService->massXhrUpdate($request); return new Response(json_encode($massResponse), 200, ['Content-Type' => 'application/json']); } @@ -626,7 +626,7 @@ public function loadTicketSearchFilterOptions(Request $request) $filtersResponse = $this->userService->getSubGroups($request); break; case 'tag': - $filtersResponse = $this->get('ticket.service')->getTicketTags($request); + $filtersResponse = $this->ticketService->getTicketTags($request); break; case 'label': $searchTerm = $request->query->get('query'); @@ -664,9 +664,9 @@ public function loadTicketCollectionSearchFilterOptionsXHR(Request $request) } elseif ($request->query->get('type') == 'team') { $json = $this->userService->getSubGroups($request); } elseif ($request->query->get('type') == 'tag') { - $json = $this->get('ticket.service')->getTicketTags($request); + $json = $this->ticketService->getTicketTags($request); } elseif ($request->query->get('type') == 'label') { - $json = $this->get('ticket.service')->getLabels($request); + $json = $this->ticketService->getLabels($request); } } @@ -680,7 +680,7 @@ public function listTicketTypeCollectionXHR(Request $request) } if (true === $request->isXmlHttpRequest()) { - $paginationResponse = $this->get('ticket.service')->paginateMembersTicketTypeCollection($request); + $paginationResponse = $this->ticketService->paginateMembersTicketTypeCollection($request); return new Response(json_encode($paginationResponse), 200, ['Content-Type' => 'application/json']); } @@ -724,7 +724,7 @@ public function listTagCollectionXHR(Request $request) } if (true === $request->isXmlHttpRequest()) { - $paginationResponse = $this->get('ticket.service')->paginateMembersTagCollection($request); + $paginationResponse = $this->ticketService->paginateMembersTagCollection($request); return new Response(json_encode($paginationResponse), 200, ['Content-Type' => 'application/json']); } @@ -754,7 +754,7 @@ public function loadTicketSavedReplies(Request $request) $data = $request->query->all(); if ($request->isXmlHttpRequest()) { - $json['message'] = $this->get('ticket.service')->getSavedReplyContent($data['id'],$data['ticketId']); + $json['message'] = $this->ticketService->getSavedReplyContent($data['id'],$data['ticketId']); } $response = new Response(json_encode($json)); @@ -829,9 +829,9 @@ public function getSearchFilterOptionsXhr(Request $request) } elseif($request->query->get('type') == 'team') { $json = $this->userService->getSupportTeams($request); } elseif($request->query->get('type') == 'tag') { - $json = $this->get('ticket.service')->getTicketTags($request); + $json = $this->ticketService->getTicketTags($request); } elseif($request->query->get('type') == 'label') { - $json = $this->get('ticket.service')->getLabels($request); + $json = $this->ticketService->getLabels($request); } } From 7e9442d21041dff04d7b85cc656e54d78fefe672 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 10 Sep 2020 19:24:32 +0530 Subject: [PATCH 09/85] service update --- Services/TicketService.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Services/TicketService.php b/Services/TicketService.php index 0acfbde11..aca649c18 100644 --- a/Services/TicketService.php +++ b/Services/TicketService.php @@ -110,7 +110,7 @@ public function getRandomRefrenceId($email = null) // @TODO: Refactor this out of this service. Use UserService::getSessionUser() instead. public function getUser() { - return $this->userService->getCurrentUser(); + return $this->container->get('user.service')->getCurrentUser(); } public function getDefaultType() @@ -174,7 +174,7 @@ public function createTicket(array $params = []) } // Create User Instance - $user = $this->userService->createUserInstance($params['from'], $params['name'], $role, [ + $user = $this->container->get('user.service')->createUserInstance($params['from'], $params['name'], $role, [ 'source' => strtolower($params['source']), 'active' => true, ]); @@ -445,7 +445,7 @@ public function getTicketTags($request = null) public function paginateMembersTicketCollection(Request $request) { $params = $request->query->all(); - $activeUser = $this->userService->getSessionUser(); + $activeUser = $this->container->get('user.service')->getSessionUser(); $agentTimeZone = $activeUser->getTimezone(); $agentTimeFormat = $activeUser->getTimeformat(); @@ -643,7 +643,7 @@ public function paginateMembersTicketThreadCollection(Ticket $ticket, Request $r { $params = $request->query->all(); $entityManager = $this->entityManager; - $activeUser = $this->userService->getSessionUser(); + $activeUser = $this->container->get('user.service')->getSessionUser(); $agentTimeZone = $activeUser->getTimezone(); $agentTimeFormat = $activeUser->getTimeformat(); @@ -652,7 +652,7 @@ public function paginateMembersTicketThreadCollection(Ticket $ticket, Request $r $uvdeskFileSystemService = $this->container->get('uvdesk.core.file_system.service'); // Get base query - $enableLockedThreads = $this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_LOCK_AND_UNLOCK_THREAD'); + $enableLockedThreads = $this->container->get('user.service')->isAccessAuthorized('ROLE_AGENT_MANAGE_LOCK_AND_UNLOCK_THREAD'); $baseQuery = $threadRepository->prepareBasePaginationRecentThreadsQuery($ticket, $params, $enableLockedThreads); // Apply Pagination @@ -918,14 +918,14 @@ public function getNotePlaceholderValues($ticket, $type = "customer") $variables['ticket.team'] = ($ticket->getSupportTeam() ? $ticket->getSupportTeam()->getName() : ''); - $customer = $this->userService->getCustomerPartialDetailById($ticket->getCustomer()->getId()); + $customer = $this->container->get('user.service')->getCustomerPartialDetailById($ticket->getCustomer()->getId()); $variables['ticket.customerName'] = $customer['name']; - $userService = $this->userService; + $userService = $this->container->get('user.service'); $variables['ticket.agentName'] = ''; $variables['ticket.agentEmail'] = ''; if ($ticket->getAgent()) { - $agent = $this->userService->getAgentDetailById($ticket->getAgent()->getId()); + $agent = $this->container->get('user.service')->getAgentDetailById($ticket->getAgent()->getId()); if($agent) { $variables['ticket.agentName'] = $agent['name']; $variables['ticket.agentEmail'] = $agent['email']; @@ -1092,7 +1092,7 @@ public function getCreateReply($ticketId, $firewall = 'member') if((!empty($threadResponse[0][0]))) { $threadDetails = $threadResponse[0][0]; - $userService = $this->userService; + $userService = $this->container->get('user.service'); if ($threadDetails['createdBy'] == 'agent') { $threadDetails['user'] = $userService->getAgentDetailById($threadResponse[0]['userId']); @@ -1246,7 +1246,7 @@ public function getManualWorkflow() $preparedResponseIds = []; $groupIds = []; $teamIds = []; - $userId = $this->userService->getCurrentUser()->getAgentInstance()->getId(); + $userId = $this->container->get('user.service')->getCurrentUser()->getAgentInstance()->getId(); $preparedResponseRepo = $this->entityManager->getRepository('UVDeskAutomationBundle:PreparedResponses')->findAll(); @@ -1319,7 +1319,7 @@ public function getSavedReplies() $savedReplyIds = []; $groupIds = []; $teamIds = []; - $userId = $this->userService->getCurrentUser()->getAgentInstance()->getId(); + $userId = $this->container->get('user.service')->getCurrentUser()->getAgentInstance()->getId(); $savedReplyRepo = $this->entityManager->getRepository('UVDeskCoreFrameworkBundle:SavedReplies')->findAll(); @@ -1454,7 +1454,7 @@ public function getLastReply($ticketId, $userType = null) if (!empty($threadResponse[0][0])) { $threadDetails = $threadResponse[0][0]; - $userService = $this->userService; + $userService = $this->container->get('user.service'); if ($threadDetails['createdBy'] == 'agent') { $threadDetails['user'] = $userService->getAgentDetailById($threadResponse[0]['userId']); @@ -1504,14 +1504,14 @@ public function getSavedReplyPlaceholderValues($ticket, $type = "customer") $variables['ticket.team'] = ($ticket->getSupportTeam() ? $ticket->getSupportTeam()->getName() : ''); - $customer = $this->userService->getCustomerPartialDetailById($ticket->getCustomer()->getId()); + $customer = $this->container->get('user.service')->getCustomerPartialDetailById($ticket->getCustomer()->getId()); $variables['ticket.customerName'] = $customer['name']; - $userService = $this->userService; + $userService = $this->container->get('user.service'); $variables['ticket.agentName'] = ''; $variables['ticket.agentEmail'] = ''; if ($ticket->getAgent()) { - $agent = $this->userService->getAgentDetailById($ticket->getAgent()->getId()); + $agent = $this->container->get('user.service')->getAgentDetailById($ticket->getAgent()->getId()); if($agent) { $variables['ticket.agentName'] = $agent['name']; $variables['ticket.agentEmail'] = $agent['email']; @@ -1540,7 +1540,7 @@ public function isEmailBlocked($email, $website) $flag = false; $email = strtolower($email); $knowlegeBaseWebsite = $this->entityManager->getRepository('UVDeskSupportCenterBundle:KnowledgebaseWebsite')->findOneBy(['website' => $website->getId(), 'isActive' => 1]); - $list = $this->userService->getWebsiteSpamDetails($knowlegeBaseWebsite); + $list = $this->container->get('user.service')->getWebsiteSpamDetails($knowlegeBaseWebsite); // Blacklist if (!empty($list['blackList']['email']) && in_array($email, $list['blackList']['email'])) { @@ -1580,7 +1580,7 @@ public function timeZoneConverter($dateFlag) $timeZone = $website->getTimezone(); $timeFormat = $website->getTimeformat(); - $activeUser = $this->userService->getSessionUser(); + $activeUser = $this->container->get('user.service')->getSessionUser(); $agentTimeZone = !empty($activeUser) ? $activeUser->getTimezone() : null; $agentTimeFormat = !empty($activeUser) ? $activeUser->getTimeformat() : null; @@ -1638,7 +1638,7 @@ public function isTicketAccessGranted(Ticket $ticket, User $user = null, $firewa { // @TODO: Take current firewall into consideration (access check on behalf of agent/customer) if (empty($user)) { - $user = $this->userService->getSessionUser(); + $user = $this->container->get('user.service')->getSessionUser(); } if (empty($user)) { From 3282ba003371e19cbe639acd1e7b341cd9d2a8c3 Mon Sep 17 00:00:00 2001 From: Marco Borla Date: Mon, 5 Oct 2020 16:21:16 +0200 Subject: [PATCH 10/85] Update layout.html.twig Security issue fix. Updating components. Issue https://github.com/uvdesk/community-skeleton/issues/311 --- Resources/views/Templates/layout.html.twig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Resources/views/Templates/layout.html.twig b/Resources/views/Templates/layout.html.twig index e0b302fca..da5ff0dd3 100644 --- a/Resources/views/Templates/layout.html.twig +++ b/Resources/views/Templates/layout.html.twig @@ -24,8 +24,8 @@ {% block templateCSS %}{% endblock %} - - + + @@ -161,4 +161,4 @@ {% endfor %} - \ No newline at end of file + From 8c9416f9474be9cc8530e99d59354f3b6d1ec8e0 Mon Sep 17 00:00:00 2001 From: Marco Borla Date: Tue, 6 Oct 2020 20:59:19 +0200 Subject: [PATCH 11/85] Update layout.html.twig Fix --- Resources/views/Templates/layout.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/Templates/layout.html.twig b/Resources/views/Templates/layout.html.twig index da5ff0dd3..bc9bfcf40 100644 --- a/Resources/views/Templates/layout.html.twig +++ b/Resources/views/Templates/layout.html.twig @@ -7,7 +7,7 @@ - + From e4a486e310ec09b4269df55d5f9ee1448271d883 Mon Sep 17 00:00:00 2001 From: Marco Borla Date: Tue, 6 Oct 2020 21:00:30 +0200 Subject: [PATCH 12/85] Update layout.html.twig Fix --- Resources/views/Templates/layout.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/Templates/layout.html.twig b/Resources/views/Templates/layout.html.twig index bc9bfcf40..1e7bfb93e 100644 --- a/Resources/views/Templates/layout.html.twig +++ b/Resources/views/Templates/layout.html.twig @@ -33,7 +33,7 @@ - + From 35ad70269612b4105956d0d620c23a34908261a8 Mon Sep 17 00:00:00 2001 From: Marco Borla Date: Tue, 6 Oct 2020 21:07:13 +0200 Subject: [PATCH 13/85] Update layout.html.twig Reverse back because error in console --- Resources/views/Templates/layout.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/Templates/layout.html.twig b/Resources/views/Templates/layout.html.twig index 1e7bfb93e..bc9bfcf40 100644 --- a/Resources/views/Templates/layout.html.twig +++ b/Resources/views/Templates/layout.html.twig @@ -33,7 +33,7 @@ - + From 195993fbcc8c7302481b3c40f4c14fd748b3ca03 Mon Sep 17 00:00:00 2001 From: Marco Borla Date: Tue, 6 Oct 2020 21:13:08 +0200 Subject: [PATCH 14/85] Update layout.html.twig Reverting back due to console error --- Resources/views/Templates/layout.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/Templates/layout.html.twig b/Resources/views/Templates/layout.html.twig index bc9bfcf40..da5ff0dd3 100644 --- a/Resources/views/Templates/layout.html.twig +++ b/Resources/views/Templates/layout.html.twig @@ -7,7 +7,7 @@ - + From 49caa20c42ac502324bab5ef60616dfbff78a7fc Mon Sep 17 00:00:00 2001 From: Marco Borla Date: Tue, 6 Oct 2020 21:36:16 +0200 Subject: [PATCH 15/85] Update layout.html.twig Tested, fixes and security, no error in console. --- Resources/views/Templates/layout.html.twig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Resources/views/Templates/layout.html.twig b/Resources/views/Templates/layout.html.twig index da5ff0dd3..e3e685072 100644 --- a/Resources/views/Templates/layout.html.twig +++ b/Resources/views/Templates/layout.html.twig @@ -26,15 +26,15 @@ - + - + - + From 05973b6b0543df3de7e70d389e70b9fb6475c237 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 8 Oct 2020 18:25:24 +0530 Subject: [PATCH 16/85] correct some translation --- Controller/Thread.php | 2 +- Resources/views/ticket.html.twig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Controller/Thread.php b/Controller/Thread.php index 3e038e324..8400ec970 100755 --- a/Controller/Thread.php +++ b/Controller/Thread.php @@ -131,7 +131,7 @@ public function saveThread($ticketId, Request $request) $this->eventDispatcher->dispatch('uvdesk.automation.workflow.execute', $event); // @TODO: Render response on the basis of event response (if propogation was stopped or not) - $this->addFlash('success', $this->translator->trans('Reply added to ticket successfully.')); + $this->addFlash('success', $this->get('translator')->trans('Success ! Reply added successfully.')); break; case 'forward': // Prepare headers diff --git a/Resources/views/ticket.html.twig b/Resources/views/ticket.html.twig index dd37ecd69..42c231219 100755 --- a/Resources/views/ticket.html.twig +++ b/Resources/views/ticket.html.twig @@ -462,13 +462,13 @@ {% else %} - {{ ticket.status.description }} + {{ ticket.status.description|trans }} {% endif %} From e928e05a1e7dd046405d09920b56bead9fd1c839 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 9 Oct 2020 14:31:50 +0530 Subject: [PATCH 17/85] customer list page status translate --- Repository/TicketRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Repository/TicketRepository.php b/Repository/TicketRepository.php index 36dc508f5..8c9b5a86c 100644 --- a/Repository/TicketRepository.php +++ b/Repository/TicketRepository.php @@ -101,7 +101,7 @@ public function getAllTickets(ParameterBag $obj = null, $container, $actAsUser = $translatorService = $container->get('translator'); foreach ($results as $key => $ticket) { - $ticket[0]['status']['code'] = $translatorService->trans($ticket[0]['status']['code']); + $ticket[0]['status']['description'] = $translatorService->trans($ticket[0]['status']['description']); $data[] = [ 'id' => $ticket[0]['id'], From 62fc632405aa17b75b7f1bf02c6d86a3f27355a0 Mon Sep 17 00:00:00 2001 From: Marco Borla Date: Sat, 10 Oct 2020 21:26:57 +0200 Subject: [PATCH 18/85] Update login.html.twig Translate Sign In --- Resources/views/login.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/login.html.twig b/Resources/views/login.html.twig index 938da4df7..5d0296bd3 100644 --- a/Resources/views/login.html.twig +++ b/Resources/views/login.html.twig @@ -53,7 +53,7 @@ - + From 9116e95e7a5bf2dacb60aa3d61440f8783826f40 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Mon, 12 Oct 2020 13:25:07 +0530 Subject: [PATCH 19/85] default timezone and timeformat set for agent and customer as set on branding --- Services/UserService.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Services/UserService.php b/Services/UserService.php index 62c7fd1d4..774e89e61 100644 --- a/Services/UserService.php +++ b/Services/UserService.php @@ -174,6 +174,10 @@ public function createUserInstance($email, $name, SupportRole $role, array $extr { $user = $this->entityManager->getRepository('UVDeskCoreFrameworkBundle:User')->findOneByEmail($email) ?: new User(); + $website = $this->entityManager->getRepository('UVDeskCoreFrameworkBundle:Website')->findOneBy(['code' => 'knowledgebase']); + $timeZone = $website->getTimezone(); + $timeFormat = $website->getTimeformat(); + if (null == $user->getId()) { $name = explode(' ', trim($name)); @@ -181,6 +185,8 @@ public function createUserInstance($email, $name, SupportRole $role, array $extr $user->setFirstName(isset($extras['firstName']) ? $extras['firstName'] : array_shift($name)); $user->setLastName(trim(implode(' ', $name))); $user->setIsEnabled(true); + $user->setTimeZone($timeZone); + $user->setTimeFormat($timeFormat); $this->entityManager->persist($user); $this->entityManager->flush(); From aea5954f1f653c16bd63b6b85f8293ee32aee3ad Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 14 Oct 2020 14:54:27 +0530 Subject: [PATCH 20/85] updates --- Controller/AccountXHR.php | 4 ++-- Controller/CustomerXHR.php | 4 ++-- Controller/Email.php | 4 ++-- Controller/EmailSettingsXHR.php | 7 +++++-- Controller/GroupXHR.php | 4 ++-- Controller/PrivilegeXHR.php | 4 ++-- Controller/SavedReplies.php | 4 ++-- Controller/SwiftMailer.php | 9 +++++---- Controller/SwiftMailerXHR.php | 4 ++-- Controller/TeamXHR.php | 4 ++-- Controller/Thread.php | 2 +- Controller/Ticket.php | 11 +++++++---- 12 files changed, 34 insertions(+), 27 deletions(-) diff --git a/Controller/AccountXHR.php b/Controller/AccountXHR.php index 26391483c..c332b29e1 100755 --- a/Controller/AccountXHR.php +++ b/Controller/AccountXHR.php @@ -7,14 +7,14 @@ use Symfony\Component\HttpFoundation\Response; use Webkul\UVDesk\CoreFrameworkBundle\Entity\SavedFilters; use Symfony\Component\EventDispatcher\GenericEvent; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Translation\TranslatorInterface; -class AccountXHR extends AbstractController +class AccountXHR extends Controller { private $eventDispatcher; private $translator; diff --git a/Controller/CustomerXHR.php b/Controller/CustomerXHR.php index fe8da4e0a..6060e7020 100644 --- a/Controller/CustomerXHR.php +++ b/Controller/CustomerXHR.php @@ -6,13 +6,13 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\EventDispatcher\GenericEvent; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Translation\TranslatorInterface; -class CustomerXHR extends AbstractController +class CustomerXHR extends Controller { private $userService; private $eventDispatcher; diff --git a/Controller/Email.php b/Controller/Email.php index 7ae7306ed..8590d73c6 100755 --- a/Controller/Email.php +++ b/Controller/Email.php @@ -3,7 +3,7 @@ namespace Webkul\UVDesk\CoreFrameworkBundle\Controller; use Doctrine\Common\Collections\Criteria; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Routing\Router; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -14,7 +14,7 @@ use Symfony\Component\Translation\TranslatorInterface; -class Email extends AbstractController +class Email extends Controller { const LIMIT = 10; diff --git a/Controller/EmailSettingsXHR.php b/Controller/EmailSettingsXHR.php index 081876e77..c2945b057 100644 --- a/Controller/EmailSettingsXHR.php +++ b/Controller/EmailSettingsXHR.php @@ -9,23 +9,26 @@ use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Translation\TranslatorInterface; use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\SwiftMailer; +use Symfony\Component\HttpKernel\KernelInterface; class EmailSettingsXHR extends AbstractController { private $userService; private $translator; private $swiftMailer; + private $kernel; - public function __construct(UserService $userService, TranslatorInterface $translator,SwiftMailer $swiftMailer) + public function __construct(UserService $userService, TranslatorInterface $translator,SwiftMailer $swiftMailer, KernelInterface $kernel) { $this->userService = $userService; $this->translator = $translator; $this->swiftMailer = $swiftMailer; + $this->kernel = $kernel; } public function updateSettingsXHR(Request $request) { - $filePath = $this->get('kernel')->getProjectDir() . '/config/packages/uvdesk.yaml'; + $filePath = $this->kernel->getProjectDir() . '/config/packages/uvdesk.yaml'; $memberPrefix = $this->getParameter('uvdesk_site_path.member_prefix') ?? 'member'; $customerPrefix = $this->getParameter('uvdesk_site_path.knowledgebase_customer_prefix') ?? 'customer'; diff --git a/Controller/GroupXHR.php b/Controller/GroupXHR.php index 78017de12..9d48692ae 100644 --- a/Controller/GroupXHR.php +++ b/Controller/GroupXHR.php @@ -3,11 +3,11 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Translation\TranslatorInterface; -class GroupXHR extends AbstractController +class GroupXHR extends Controller { private $userService; private $translator; diff --git a/Controller/PrivilegeXHR.php b/Controller/PrivilegeXHR.php index 62cba014b..a8e6a7b39 100644 --- a/Controller/PrivilegeXHR.php +++ b/Controller/PrivilegeXHR.php @@ -6,12 +6,12 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportPrivilege; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Translation\TranslatorInterface; -class PrivilegeXHR extends AbstractController +class PrivilegeXHR extends Controller { private $userService; private $translator; diff --git a/Controller/SavedReplies.php b/Controller/SavedReplies.php index 69982eaad..b8b890a61 100755 --- a/Controller/SavedReplies.php +++ b/Controller/SavedReplies.php @@ -4,14 +4,14 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Webkul\UVDesk\CoreFrameworkBundle\Form as CoreFrameworkBundleForms; use Webkul\UVDesk\CoreFrameworkBundle\Entity as CoreFrameworkBundleEntities; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Translation\TranslatorInterface; -class SavedReplies extends AbstractController +class SavedReplies extends Controller { const LIMIT = 10; const ROLE_REQUIRED = 'saved_replies'; diff --git a/Controller/SwiftMailer.php b/Controller/SwiftMailer.php index 6be36c1f9..9f392112e 100644 --- a/Controller/SwiftMailer.php +++ b/Controller/SwiftMailer.php @@ -5,14 +5,14 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\Event\ConfigurationUpdatedEvent; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Translation\TranslatorInterface; use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\SwiftMailer as SwiftMailerService; -class SwiftMailer extends AbstractController +class SwiftMailer extends Controller { private $userService; private $translator; @@ -38,7 +38,7 @@ public function createMailerConfiguration(Request $request) { if ($request->getMethod() == 'POST') { $params = $request->request->all(); - $swiftmailer = $this->swiftmailer; + $swiftmailer = $this->swiftMailer; $swiftmailerConfiguration = $swiftmailer->createConfiguration($params['transport'], $params['id']); @@ -63,7 +63,7 @@ public function createMailerConfiguration(Request $request) public function updateMailerConfiguration($id, Request $request) { - $swiftmailerService = $this->swiftmailer;; + $swiftmailerService = $this->swiftMailer;; $swiftmailerConfigurations = $swiftmailerService->parseSwiftMailerConfigurations(); foreach ($swiftmailerConfigurations as $index => $configuration) { @@ -85,6 +85,7 @@ public function updateMailerConfiguration($id, Request $request) // Dispatch swiftmailer configuration updated event $event = new ConfigurationUpdatedEvent($swiftmailerConfiguration, $existingSwiftmailerConfiguration); + $this->get('uvdesk.core.event_dispatcher')->dispatch(ConfigurationUpdatedEvent::NAME, $event); // Updated swiftmailer configuration file diff --git a/Controller/SwiftMailerXHR.php b/Controller/SwiftMailerXHR.php index 810a07d79..bb14d6f90 100644 --- a/Controller/SwiftMailerXHR.php +++ b/Controller/SwiftMailerXHR.php @@ -4,12 +4,12 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\Event\ConfigurationRemovedEvent; use Symfony\Component\Translation\TranslatorInterface; use Webkul\UVDesk\CoreFrameworkBundle\SwiftMailer\SwiftMailer as SwiftMailerService; -class SwiftMailerXHR extends AbstractController +class SwiftMailerXHR extends Controller { private $translator; private $swiftMailer; diff --git a/Controller/TeamXHR.php b/Controller/TeamXHR.php index f75a10ef3..015f8dd76 100755 --- a/Controller/TeamXHR.php +++ b/Controller/TeamXHR.php @@ -5,12 +5,12 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\User; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; use Symfony\Component\Translation\TranslatorInterface; -class TeamXHR extends AbstractController +class TeamXHR extends Controller { private $userService; private $translator; diff --git a/Controller/Thread.php b/Controller/Thread.php index 8400ec970..37d871418 100755 --- a/Controller/Thread.php +++ b/Controller/Thread.php @@ -144,7 +144,7 @@ public function saveThread($ticketId, Request $request) // Prepare attachments $attachments = $entityManager->getRepository(Attachment::class)->findByThread($thread); - $projectDir = $this->get('kernel')->getProjectDir(); + $projectDir = $this->kernel->getProjectDir(); $attachments = array_map(function($attachment) use ($projectDir) { return str_replace('//', '/', $projectDir . "/public" . $attachment->getPath()); }, $attachments); diff --git a/Controller/Ticket.php b/Controller/Ticket.php index de6ec6f50..7309e6144 100755 --- a/Controller/Ticket.php +++ b/Controller/Ticket.php @@ -6,7 +6,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\EventDispatcher\GenericEvent; use Webkul\UVDesk\CoreFrameworkBundle\Form as CoreFrameworkBundleForms; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Webkul\UVDesk\CoreFrameworkBundle\Entity as CoreFrameworkBundleEntities; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Webkul\UVDesk\CoreFrameworkBundle\DataProxies as CoreFrameworkBundleDataProxies; @@ -18,22 +18,25 @@ use Webkul\UVDesk\CoreFrameworkBundle\Services\TicketService; use Webkul\UVDesk\CoreFrameworkBundle\Services\EmailService; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpKernel\KernelInterface; -class Ticket extends AbstractController +class Ticket extends Controller { private $userService; private $translator; private $eventDispatcher; private $ticketService; private $emailService; + private $kernel; - public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcherInterface $eventDispatcher) + public function __construct(UserService $userService, TranslatorInterface $translator, TicketService $ticketService, EmailService $emailService, EventDispatcherInterface $eventDispatcher, KernelInterface $kernel) { $this->userService = $userService; $this->emailService = $emailService; $this->translator = $translator; $this->ticketService = $ticketService; $this->eventDispatcher = $eventDispatcher; + $this->kernel = $kernel; } public function listTicketCollection(Request $request) @@ -374,7 +377,7 @@ public function downloadAttachment(Request $request) $this->noResultFound(); } - $path = $this->get('kernel')->getProjectDir() . "/public/". $attachment->getPath(); + $path = $this->kernel->getProjectDir() . "/public/". $attachment->getPath(); $response = new Response(); $response->setStatusCode(200); From 47631795ed04f468f21f8bdff1f7d6d5f73d50a2 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 14 Oct 2020 17:42:27 +0530 Subject: [PATCH 21/85] dispatcher update --- Controller/SwiftMailer.php | 2 +- Controller/SwiftMailerXHR.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/SwiftMailer.php b/Controller/SwiftMailer.php index 9f392112e..710e330dd 100644 --- a/Controller/SwiftMailer.php +++ b/Controller/SwiftMailer.php @@ -86,7 +86,7 @@ public function updateMailerConfiguration($id, Request $request) // Dispatch swiftmailer configuration updated event $event = new ConfigurationUpdatedEvent($swiftmailerConfiguration, $existingSwiftmailerConfiguration); - $this->get('uvdesk.core.event_dispatcher')->dispatch(ConfigurationUpdatedEvent::NAME, $event); + $this->get('uvdesk.core.event_dispatcher')->dispatch($event,ConfigurationUpdatedEvent::NAME); // Updated swiftmailer configuration file $swiftmailerConfigurations[$index] = $swiftmailerConfiguration; diff --git a/Controller/SwiftMailerXHR.php b/Controller/SwiftMailerXHR.php index bb14d6f90..1b58e310d 100644 --- a/Controller/SwiftMailerXHR.php +++ b/Controller/SwiftMailerXHR.php @@ -57,7 +57,7 @@ public function removeMailerConfiguration(Request $request) // Dispatch swiftmailer configuration removed event $event = new ConfigurationRemovedEvent($swiftmailerConfiguration); - $this->get('uvdesk.core.event_dispatcher')->dispatch(ConfigurationRemovedEvent::NAME, $event); + $this->get('uvdesk.core.event_dispatcher')->dispatch($event,ConfigurationRemovedEvent::NAME); // Update swiftmailer configuration file $swiftmailer->writeSwiftMailerConfigurations($configurations); From 42cc2fc3b6ec624b1d910d5db6c6b76a14af70e8 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 15 Oct 2020 20:20:45 +0530 Subject: [PATCH 22/85] update --- Controller/Thread.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/Thread.php b/Controller/Thread.php index 37d871418..acfae9e2e 100755 --- a/Controller/Thread.php +++ b/Controller/Thread.php @@ -8,7 +8,7 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity\Ticket; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Webkul\UVDesk\CoreFrameworkBundle\Entity\Attachment; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Webkul\UVDesk\CoreFrameworkBundle\Entity\TicketStatus; use Webkul\UVDesk\CoreFrameworkBundle\Entity\Thread as TicketThread; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; @@ -18,7 +18,7 @@ use Webkul\UVDesk\CoreFrameworkBundle\Services\TicketService; use Webkul\UVDesk\CoreFrameworkBundle\Services\EmailService; -class Thread extends AbstractController +class Thread extends Controller { private $userService; private $translator; From 60aeef4377d0d2e65716903c8155d79c5885f3b9 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 16 Oct 2020 14:23:12 +0530 Subject: [PATCH 23/85] update --- Controller/Account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/Account.php b/Controller/Account.php index f1ecabc67..6488d4726 100755 --- a/Controller/Account.php +++ b/Controller/Account.php @@ -127,7 +127,7 @@ public function loadProfile(Request $request) $userInstance = $this->userService->getUserDetailById($user->getId()); if (isset($dataFiles['profileImage'])) { - $assetDetails = $this->filesystem->getUploadManager()->uploadFile($dataFiles['profileImage'], 'profile'); + $assetDetails = $this->fileSystem->getUploadManager()->uploadFile($dataFiles['profileImage'], 'profile'); $userInstance->setProfileImagePath($assetDetails['path']); } From 5a14472f4753bcbae808c857f262d6b5762a0210 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 16 Oct 2020 16:25:19 +0530 Subject: [PATCH 24/85] updates --- Controller/TicketXHR.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/TicketXHR.php b/Controller/TicketXHR.php index f832553b9..7ff77b272 100755 --- a/Controller/TicketXHR.php +++ b/Controller/TicketXHR.php @@ -7,7 +7,7 @@ use Webkul\UVDesk\CoreFrameworkBundle\Entity as CoreFrameworkBundleEntities; use Webkul\UVDesk\CoreFrameworkBundle\Entity\SupportLabel; use Symfony\Component\EventDispatcher\GenericEvent; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents; use Webkul\UVDesk\CoreFrameworkBundle\Form as CoreFrameworkBundleForms; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; @@ -19,7 +19,7 @@ use Webkul\UVDesk\CoreFrameworkBundle\Services\EmailService; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -class TicketXHR extends AbstractController +class TicketXHR extends Controller { private $userService; private $translator; From 1bb79ac26a849c89c5e8afc33f438fe620ed1448 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 16 Oct 2020 17:34:31 +0530 Subject: [PATCH 25/85] branding flash message added --- Controller/Theme.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Controller/Theme.php b/Controller/Theme.php index fba8da4d1..5352b4562 100644 --- a/Controller/Theme.php +++ b/Controller/Theme.php @@ -4,9 +4,17 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\Translation\TranslatorInterface; class Theme extends AbstractController { + private $translator; + + public function __construct(TranslatorInterface $translator) + { + $this->translator = $translator; + } + public function updateHelpdeskTheme(Request $request) { if ($request->getMethod() == "POST") { @@ -19,6 +27,8 @@ public function updateHelpdeskTheme(Request $request) $entityManager->persist($website); $entityManager->flush(); + + $this->addFlash('success', $this->translator->trans('Success ! Helpdesk details saved successfully')); } return $this->render('@UVDeskCoreFramework/theme.html.twig'); From e28b2df12be8c711417495cd131304232c07bc2f Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Mon, 19 Oct 2020 11:50:30 +0530 Subject: [PATCH 26/85] unnecessary previlege removed --- Services/UVDeskService.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Services/UVDeskService.php b/Services/UVDeskService.php index c69564c73..98ff658ae 100644 --- a/Services/UVDeskService.php +++ b/Services/UVDeskService.php @@ -201,15 +201,7 @@ public function getSupportPrivelegesResources() 'ROLE_AGENT_DELETE_THREAD_NOTE' => $translator->trans('Can delete thread/notes'), 'ROLE_AGENT_APPLY_WORKFLOW' => $translator->trans('Can apply prepared response on ticket'), 'ROLE_AGENT_ADD_TAG' => $translator->trans('Can add ticket tags'), - 'ROLE_AGENT_DELETE_TAG' => $translator->trans('Can delete ticket tags'), - 'ROLE_AGENT_AGENT_KICK' => $translator->trans('Can kick other ticket users') - ], - 'task' => [ - 'ROLE_AGENT_EDIT_TASK' => $translator->trans('Can edit task'), - 'ROLE_AGENT_CREATE_TASK' => $translator->trans('Can create task'), - 'ROLE_AGENT_DELETE_TASK' => $translator->trans('Can delete task'), - 'ROLE_AGENT_ADD_MEMBER_TO_TASK' => $translator->trans('Can add member to task'), - 'ROLE_AGENT_DELETE_MEMBER_FROM_TASK' => $translator->trans('Can remove member from task') + 'ROLE_AGENT_DELETE_TAG' => $translator->trans('Can delete ticket tags') ], 'advanced' => [ 'ROLE_AGENT_MANAGE_EMAIL_TEMPLATE' => $translator->trans('Can manage email templates'), From fa1bf2288550817e53993a2216e316fc8846553a Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Mon, 19 Oct 2020 16:43:29 +0530 Subject: [PATCH 27/85] updated filesystem --- Controller/Customer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/Customer.php b/Controller/Customer.php index 1fc82216b..5ea1b4714 100755 --- a/Controller/Customer.php +++ b/Controller/Customer.php @@ -146,7 +146,7 @@ public function editCustomer(Request $request) $userInstance->setContactNumber($data['contactNumber']); } if(isset($contentFile['profileImage'])){ - $assetDetails = $this->filesystem->getUploadManager()->uploadFile($contentFile['profileImage'], 'profile'); + $assetDetails = $this->fileSystem->getUploadManager()->uploadFile($contentFile['profileImage'], 'profile'); $userInstance->setProfileImagePath($assetDetails['path']); } From 674f67c5d3c035816651d8a93aaf38bb4637fe5d Mon Sep 17 00:00:00 2001 From: Akshay Kumar Date: Tue, 20 Oct 2020 10:37:55 +0530 Subject: [PATCH 28/85] Unset branch alias in development branch --- composer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/composer.json b/composer.json index c72225c8d..27493f178 100644 --- a/composer.json +++ b/composer.json @@ -26,10 +26,7 @@ "psr-4": { "Webkul\\UVDesk\\CoreFrameworkBundle\\": "" } }, "extra": { - "uvdesk-package-extension": "Webkul\\UVDesk\\CoreFrameworkBundle\\Package\\Composer", - "branch-alias": { - "dev-master": "1.0.x-dev" - } + "uvdesk-package-extension": "Webkul\\UVDesk\\CoreFrameworkBundle\\Package\\Composer" }, "minimum-stability": "dev" } From 333ed81deaea67caf71fc15379c40e58ada98f47 Mon Sep 17 00:00:00 2001 From: Akshay Kumar Date: Tue, 20 Oct 2020 10:54:58 +0530 Subject: [PATCH 29/85] Reset branch alias to branch 1.0 --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 27493f178..c72225c8d 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,10 @@ "psr-4": { "Webkul\\UVDesk\\CoreFrameworkBundle\\": "" } }, "extra": { - "uvdesk-package-extension": "Webkul\\UVDesk\\CoreFrameworkBundle\\Package\\Composer" + "uvdesk-package-extension": "Webkul\\UVDesk\\CoreFrameworkBundle\\Package\\Composer", + "branch-alias": { + "dev-master": "1.0.x-dev" + } }, "minimum-stability": "dev" } From 4596c42539048e421152383baaea282434eff212 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Tue, 20 Oct 2020 12:41:32 +0530 Subject: [PATCH 30/85] jsonContext added --- Resources/views/templateForm.html.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/Resources/views/templateForm.html.twig b/Resources/views/templateForm.html.twig index b52515144..d94983152 100644 --- a/Resources/views/templateForm.html.twig +++ b/Resources/views/templateForm.html.twig @@ -197,6 +197,7 @@ }, initialize : function() { Backbone.Validation.bind(this); + var jsonContext = {}; for (var field in jsonContext) { Backbone.Validation.callbacks.invalid(this, field, jsonContext[field], 'input'); } From e76bb33f3926a308dacf04664c54302c3a5d5545 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Tue, 20 Oct 2020 13:07:38 +0530 Subject: [PATCH 31/85] jsonContext added --- Resources/views/templateForm.html.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/Resources/views/templateForm.html.twig b/Resources/views/templateForm.html.twig index d94983152..0ef5004cd 100644 --- a/Resources/views/templateForm.html.twig +++ b/Resources/views/templateForm.html.twig @@ -198,6 +198,7 @@ initialize : function() { Backbone.Validation.bind(this); var jsonContext = {}; + for (var field in jsonContext) { Backbone.Validation.callbacks.invalid(this, field, jsonContext[field], 'input'); } From 5e92cbf90d52db371139cf6630acb673b98a1282 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 22 Oct 2020 09:38:33 +0530 Subject: [PATCH 32/85] method change to getOneOrNullResult for mail to agent action --- Workflow/Actions/Ticket/MailAgent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workflow/Actions/Ticket/MailAgent.php b/Workflow/Actions/Ticket/MailAgent.php index ee15c1332..978afa75b 100644 --- a/Workflow/Actions/Ticket/MailAgent.php +++ b/Workflow/Actions/Ticket/MailAgent.php @@ -72,7 +72,7 @@ public static function applyAction(ContainerInterface $container, $entity, $valu ->orderBy('th.id', 'DESC') ->setMaxResults(1); - $inReplyTo = $queryBuilder->getQuery()->getSingleResult(); + $inReplyTo = $queryBuilder->getQuery()->getOneOrNullResult(); if (!empty($inReplyTo)) { $emailHeaders['In-Reply-To'] = $inReplyTo; From 1c17ce596c6a843fe767c064f4a9df9ba671575a Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 28 Oct 2020 16:05:33 +0530 Subject: [PATCH 33/85] translation update for reset password page --- Resources/views/resetPassword.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/resetPassword.html.twig b/Resources/views/resetPassword.html.twig index 402ffc7b1..4154861d4 100644 --- a/Resources/views/resetPassword.html.twig +++ b/Resources/views/resetPassword.html.twig @@ -27,7 +27,7 @@

{{ "Reset Password" |trans}}

-

{{ "Enter your new password below to update your login credentials." |trans}}

+

{{ "Enter your new password below to update your login credentials" |trans}}

From a87799adc2451de195f2410b28e0618ed13d694c Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 12 Nov 2020 10:46:58 +0530 Subject: [PATCH 34/85] email validation update --- Resources/views/Agents/createSupportAgent.html.twig | 2 +- Resources/views/Agents/updateSupportAgent.html.twig | 2 +- Resources/views/Customers/createSupportCustomer.html.twig | 2 +- Resources/views/Customers/updateSupportCustomer.html.twig | 2 +- Resources/views/Snippets/createMemberTicket.html.twig | 2 +- Resources/views/SwiftMailer/manageConfigurations.html.twig | 2 +- Resources/views/ticket.html.twig | 6 +++--- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Resources/views/Agents/createSupportAgent.html.twig b/Resources/views/Agents/createSupportAgent.html.twig index 55cdcf382..4c463eaf1 100644 --- a/Resources/views/Agents/createSupportAgent.html.twig +++ b/Resources/views/Agents/createSupportAgent.html.twig @@ -368,7 +368,7 @@ required: true, 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})(\]?)$/, + pattern: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, msg: '{{ "This is not a valid email address" | trans}}' }], 'user_form[contactNumber]': function(value) { diff --git a/Resources/views/Agents/updateSupportAgent.html.twig b/Resources/views/Agents/updateSupportAgent.html.twig index 0dff2361b..a7389962e 100644 --- a/Resources/views/Agents/updateSupportAgent.html.twig +++ b/Resources/views/Agents/updateSupportAgent.html.twig @@ -420,7 +420,7 @@ required: true, 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})(\]?)$/, + pattern: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, msg: '{{ "This is not a valid email address"|trans }}' }], 'user_form[contactNumber]': function(value) { diff --git a/Resources/views/Customers/createSupportCustomer.html.twig b/Resources/views/Customers/createSupportCustomer.html.twig index 2081d7763..07eafaf63 100644 --- a/Resources/views/Customers/createSupportCustomer.html.twig +++ b/Resources/views/Customers/createSupportCustomer.html.twig @@ -154,7 +154,7 @@ required: true, 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})(\]?)$/, + pattern: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, msg: '{{ "Email address is invalid"|trans }}' }], 'customer_form[contactNumber]': function(value) { diff --git a/Resources/views/Customers/updateSupportCustomer.html.twig b/Resources/views/Customers/updateSupportCustomer.html.twig index 11f1113d4..9a2341121 100644 --- a/Resources/views/Customers/updateSupportCustomer.html.twig +++ b/Resources/views/Customers/updateSupportCustomer.html.twig @@ -157,7 +157,7 @@ required: true, 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})(\]?)$/, + pattern: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, msg: '{{ "Email address is invalid"|trans }}' }], 'customer_form[contactNumber]': function(value) { diff --git a/Resources/views/Snippets/createMemberTicket.html.twig b/Resources/views/Snippets/createMemberTicket.html.twig index 077021850..d42bd5336 100644 --- a/Resources/views/Snippets/createMemberTicket.html.twig +++ b/Resources/views/Snippets/createMemberTicket.html.twig @@ -116,7 +116,7 @@ required : true, 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})(\]?)$/, + pattern : /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, msg : "{{ 'Email address is invalid'|trans }}" }], {% endif %} diff --git a/Resources/views/SwiftMailer/manageConfigurations.html.twig b/Resources/views/SwiftMailer/manageConfigurations.html.twig index 44f7d1a5e..3b7526439 100644 --- a/Resources/views/SwiftMailer/manageConfigurations.html.twig +++ b/Resources/views/SwiftMailer/manageConfigurations.html.twig @@ -248,7 +248,7 @@ msg: '{{ "Please specify a valid email address"|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})(\]?)$/, + pattern: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, msg: '{{ "Please specify a valid email address"|trans }}' } ], diff --git a/Resources/views/ticket.html.twig b/Resources/views/ticket.html.twig index 42c231219..e662834f3 100755 --- a/Resources/views/ticket.html.twig +++ b/Resources/views/ticket.html.twig @@ -1403,7 +1403,7 @@ required: true, 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})(\]?)$/, + pattern: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, msg: 'Please enter a valid email' }], 'subject' : { @@ -1448,7 +1448,7 @@ required: true, 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})(\]?)$/, + pattern: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, msg: '{{ "Email address is invalid" | trans}}' }], 'contactNumber': function(value) { @@ -1469,7 +1469,7 @@ required: true, 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})(\]?)$/, + pattern: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, msg: '{{ "Please enter a valid email" | trans}}' }] }, From aa3b85902a2dc5e2196bfaa58631b3c0ad847079 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 25 Nov 2020 13:49:56 +0530 Subject: [PATCH 35/85] added option for automatically label assign to ticket from workflow --- Services/TicketService.php | 26 +++++++++++ Workflow/Actions/Ticket/UpdateLabel.php | 61 +++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 Workflow/Actions/Ticket/UpdateLabel.php diff --git a/Services/TicketService.php b/Services/TicketService.php index aca649c18..498bb5fa9 100644 --- a/Services/TicketService.php +++ b/Services/TicketService.php @@ -1240,6 +1240,32 @@ public function getTicketLabels($ticketId) return $result ? $result : []; } + public function getUserLabels() + { + $qb = $this->entityManager->createQueryBuilder(); + $qb->select('sl')->from('UVDeskCoreFrameworkBundle:SupportLabel', 'sl') + ->leftJoin('sl.user','slu') + ->andWhere('slu.id = :userId') + ->setParameter('userId', $this->getUser()->getId()); + + $result = $qb->getQuery()->getResult(); + + return $result ? $result : []; + } + + public function getTicketLabelsAll($ticketId) + { + $qb = $this->entityManager->createQueryBuilder(); + $qb->select('DISTINCT sl.id,sl.name,sl.colorCode')->from('UVDeskCoreFrameworkBundle:Ticket', 't') + ->leftJoin('t.supportLabels','sl') + ->andWhere('t.id = :ticketId') + ->setParameter('ticketId', $ticketId); + + $result = $qb->getQuery()->getResult(); + + return $result ? $result : []; + } + public function getManualWorkflow() { diff --git a/Workflow/Actions/Ticket/UpdateLabel.php b/Workflow/Actions/Ticket/UpdateLabel.php new file mode 100644 index 000000000..2fd135aab --- /dev/null +++ b/Workflow/Actions/Ticket/UpdateLabel.php @@ -0,0 +1,61 @@ +get('doctrine.orm.entity_manager'); + + return array_map(function ($label) { + return [ + 'id' => $label->getId(), + 'name' => $label->getName(), + ]; + }, $container->get('ticket.service')->getUserLabels()); + } + + public static function applyAction(ContainerInterface $container, $entity, $value = null) + { + $entityManager = $container->get('doctrine.orm.entity_manager'); + if($entity instanceof Ticket) { + $isAlreadyAdded = 0; + $labels = $container->get('ticket.service')->getTicketLabelsAll($entity->getId()); + if(is_array($labels)) { + foreach ($labels as $label) { + if($label['id'] == $value) + $isAlreadyAdded = 1; + } + } + if(!$isAlreadyAdded) { + $label = $entityManager->getRepository('UVDeskCoreFrameworkBundle:SupportLabel')->find($value); + if($label) { + $entity->addSupportLabel($label); + $entityManager->persist($entity); + $entityManager->flush(); + } + } + } + } +} From 0538756093725c0f3f75ad20e54b6af34b7af5a4 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 23 Dec 2020 15:14:25 +0530 Subject: [PATCH 36/85] Mail to customer action resolved when status update --- Workflow/Actions/Ticket/MailCustomer.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Workflow/Actions/Ticket/MailCustomer.php b/Workflow/Actions/Ticket/MailCustomer.php index 9e2d90f5a..72a7da9aa 100644 --- a/Workflow/Actions/Ticket/MailCustomer.php +++ b/Workflow/Actions/Ticket/MailCustomer.php @@ -82,6 +82,8 @@ public static function applyAction(ContainerInterface $container, $entity, $valu $entityManager->persist($createdThread); $entityManager->flush(); } + } else { + $message = $container->get('email.service')->sendMail($subject, $message, $entity->getCustomer()->getEmail()); } break; default: From e8df364c8040563ad7b01b8c49782488747f6cff Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 22 Jan 2021 18:07:51 +0530 Subject: [PATCH 37/85] Added multiple other option for editor on admin side reply box and removed undefined flag codes --- Resources/views/Templates/tinyMCE.html.twig | 102 +------------------- Resources/views/ticket.html.twig | 14 +-- 2 files changed, 6 insertions(+), 110 deletions(-) diff --git a/Resources/views/Templates/tinyMCE.html.twig b/Resources/views/Templates/tinyMCE.html.twig index d69a176f0..90516d415 100644 --- a/Resources/views/Templates/tinyMCE.html.twig +++ b/Resources/views/Templates/tinyMCE.html.twig @@ -14,37 +14,8 @@ theme: 'modern', menubar: false, height: 150, - toolbar: 'undo redo | bold italic | forecolor | bullist | numlist', + toolbar: 'undo redo | bold italic | forecolor | bullist | numlist | link | spellchecker | code | image', spellchecker_languages: 'English=en', - spellchecker_callback: function(method, text, success, failure) { - var words = text.match(this.getWordCharPattern()); - var data = {}; - if(words) { - data['words'] = Object.assign({}, words); - data['lang'] = this.getLanguage(); - var suggestions = {}; - {# if (method == "spellcheck") { - return $.ajax({ - data: data, - type: "POST", - url: '{{ path("app_translate_action", { "action": "spellcheck" }) }}', - success: function(response) { - for (var i = 0; i < words.length; i++) { - if('undefined' != typeof(response[words[i]]) ) { - suggestions[words[i]] = response[words[i]]; - } - } - success(suggestions); - }, - error: function(error) { - success(suggestions); - }, - }); - } #} - } else { - success({}); - } - }, plugins: [ 'spellchecker advlist autolink lists link charmap print preview hr anchor pagebreak', 'searchreplace wordcount visualblocks visualchars code fullscreen', @@ -54,7 +25,6 @@ 'mention', ], invalid_elements : 'script,style,iframe,input,textarea,form,onmouseover,onmouseout,onclick', - // paste_as_text: true, paste_data_images: true, mentions : { source: function(){ @@ -135,79 +105,17 @@ } function sendFile(files) { - var data = new FormData(); - var nonEmptyFlag; - $.each(files, function(key, file){ - var patt = new RegExp("(image/)(?!tif)"); - if(file.type && patt.test(file.type)) { - data.append("attachments[]", file); - nonEmptyFlag = true; - } - }); - {# var path = "{{ '/customer/' in app.request.requestUri ? path('ajax_file_upload_customer') : path('ajax_file_upload') }}"; - if(nonEmptyFlag) { - return $.ajax({ - data: data, - type: "POST", - enctype: 'multipart/form-data', - url: path, - processData: false, - contentType: false, - cache: false, - }); - } else { - app.appView.renderResponseAlert({'alertClass': 'danger', 'alertMessage': '{{ "Warning! Select valid image file."|trans }}' }); - } #} + } function sendUrls(url) { - {# var path = "{{ '/customer/' in app.request.requestUri ? path('ajax_url_file_customer') : path('ajax_url_file') }}"; - return $.ajax({ - data: {'url': url}, - type: "POST", - url: path, - dataType: 'json' - }); #} + } function removeFile(file) { - {# var path = "{{ '/customer/' in app.request.requestUri ? path('ajax_file_remove_customer') : path('ajax_file_remove') }}"; - return $.ajax({ - data: {'path': file}, - type: "POST", - url: path, - dataType: 'json' - }); #} + } addTranslateButton = function(editor) { - {# editor.addButton('translate', { - type: 'listbox', - title : 'selectContentAndTranslate', - text: '{{ "Translate"|trans }}', - onselect: function (e) { - this.text('{{ "Translate"|trans }}'); - if(editor.selection.getContent({format : 'html'})) { - ajaxData = { - 'lang': this.value(), - 'content': editor.selection.getContent({format : 'html'}), - }; - tinyMCE.activeEditor.setProgressState(true); - } else { - editor.notificationManager.close(); - editor.notificationManager.open({ - text: '{{ "Select text then select language to translate text."|trans }}', - type: 'info', - timeout: 3000, - closeButton: true - }); - } - }, - values: [ - {% for value, text in application_service.getTranslationSupportedLanguages() %} - { text: '{{ text }}', value: '{{ value }}' }, - {% endfor %} - { text: '“Powered by Yandex.Translate”', value: '', disabled: true }, - ], - }); #} + } \ No newline at end of file diff --git a/Resources/views/ticket.html.twig b/Resources/views/ticket.html.twig index e662834f3..9332e4fee 100755 --- a/Resources/views/ticket.html.twig +++ b/Resources/views/ticket.html.twig @@ -1258,19 +1258,7 @@
- + <% if (userType != 'system' && userType != 'System') { %> <% if(user && user.smallThumbnail != null) { %> From 08c793ebc812458567d98c6a7667ac164c604c0c Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 22 Jan 2021 19:20:44 +0530 Subject: [PATCH 38/85] Group and teams remove issue in saved replies --- Controller/SavedReplies.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Controller/SavedReplies.php b/Controller/SavedReplies.php index b8b890a61..d5828146e 100755 --- a/Controller/SavedReplies.php +++ b/Controller/SavedReplies.php @@ -69,10 +69,9 @@ public function updateSavedReplies(Request $request) $groups = explode(',', $request->request->get('tempGroups')); if ($template->getSupportGroups()) { - foreach ($template->getSupportGroups() as $key => $group) { + foreach ($template->getSupportGroups()->toArray() as $key => $group) { $previousGroupIds[] = $group->getId(); - - if (!in_array($group->getId(), $groups) && !empty($groups[0])) { + if (!in_array($group->getId(), $groups)) { $template->removeSupportGroups($group); $em->persist($template); } @@ -94,11 +93,11 @@ public function updateSavedReplies(Request $request) $previousTeamIds = []; $teams = explode(',', $request->request->get('tempTeams')); - if ($template->getSupportTeams()) { - foreach ($template->getSupportTeams() as $key => $team) { + if ($template->getSupportTeams()->toArray()) { + foreach ($template->getSupportTeams()->toArray() as $key => $team) { $previousTeamIds[] = $team->getId(); - if (!in_array($team->getId(), $teams) && !empty($teams[0])) { + if (!in_array($team->getId(), $teams)) { $template->removeSupportTeam($team); $em->persist($template); } From fd0b7bcd25143a561f6a447e8f806a2015e84b30 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Mon, 25 Jan 2021 12:22:31 +0530 Subject: [PATCH 39/85] option for more style in ticket reply editor --- Resources/views/Templates/tinyMCE.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/Templates/tinyMCE.html.twig b/Resources/views/Templates/tinyMCE.html.twig index 90516d415..cda60123f 100644 --- a/Resources/views/Templates/tinyMCE.html.twig +++ b/Resources/views/Templates/tinyMCE.html.twig @@ -14,7 +14,7 @@ theme: 'modern', menubar: false, height: 150, - toolbar: 'undo redo | bold italic | forecolor | bullist | numlist | link | spellchecker | code | image', + toolbar: 'undo redo | bold italic | forecolor | bullist | numlist | link | spellchecker | code | image | styleselect', spellchecker_languages: 'English=en', plugins: [ 'spellchecker advlist autolink lists link charmap print preview hr anchor pagebreak', From 43603f0c782d0b91608e1d1fd2b26833843d9f42 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Mon, 25 Jan 2021 14:46:58 +0530 Subject: [PATCH 40/85] style added for Blockqoute in ticket view --- Resources/views/ticket.html.twig | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Resources/views/ticket.html.twig b/Resources/views/ticket.html.twig index 9332e4fee..7190858f9 100755 --- a/Resources/views/ticket.html.twig +++ b/Resources/views/ticket.html.twig @@ -283,6 +283,28 @@ .uv-ticket-action-bar-rt .app-glyph:last-child { margin-right: 0px; } + + blockquote { + background: #f9f9f9; + border-left: 4px solid #ccc; + margin: 1.5em 10px; + padding: 0.5em 10px; + quotes: "\201C""\201D""\2018""\2019"; + } + + blockquote:before { + color: #ccc; + content: open-quote; + font-size: 3em; + line-height: 0.1em; + margin-right: 0.05em; + vertical-align: -0.4em; + } + + blockquote p { + display: inline; + } + {% endblock %} From 2105c6544754187a569f9b130490df6049e5fe18 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 27 Jan 2021 14:24:00 +0530 Subject: [PATCH 41/85] search bar update on permission basis --- Dashboard/SearchTemplate.php | 32 +++++++++++++++++-- UIComponents/Dashboard/Search/Agents.php | 5 +++ UIComponents/Dashboard/Search/Branding.php | 5 +++ .../Dashboard/Search/EmailSettings.php | 5 +++ .../Dashboard/Search/EmailTemplates.php | 5 +++ UIComponents/Dashboard/Search/Groups.php | 5 +++ UIComponents/Dashboard/Search/Privileges.php | 5 +++ .../Dashboard/Search/SavedReplies.php | 5 +++ UIComponents/Dashboard/Search/Tags.php | 5 +++ UIComponents/Dashboard/Search/Teams.php | 5 +++ UIComponents/Dashboard/Search/TicketTypes.php | 5 +++ UIComponents/Dashboard/Search/Tickets.php | 5 +++ 12 files changed, 84 insertions(+), 3 deletions(-) diff --git a/Dashboard/SearchTemplate.php b/Dashboard/SearchTemplate.php index 594c35f7b..0332089bd 100644 --- a/Dashboard/SearchTemplate.php +++ b/Dashboard/SearchTemplate.php @@ -5,25 +5,51 @@ use Twig\Environment as TwigEnvironment; use Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments\SearchItemInterface; use Webkul\UVDesk\CoreFrameworkBundle\Framework\ExtendableComponentInterface; +use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService; +use Symfony\Component\Translation\TranslatorInterface; + class SearchTemplate implements ExtendableComponentInterface { private $collection = []; - public function __construct(TwigEnvironment $twig) + public function __construct(TwigEnvironment $twig, TranslatorInterface $translator, UserService $userService) { $this->twig = $twig; + $this->translator = $translator; + $this->userService = $userService; } public function appendSearchItem(SearchItemInterface $segment, $tags = []) { - $this->collection[] = $segment; + $this->collection[] = $segment; } public function render() { + // Compile accessible segments by end-user + $searchCollection = []; + + foreach ($this->collection as $item) { + if (in_array('getRoles', get_class_methods($item))) { + if($item) { + if (null == $item::getRoles()) { + $searchCollection[] = $item; + } else { + foreach ($item::getRoles() as $requiredPermission) { + if ($this->userService->isAccessAuthorized($requiredPermission)) { + $searchCollection[] = $item; + + break; + } + } + } + } + } + } + return $this->twig->render('@UVDeskCoreFramework/Templates/search.html.twig', [ - 'collection' => $this->collection + 'collection' => $searchCollection ]); } } diff --git a/UIComponents/Dashboard/Search/Agents.php b/UIComponents/Dashboard/Search/Agents.php index 517a935d9..af5ed7caf 100644 --- a/UIComponents/Dashboard/Search/Agents.php +++ b/UIComponents/Dashboard/Search/Agents.php @@ -30,6 +30,11 @@ public static function getRouteName() : string return 'helpdesk_member_account_collection'; } + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_AGENT']; + } + public function getChildrenRoutes() : array { return []; diff --git a/UIComponents/Dashboard/Search/Branding.php b/UIComponents/Dashboard/Search/Branding.php index 0cf297f57..c9b313654 100644 --- a/UIComponents/Dashboard/Search/Branding.php +++ b/UIComponents/Dashboard/Search/Branding.php @@ -25,6 +25,11 @@ public static function getTitle() : string return "Branding"; } + public static function getRoles() : array + { + return ['ROLE_ADMIN']; + } + public static function getRouteName() : string { return 'helpdesk_member_helpdesk_theme'; diff --git a/UIComponents/Dashboard/Search/EmailSettings.php b/UIComponents/Dashboard/Search/EmailSettings.php index ae7520a03..94402cabd 100644 --- a/UIComponents/Dashboard/Search/EmailSettings.php +++ b/UIComponents/Dashboard/Search/EmailSettings.php @@ -30,6 +30,11 @@ public static function getRouteName() : string return 'helpdesk_member_emails_settings'; } + public static function getRoles() : array + { + return ['ROLE_ADMIN']; + } + public function getChildrenRoutes() : array { return []; diff --git a/UIComponents/Dashboard/Search/EmailTemplates.php b/UIComponents/Dashboard/Search/EmailTemplates.php index f6e13e46b..5615297e7 100644 --- a/UIComponents/Dashboard/Search/EmailTemplates.php +++ b/UIComponents/Dashboard/Search/EmailTemplates.php @@ -30,6 +30,11 @@ public static function getRouteName() : string return 'email_templates_action'; } + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_EMAIL_TEMPLATE']; + } + public function getChildrenRoutes() : array { return []; diff --git a/UIComponents/Dashboard/Search/Groups.php b/UIComponents/Dashboard/Search/Groups.php index 581ce97cc..abe216bd8 100644 --- a/UIComponents/Dashboard/Search/Groups.php +++ b/UIComponents/Dashboard/Search/Groups.php @@ -30,6 +30,11 @@ public static function getRouteName() : string return 'helpdesk_member_support_group_collection'; } + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_GROUP']; + } + public function getChildrenRoutes() : array { return []; diff --git a/UIComponents/Dashboard/Search/Privileges.php b/UIComponents/Dashboard/Search/Privileges.php index d8faf2073..ac2805a0d 100644 --- a/UIComponents/Dashboard/Search/Privileges.php +++ b/UIComponents/Dashboard/Search/Privileges.php @@ -30,6 +30,11 @@ public static function getRouteName() : string return 'helpdesk_member_privilege_collection'; } + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_AGENT_PRIVILEGE']; + } + public function getChildrenRoutes() : array { return []; diff --git a/UIComponents/Dashboard/Search/SavedReplies.php b/UIComponents/Dashboard/Search/SavedReplies.php index 46ea98904..8d091a2ed 100644 --- a/UIComponents/Dashboard/Search/SavedReplies.php +++ b/UIComponents/Dashboard/Search/SavedReplies.php @@ -30,6 +30,11 @@ public static function getRouteName() : string return 'helpdesk_member_saved_replies'; } + public static function getRoles() : array + { + return []; + } + public function getChildrenRoutes() : array { return []; diff --git a/UIComponents/Dashboard/Search/Tags.php b/UIComponents/Dashboard/Search/Tags.php index 18b87ce09..d0e4796db 100644 --- a/UIComponents/Dashboard/Search/Tags.php +++ b/UIComponents/Dashboard/Search/Tags.php @@ -30,6 +30,11 @@ public static function getRouteName() : string return 'helpdesk_member_ticket_tag_collection'; } + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_TAG']; + } + public function getChildrenRoutes() : array { return []; diff --git a/UIComponents/Dashboard/Search/Teams.php b/UIComponents/Dashboard/Search/Teams.php index cb50503d9..8514e1868 100644 --- a/UIComponents/Dashboard/Search/Teams.php +++ b/UIComponents/Dashboard/Search/Teams.php @@ -30,6 +30,11 @@ public static function getRouteName() : string return 'helpdesk_member_support_team_collection'; } + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_SUB_GROUP']; + } + public function getChildrenRoutes() : array { return []; diff --git a/UIComponents/Dashboard/Search/TicketTypes.php b/UIComponents/Dashboard/Search/TicketTypes.php index fef84eb4f..cdb4b338d 100644 --- a/UIComponents/Dashboard/Search/TicketTypes.php +++ b/UIComponents/Dashboard/Search/TicketTypes.php @@ -30,6 +30,11 @@ public static function getRouteName() : string return 'helpdesk_member_ticket_type_collection'; } + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_TICKET_TYPE']; + } + public function getChildrenRoutes() : array { return []; diff --git a/UIComponents/Dashboard/Search/Tickets.php b/UIComponents/Dashboard/Search/Tickets.php index 49d7b1b6a..f1c20e5b2 100644 --- a/UIComponents/Dashboard/Search/Tickets.php +++ b/UIComponents/Dashboard/Search/Tickets.php @@ -30,6 +30,11 @@ public static function getRouteName() : string return 'helpdesk_member_ticket_collection'; } + public static function getRoles() : array + { + return []; + } + public function getChildrenRoutes() : array { return []; From b7918eec89370f727aa2602d80041e8dd0196c59 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 29 Jan 2021 19:56:44 +0530 Subject: [PATCH 42/85] ticket delete action added from ticket view from trash --- Controller/Ticket.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Controller/Ticket.php b/Controller/Ticket.php index 7309e6144..26c725556 100755 --- a/Controller/Ticket.php +++ b/Controller/Ticket.php @@ -333,6 +333,25 @@ public function trashTicket(Request $request) return $this->redirectToRoute('helpdesk_member_ticket_collection'); } + // Delete a ticket ticket permanently + public function deleteTicket(Request $request) + { + $ticketId = $request->attributes->get('ticketId'); + $entityManager = $this->getDoctrine()->getManager(); + $ticket = $entityManager->getRepository('UVDeskCoreFrameworkBundle:Ticket')->find($ticketId); + + if (!$ticket) { + $this->noResultFound(); + } + + $entityManager->remove($ticket); + $entityManager->flush(); + + $this->addFlash('success', $this->get('translator')->trans('Success ! Success ! Ticket Id #'. $ticketId .' has been deleted successfully.')); + + return $this->redirectToRoute('helpdesk_member_ticket_collection'); + } + public function downloadZipAttachment(Request $request) { $threadId = $request->attributes->get('threadId'); From 0cded07fda1fb46fd520791bd685fdde490b38e4 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Mon, 15 Feb 2021 12:02:55 +0530 Subject: [PATCH 43/85] updated addPart for plain text in mail send function --- Services/EmailService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Services/EmailService.php b/Services/EmailService.php index a8b7cf0ed..b2e97b4f0 100644 --- a/Services/EmailService.php +++ b/Services/EmailService.php @@ -503,7 +503,8 @@ public function sendMail($subject, $content, $recipient, array $headers = [], $m ->setTo($recipient) ->setBcc($bcc) ->setCc($cc) - ->setBody($content, 'text/html'); + ->setBody($content, 'text/html') + ->addPart(strip_tags($content), 'text/plain'); foreach ($attachments as $attachment) { if (!empty($attachment['path']) && !empty($attachment['name'])) { From 1c8cc1f668d4ffae85f2308b05fd04ae42c6383f Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 18 Feb 2021 10:49:14 +0530 Subject: [PATCH 44/85] saved replies updating issue resolved --- Controller/SavedReplies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/SavedReplies.php b/Controller/SavedReplies.php index d5828146e..e9096c6d7 100755 --- a/Controller/SavedReplies.php +++ b/Controller/SavedReplies.php @@ -93,7 +93,7 @@ public function updateSavedReplies(Request $request) $previousTeamIds = []; $teams = explode(',', $request->request->get('tempTeams')); - if ($template->getSupportTeams()->toArray()) { + if ($template->getSupportTeams()) { foreach ($template->getSupportTeams()->toArray() as $key => $team) { $previousTeamIds[] = $team->getId(); From 94a0503d72e678d3a5691c6848a0e32b0a34253c Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 18 Feb 2021 13:40:07 +0530 Subject: [PATCH 45/85] resolved Myticket tab count and assigned ticket issue for agents --- Repository/TicketRepository.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Repository/TicketRepository.php b/Repository/TicketRepository.php index 8c9b5a86c..5ce18b5f0 100644 --- a/Repository/TicketRepository.php +++ b/Repository/TicketRepository.php @@ -44,7 +44,7 @@ public function getTicketLabelCollection(Ticket $ticket, User $user) public function getAllTickets(ParameterBag $obj = null, $container, $actAsUser = null) { $currentUser = $actAsUser ? : $container->get('user.service')->getCurrentUser(); - + $json = array(); $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select('DISTINCT t,gr,pr,tp,s,a.id as agentId,c.id as customerId')->from($this->getEntityName(), 't'); @@ -208,6 +208,7 @@ public function getAllCustomerTickets(ParameterBag $obj = null, $container, $act } $json['tickets'] = $data; + $json['pagination'] = $paginationData; return $json; @@ -291,7 +292,7 @@ public function prepareBaseTicketQuery(User $user, array $supportGroupIds = [], $this->addPermissionFilter($queryBuilder, $user, $supportGroupIds, $supportTeamIds); // applyFilter according to params - return $this->prepareTicketListQueryWithParams($queryBuilder, $params); + return $this->prepareTicketListQueryWithParams($queryBuilder, $params, $user); } public function prepareBasePaginationTicketTypesQuery(array $params) @@ -394,7 +395,7 @@ public function getTicketTabDetails(User $user, array $supportGroupIds = [], arr // applyFilter according to permission $this->addPermissionFilter($queryBuilder, $user, $supportGroupIds, $supportTeamIds); - $queryBuilder = $this->prepareTicketListQueryWithParams($queryBuilder, $params); + $queryBuilder = $this->prepareTicketListQueryWithParams($queryBuilder, $params, $user); $results = $queryBuilder->getQuery()->getResult(); foreach($results as $status) { @@ -564,13 +565,20 @@ public function getCustomerMoreTicketsSidebar($customerId, $container) { return $results; } - public function prepareTicketListQueryWithParams($queryBuilder, $params) + public function prepareTicketListQueryWithParams($queryBuilder, $params, $actAsUser = null) { foreach ($params as $field => $fieldValue) { if (in_array($field, $this->safeFields)) { continue; } + if($actAsUser != null ) { + $userInstance = $actAsUser->getAgentInstance(); + if (!empty($userInstance) && ('ROLE_AGENT' == $userInstance->getSupportRole()->getCode()) && $field == 'mine') { + $fieldValue = $actAsUser->getId(); + } + } + switch ($field) { case 'label': $queryBuilder->andwhere('supportLabel.id = :labelIds'); From 5e7226827c093e69d5942475f05b16c22b6830d9 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 19 Feb 2021 13:16:10 +0530 Subject: [PATCH 46/85] email receiving issue for agent when assigning a ticket --- Services/EmailService.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Services/EmailService.php b/Services/EmailService.php index b2e97b4f0..9c32430cf 100644 --- a/Services/EmailService.php +++ b/Services/EmailService.php @@ -518,6 +518,9 @@ public function sendMail($subject, $content, $recipient, array $headers = [], $m $messageHeaders = $message->getHeaders(); foreach ($headers as $headerName => $headerValue) { + if(is_array($headerValue)) { + $headerValue = $headerValue['messageId']; + } $messageHeaders->addTextHeader($headerName, $headerValue); } From 40156c6826bce98475e19ac44d96f3fb52da6136 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Tue, 23 Feb 2021 15:58:32 +0530 Subject: [PATCH 47/85] date format for customer previous ticket issue resolved --- Repository/TicketRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Repository/TicketRepository.php b/Repository/TicketRepository.php index 5ce18b5f0..c6bb9f05e 100644 --- a/Repository/TicketRepository.php +++ b/Repository/TicketRepository.php @@ -557,7 +557,7 @@ public function getCustomerMoreTicketsSidebar($customerId, $container) { unset($ticket['ticket']); $results[$key] = array_merge($results[$key], $ticket); $results[$key]['timestamp']= $userService->convertToTimezone($results[$key]['createdAt']); - $results[$key]['formatedCreatedAt'] = $userService->convertToTimezone($results[$key]['createdAt']); + $results[$key]['formatedCreatedAt'] = $results[$key]['createdAt']->format('d-m-Y H:i A'); $results[$key]['totalThreads']= $ticketService->getTicketTotalThreads($results[$key]['id']); } From 27e2816661e4479720436e9a6cd1bfb177d92ce1 Mon Sep 17 00:00:00 2001 From: Vipin Shrivastava Date: Wed, 24 Feb 2021 11:38:20 +0530 Subject: [PATCH 48/85] git add missing files Apps,Articles,categories,Customer,folders --- UIComponents/Dashboard/Search/Apps.php | 40 +++++++++++++++++++ UIComponents/Dashboard/Search/Articles.php | 42 ++++++++++++++++++++ UIComponents/Dashboard/Search/Categories.php | 42 ++++++++++++++++++++ UIComponents/Dashboard/Search/Customers.php | 42 ++++++++++++++++++++ UIComponents/Dashboard/Search/Folders.php | 42 ++++++++++++++++++++ 5 files changed, 208 insertions(+) create mode 100644 UIComponents/Dashboard/Search/Apps.php create mode 100644 UIComponents/Dashboard/Search/Articles.php create mode 100644 UIComponents/Dashboard/Search/Categories.php create mode 100644 UIComponents/Dashboard/Search/Customers.php create mode 100644 UIComponents/Dashboard/Search/Folders.php diff --git a/UIComponents/Dashboard/Search/Apps.php b/UIComponents/Dashboard/Search/Apps.php new file mode 100644 index 000000000..c50e29675 --- /dev/null +++ b/UIComponents/Dashboard/Search/Apps.php @@ -0,0 +1,40 @@ + + + +SVG; + + public static function getIcon() : string + { + return self::SVG; + } + + public static function getTitle() : string + { + return "Apps"; + } + + public static function getRouteName() : string + { + return 'uvdesk_extensions_applications_dashboard'; + } + + public function getChildrenRoutes() : array + { + return []; + } + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_APPS']; + } +} \ No newline at end of file diff --git a/UIComponents/Dashboard/Search/Articles.php b/UIComponents/Dashboard/Search/Articles.php new file mode 100644 index 000000000..2107805d4 --- /dev/null +++ b/UIComponents/Dashboard/Search/Articles.php @@ -0,0 +1,42 @@ + + + +SVG; + + public static function getIcon() : string + { + return self::SVG; + } + + public static function getTitle() : string + { + return "Articles"; + } + + public static function getRouteName() : string + { + return 'access_token_xhr'; + } + + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_KNOWLEDGEBASE']; + } + + public function getChildrenRoutes() : array + { + return []; + } +} diff --git a/UIComponents/Dashboard/Search/Categories.php b/UIComponents/Dashboard/Search/Categories.php new file mode 100644 index 000000000..3b8d404b1 --- /dev/null +++ b/UIComponents/Dashboard/Search/Categories.php @@ -0,0 +1,42 @@ + + + +SVG; + + public static function getIcon() : string + { + return self::SVG; + } + + public static function getTitle() : string + { + return "Categories"; + } + + public static function getRouteName() : string + { + return 'access_token_xhr'; + } + + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_KNOWLEDGEBASE']; + } + + public function getChildrenRoutes() : array + { + return []; + } +} diff --git a/UIComponents/Dashboard/Search/Customers.php b/UIComponents/Dashboard/Search/Customers.php new file mode 100644 index 000000000..d4e54b255 --- /dev/null +++ b/UIComponents/Dashboard/Search/Customers.php @@ -0,0 +1,42 @@ + + + +SVG; + + public static function getIcon() : string + { + return self::SVG; + } + + public static function getTitle() : string + { + return "Customers"; + } + + public static function getRouteName() : string + { + return 'helpdesk_member_manage_customer_account_collection'; + } + + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_CUSTOMER']; + } + + public function getChildrenRoutes() : array + { + return []; + } +} diff --git a/UIComponents/Dashboard/Search/Folders.php b/UIComponents/Dashboard/Search/Folders.php new file mode 100644 index 000000000..dec27d94e --- /dev/null +++ b/UIComponents/Dashboard/Search/Folders.php @@ -0,0 +1,42 @@ + + + +SVG; + + public static function getIcon() : string + { + return self::SVG; + } + + public static function getTitle() : string + { + return "Folders"; + } + + public static function getRouteName() : string + { + return 'access_token_xhr'; + } + + public static function getRoles() : array + { + return ['ROLE_AGENT_MANAGE_KNOWLEDGEBASE']; + } + + public function getChildrenRoutes() : array + { + return []; + } +} From e3779dcfe8a246f09e1f7d98d438404e8d039108 Mon Sep 17 00:00:00 2001 From: Vipin Shrivastava Date: Wed, 24 Feb 2021 11:46:19 +0530 Subject: [PATCH 49/85] apps file change to ROLE_ADMIN --- UIComponents/Dashboard/Search/Apps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UIComponents/Dashboard/Search/Apps.php b/UIComponents/Dashboard/Search/Apps.php index c50e29675..71b75d263 100644 --- a/UIComponents/Dashboard/Search/Apps.php +++ b/UIComponents/Dashboard/Search/Apps.php @@ -35,6 +35,6 @@ public function getChildrenRoutes() : array } public static function getRoles() : array { - return ['ROLE_AGENT_MANAGE_APPS']; + return ['ROLE_ADMIN']; } } \ No newline at end of file From ca525c665567bfb4129d1c3160ce180d0b0ee706 Mon Sep 17 00:00:00 2001 From: Vipin Shrivastava Date: Wed, 24 Feb 2021 12:25:44 +0530 Subject: [PATCH 50/85] adding route in articles,categories,folders --- UIComponents/Dashboard/Search/Articles.php | 2 +- UIComponents/Dashboard/Search/Categories.php | 2 +- UIComponents/Dashboard/Search/Folders.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/UIComponents/Dashboard/Search/Articles.php b/UIComponents/Dashboard/Search/Articles.php index 2107805d4..cbd74fa81 100644 --- a/UIComponents/Dashboard/Search/Articles.php +++ b/UIComponents/Dashboard/Search/Articles.php @@ -27,7 +27,7 @@ public static function getTitle() : string public static function getRouteName() : string { - return 'access_token_xhr'; + return 'helpdesk_member_knowledgebase_article_collection'; } public static function getRoles() : array diff --git a/UIComponents/Dashboard/Search/Categories.php b/UIComponents/Dashboard/Search/Categories.php index 3b8d404b1..e1a0bd555 100644 --- a/UIComponents/Dashboard/Search/Categories.php +++ b/UIComponents/Dashboard/Search/Categories.php @@ -27,7 +27,7 @@ public static function getTitle() : string public static function getRouteName() : string { - return 'access_token_xhr'; + return 'helpdesk_member_knowledgebase_category_collection'; } public static function getRoles() : array diff --git a/UIComponents/Dashboard/Search/Folders.php b/UIComponents/Dashboard/Search/Folders.php index dec27d94e..304533e3e 100644 --- a/UIComponents/Dashboard/Search/Folders.php +++ b/UIComponents/Dashboard/Search/Folders.php @@ -27,7 +27,7 @@ public static function getTitle() : string public static function getRouteName() : string { - return 'access_token_xhr'; + return 'helpdesk_member_knowledgebase_folders_collection'; } public static function getRoles() : array From d8515a3af60df4b9718e3ac4a00bb13313b64943 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 24 Feb 2021 20:49:34 +0530 Subject: [PATCH 51/85] saved reply disapper issue for agent fixed --- Controller/SavedReplies.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/SavedReplies.php b/Controller/SavedReplies.php index e9096c6d7..ed61bda10 100755 --- a/Controller/SavedReplies.php +++ b/Controller/SavedReplies.php @@ -71,7 +71,7 @@ public function updateSavedReplies(Request $request) if ($template->getSupportGroups()) { foreach ($template->getSupportGroups()->toArray() as $key => $group) { $previousGroupIds[] = $group->getId(); - if (!in_array($group->getId(), $groups)) { + if (!in_array($group->getId(), $groups) && $this->getUser()->getAgentInstance()->getSupportRole()->getCode() != "ROLE_AGENT") { $template->removeSupportGroups($group); $em->persist($template); } @@ -97,7 +97,7 @@ public function updateSavedReplies(Request $request) foreach ($template->getSupportTeams()->toArray() as $key => $team) { $previousTeamIds[] = $team->getId(); - if (!in_array($team->getId(), $teams)) { + if (!in_array($team->getId(), $teams) && $this->getUser()->getAgentInstance()->getSupportRole()->getCode() != "ROLE_AGENT") { $template->removeSupportTeam($team); $em->persist($template); } From 1c2de222cdb8b285b6f9810b89d6960eddee7eaf Mon Sep 17 00:00:00 2001 From: Vipin Shrivastava Date: Thu, 25 Feb 2021 12:34:45 +0530 Subject: [PATCH 52/85] broken image code fix --- Resources/views/ticketList.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/ticketList.html.twig b/Resources/views/ticketList.html.twig index 1232d8af1..d6995a81d 100755 --- a/Resources/views/ticketList.html.twig +++ b/Resources/views/ticketList.html.twig @@ -2013,7 +2013,7 @@ parent.find('.uv-no-results').hide(); _.each(response, function(item) { if(currentElement.attr('data-filter-type') == 'customer') { - var img = item.smallThumbnail ? item.smallThumbnail : "{{ asset(default_customer_image_path) }}"; + var img = item.smallThumbnail ? "{{ app.request.scheme ~'://' ~ app.request.httpHost ~ asset('') }}"+item.smallThumbnail : "{{ asset(default_customer_image_path)}}"; parent.find('.uv-dropdown-list ul').append("
  • " + item.name + "
  • ") } else parent.find('.uv-dropdown-list ul').append("
  • " + item.name + "
  • ") From a114648913d288230795f6ef3bc4ac6c2d1278f9 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 25 Feb 2021 19:56:43 +0530 Subject: [PATCH 53/85] duplicate element removed from searching --- UIComponents/Dashboard/Search/Articles.php | 42 -------------------- UIComponents/Dashboard/Search/Categories.php | 42 -------------------- UIComponents/Dashboard/Search/Customers.php | 42 -------------------- UIComponents/Dashboard/Search/Folders.php | 42 -------------------- 4 files changed, 168 deletions(-) delete mode 100644 UIComponents/Dashboard/Search/Articles.php delete mode 100644 UIComponents/Dashboard/Search/Categories.php delete mode 100644 UIComponents/Dashboard/Search/Customers.php delete mode 100644 UIComponents/Dashboard/Search/Folders.php diff --git a/UIComponents/Dashboard/Search/Articles.php b/UIComponents/Dashboard/Search/Articles.php deleted file mode 100644 index cbd74fa81..000000000 --- a/UIComponents/Dashboard/Search/Articles.php +++ /dev/null @@ -1,42 +0,0 @@ - - - -SVG; - - public static function getIcon() : string - { - return self::SVG; - } - - public static function getTitle() : string - { - return "Articles"; - } - - public static function getRouteName() : string - { - return 'helpdesk_member_knowledgebase_article_collection'; - } - - public static function getRoles() : array - { - return ['ROLE_AGENT_MANAGE_KNOWLEDGEBASE']; - } - - public function getChildrenRoutes() : array - { - return []; - } -} diff --git a/UIComponents/Dashboard/Search/Categories.php b/UIComponents/Dashboard/Search/Categories.php deleted file mode 100644 index e1a0bd555..000000000 --- a/UIComponents/Dashboard/Search/Categories.php +++ /dev/null @@ -1,42 +0,0 @@ - - - -SVG; - - public static function getIcon() : string - { - return self::SVG; - } - - public static function getTitle() : string - { - return "Categories"; - } - - public static function getRouteName() : string - { - return 'helpdesk_member_knowledgebase_category_collection'; - } - - public static function getRoles() : array - { - return ['ROLE_AGENT_MANAGE_KNOWLEDGEBASE']; - } - - public function getChildrenRoutes() : array - { - return []; - } -} diff --git a/UIComponents/Dashboard/Search/Customers.php b/UIComponents/Dashboard/Search/Customers.php deleted file mode 100644 index d4e54b255..000000000 --- a/UIComponents/Dashboard/Search/Customers.php +++ /dev/null @@ -1,42 +0,0 @@ - - - -SVG; - - public static function getIcon() : string - { - return self::SVG; - } - - public static function getTitle() : string - { - return "Customers"; - } - - public static function getRouteName() : string - { - return 'helpdesk_member_manage_customer_account_collection'; - } - - public static function getRoles() : array - { - return ['ROLE_AGENT_MANAGE_CUSTOMER']; - } - - public function getChildrenRoutes() : array - { - return []; - } -} diff --git a/UIComponents/Dashboard/Search/Folders.php b/UIComponents/Dashboard/Search/Folders.php deleted file mode 100644 index 304533e3e..000000000 --- a/UIComponents/Dashboard/Search/Folders.php +++ /dev/null @@ -1,42 +0,0 @@ - - - -SVG; - - public static function getIcon() : string - { - return self::SVG; - } - - public static function getTitle() : string - { - return "Folders"; - } - - public static function getRouteName() : string - { - return 'helpdesk_member_knowledgebase_folders_collection'; - } - - public static function getRoles() : array - { - return ['ROLE_AGENT_MANAGE_KNOWLEDGEBASE']; - } - - public function getChildrenRoutes() : array - { - return []; - } -} From 5ea02f8e1eda2b21a5f98dc40f7060559f9ae690 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Wed, 3 Mar 2021 18:17:54 +0530 Subject: [PATCH 54/85] adding project version for next release --- Resources/views/dashboard.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/dashboard.html.twig b/Resources/views/dashboard.html.twig index ea372c572..289957f4c 100644 --- a/Resources/views/dashboard.html.twig +++ b/Resources/views/dashboard.html.twig @@ -214,7 +214,7 @@ {{ uvdesk_extensibles.getRegisteredComponent('Webkul\\UVDesk\\CoreFrameworkBundle\\Dashboard\\Dashboard').getHomepageTemplate().render()|raw }}
    {% endblock %} From 27f7b1736641411686958b4603a121107c91710f Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 4 Mar 2021 19:15:36 +0530 Subject: [PATCH 55/85] strong password restriction added for user --- Resources/views/Agents/createSupportAgent.html.twig | 13 +++++++------ Resources/views/Agents/updateSupportAgent.html.twig | 13 +++++++------ .../views/Customers/createSupportCustomer.html.twig | 13 +++++++------ .../views/Customers/updateSupportCustomer.html.twig | 13 +++++++------ Resources/views/resetPassword.html.twig | 6 +++--- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/Resources/views/Agents/createSupportAgent.html.twig b/Resources/views/Agents/createSupportAgent.html.twig index 4c463eaf1..0c996ad11 100644 --- a/Resources/views/Agents/createSupportAgent.html.twig +++ b/Resources/views/Agents/createSupportAgent.html.twig @@ -377,12 +377,13 @@ 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" | trans}}'; - } - }, + 'user_form[password][first]': [{ + required: true, + msg: '{{ "This field is mandatory"|trans }}' + },{ + pattern: /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/, + msg: '{{ "Password must contain at least eight characters which contain one letter, one number and one special character"|trans }}' + }], 'user_form[password][second]': { equalTo: 'user_form[password][first]', msg: 'The passwords does not match' diff --git a/Resources/views/Agents/updateSupportAgent.html.twig b/Resources/views/Agents/updateSupportAgent.html.twig index a7389962e..ac13c1714 100644 --- a/Resources/views/Agents/updateSupportAgent.html.twig +++ b/Resources/views/Agents/updateSupportAgent.html.twig @@ -429,12 +429,13 @@ 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"|trans }}'; - } - }, + 'user_form[password][first]': [{ + required: true, + msg: '{{ "This field is mandatory"|trans }}' + },{ + pattern: /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/, + msg: '{{ "Password must contain at least eight characters contains minimum one letter, one number and one special character"|trans }}' + }], 'user_form[password][second]': { equalTo: 'user_form[password][first]', msg: '{{ "The passwords does not match"|trans }}' diff --git a/Resources/views/Customers/createSupportCustomer.html.twig b/Resources/views/Customers/createSupportCustomer.html.twig index 07eafaf63..db2685366 100644 --- a/Resources/views/Customers/createSupportCustomer.html.twig +++ b/Resources/views/Customers/createSupportCustomer.html.twig @@ -163,12 +163,13 @@ return '{{ "Contact number is invalid"|trans }}'; } }, - 'customer_form[password][first]' : function(value) { - if(value != undefined && value !== '') { - if(value.length < 8) - return '{{ "Password must contains 8 Characters"|trans }}'; - } - }, + 'customer_form[password][first]': [{ + required: true, + msg: '{{ "This field is mandatory"|trans }}' + },{ + pattern: /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/, + msg: '{{ "Password must contain at least eight characters contains minimum one letter, one number and one special character"|trans }}' + }], 'customer_form[password][second]': { equalTo: 'customer_form[password][first]', msg: '{{ "The passwords does not match"|trans }}' diff --git a/Resources/views/Customers/updateSupportCustomer.html.twig b/Resources/views/Customers/updateSupportCustomer.html.twig index 9a2341121..de85d58c1 100644 --- a/Resources/views/Customers/updateSupportCustomer.html.twig +++ b/Resources/views/Customers/updateSupportCustomer.html.twig @@ -166,12 +166,13 @@ return '{{ "Contact number is invalid"|trans }}'; } }, - 'customer_form[password][first]' : function(value) { - if(value != undefined && value !== '') { - if(value.length < 8) - return '{{ "Password must contains 8 Characters"|trans }}'; - } - }, + 'customer_form[password][first]': [{ + required: true, + msg: '{{ "This field is mandatory"|trans }}' + },{ + pattern: /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/, + msg: '{{ "Password must contain at least eight characters contains minimum one letter, one number and one special character"|trans }}' + }], 'customer_form[password][second]': { equalTo: 'customer_form[password][first]', msg: '{{ "The passwords does not match"|trans }}' diff --git a/Resources/views/resetPassword.html.twig b/Resources/views/resetPassword.html.twig index 4154861d4..b480fa6e4 100644 --- a/Resources/views/resetPassword.html.twig +++ b/Resources/views/resetPassword.html.twig @@ -83,9 +83,9 @@ 'password': [{ required: true, msg: '{{ "This field is mandatory"|trans }}' - },{ - minLength: 8, - msg: '{{ "Password must contains 8 Characters"|trans }}' + },{ + pattern: /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/, + msg: '{{ "Password must contain at least eight characters contains minimum one letter, one number and one special character"|trans }}' }], 'confirmPassword': [{ required: true, From 1257319c0188b838a062b91bbbba4f92977aa2e5 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 5 Mar 2021 13:28:29 +0530 Subject: [PATCH 56/85] stong password with more strict pattern added --- .../views/Agents/createSupportAgent.html.twig | 4 ++-- .../views/Agents/updateSupportAgent.html.twig | 4 ++-- .../Customers/createSupportCustomer.html.twig | 14 +++++++------- .../Customers/updateSupportCustomer.html.twig | 12 ++++++------ Resources/views/profile.html.twig | 13 +++++++------ Resources/views/resetPassword.html.twig | 4 ++-- 6 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Resources/views/Agents/createSupportAgent.html.twig b/Resources/views/Agents/createSupportAgent.html.twig index 0c996ad11..5271a42c0 100644 --- a/Resources/views/Agents/createSupportAgent.html.twig +++ b/Resources/views/Agents/createSupportAgent.html.twig @@ -381,8 +381,8 @@ required: true, msg: '{{ "This field is mandatory"|trans }}' },{ - pattern: /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/, - msg: '{{ "Password must contain at least eight characters which contain one letter, one number and one special character"|trans }}' + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' }], 'user_form[password][second]': { equalTo: 'user_form[password][first]', diff --git a/Resources/views/Agents/updateSupportAgent.html.twig b/Resources/views/Agents/updateSupportAgent.html.twig index ac13c1714..c120dc76d 100644 --- a/Resources/views/Agents/updateSupportAgent.html.twig +++ b/Resources/views/Agents/updateSupportAgent.html.twig @@ -433,8 +433,8 @@ required: true, msg: '{{ "This field is mandatory"|trans }}' },{ - pattern: /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/, - msg: '{{ "Password must contain at least eight characters contains minimum one letter, one number and one special character"|trans }}' + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' }], 'user_form[password][second]': { equalTo: 'user_form[password][first]', diff --git a/Resources/views/Customers/createSupportCustomer.html.twig b/Resources/views/Customers/createSupportCustomer.html.twig index db2685366..5f1b93cdb 100644 --- a/Resources/views/Customers/createSupportCustomer.html.twig +++ b/Resources/views/Customers/createSupportCustomer.html.twig @@ -163,13 +163,13 @@ return '{{ "Contact number is invalid"|trans }}'; } }, - 'customer_form[password][first]': [{ - required: true, - msg: '{{ "This field is mandatory"|trans }}' - },{ - pattern: /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/, - msg: '{{ "Password must contain at least eight characters contains minimum one letter, one number and one special character"|trans }}' - }], + 'customer_form[password][first]': [{ + required: true, + msg: '{{ "This field is mandatory"|trans }}' + },{ + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' + }], 'customer_form[password][second]': { equalTo: 'customer_form[password][first]', msg: '{{ "The passwords does not match"|trans }}' diff --git a/Resources/views/Customers/updateSupportCustomer.html.twig b/Resources/views/Customers/updateSupportCustomer.html.twig index de85d58c1..c09f8af08 100644 --- a/Resources/views/Customers/updateSupportCustomer.html.twig +++ b/Resources/views/Customers/updateSupportCustomer.html.twig @@ -167,12 +167,12 @@ } }, 'customer_form[password][first]': [{ - required: true, - msg: '{{ "This field is mandatory"|trans }}' - },{ - pattern: /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/, - msg: '{{ "Password must contain at least eight characters contains minimum one letter, one number and one special character"|trans }}' - }], + required: true, + msg: '{{ "This field is mandatory"|trans }}' + },{ + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' + }], 'customer_form[password][second]': { equalTo: 'customer_form[password][first]', msg: '{{ "The passwords does not match"|trans }}' diff --git a/Resources/views/profile.html.twig b/Resources/views/profile.html.twig index 94a572b00..bc4f71520 100644 --- a/Resources/views/profile.html.twig +++ b/Resources/views/profile.html.twig @@ -235,12 +235,13 @@ return '{{ "Contact number is invalid"|trans }}'; } }, - 'user_form[password][first]' : function(value) { - if(value != undefined && value !== '') { - if(value.length < 8) - return '{{ "Password must contains 8 Characters"|trans }}'; - } - }, + 'customer_form[password][first]': [{ + required: true, + msg: '{{ "This field is mandatory"|trans }}' + },{ + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' + }], 'user_form[password][second]': { equalTo: 'user_form[password][first]', msg: '{{ "The passwords does not match"|trans }}' diff --git a/Resources/views/resetPassword.html.twig b/Resources/views/resetPassword.html.twig index b480fa6e4..c57989f4d 100644 --- a/Resources/views/resetPassword.html.twig +++ b/Resources/views/resetPassword.html.twig @@ -84,8 +84,8 @@ required: true, msg: '{{ "This field is mandatory"|trans }}' },{ - pattern: /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/, - msg: '{{ "Password must contain at least eight characters contains minimum one letter, one number and one special character"|trans }}' + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' }], 'confirmPassword': [{ required: true, From 820710c90472b339f31fb4b2aa4b95a8764ac950 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 5 Mar 2021 14:12:24 +0530 Subject: [PATCH 57/85] password regix update for strong password --- Resources/views/Agents/createSupportAgent.html.twig | 2 +- Resources/views/Agents/updateSupportAgent.html.twig | 2 +- .../views/Customers/createSupportCustomer.html.twig | 2 +- .../views/Customers/updateSupportCustomer.html.twig | 2 +- Resources/views/account.html.twig | 13 +++++++------ Resources/views/profile.html.twig | 4 ++-- Resources/views/resetPassword.html.twig | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Resources/views/Agents/createSupportAgent.html.twig b/Resources/views/Agents/createSupportAgent.html.twig index 5271a42c0..e4b9c82ed 100644 --- a/Resources/views/Agents/createSupportAgent.html.twig +++ b/Resources/views/Agents/createSupportAgent.html.twig @@ -381,7 +381,7 @@ required: true, msg: '{{ "This field is mandatory"|trans }}' },{ - pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' }], 'user_form[password][second]': { diff --git a/Resources/views/Agents/updateSupportAgent.html.twig b/Resources/views/Agents/updateSupportAgent.html.twig index c120dc76d..926124680 100644 --- a/Resources/views/Agents/updateSupportAgent.html.twig +++ b/Resources/views/Agents/updateSupportAgent.html.twig @@ -433,7 +433,7 @@ required: true, msg: '{{ "This field is mandatory"|trans }}' },{ - pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' }], 'user_form[password][second]': { diff --git a/Resources/views/Customers/createSupportCustomer.html.twig b/Resources/views/Customers/createSupportCustomer.html.twig index 5f1b93cdb..787040c7b 100644 --- a/Resources/views/Customers/createSupportCustomer.html.twig +++ b/Resources/views/Customers/createSupportCustomer.html.twig @@ -167,7 +167,7 @@ required: true, msg: '{{ "This field is mandatory"|trans }}' },{ - pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' }], 'customer_form[password][second]': { diff --git a/Resources/views/Customers/updateSupportCustomer.html.twig b/Resources/views/Customers/updateSupportCustomer.html.twig index c09f8af08..91068d4f2 100644 --- a/Resources/views/Customers/updateSupportCustomer.html.twig +++ b/Resources/views/Customers/updateSupportCustomer.html.twig @@ -170,7 +170,7 @@ required: true, msg: '{{ "This field is mandatory"|trans }}' },{ - pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' }], 'customer_form[password][second]': { diff --git a/Resources/views/account.html.twig b/Resources/views/account.html.twig index b079566fb..cc69c0f1e 100644 --- a/Resources/views/account.html.twig +++ b/Resources/views/account.html.twig @@ -443,12 +443,13 @@ 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"|trans }}'; - } - }, + 'user_form[password][first]': [{ + required: true, + msg: '{{ "This field is mandatory"|trans }}' + },{ + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, + msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' + }], 'user_form[password][second]': { equalTo: 'user_form[password][first]', msg: '{{ "The passwords does not match"|trans }}' diff --git a/Resources/views/profile.html.twig b/Resources/views/profile.html.twig index bc4f71520..92d6b0ed5 100644 --- a/Resources/views/profile.html.twig +++ b/Resources/views/profile.html.twig @@ -235,11 +235,11 @@ return '{{ "Contact number is invalid"|trans }}'; } }, - 'customer_form[password][first]': [{ + 'user_form[password][first]': [{ required: true, msg: '{{ "This field is mandatory"|trans }}' },{ - pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' }], 'user_form[password][second]': { diff --git a/Resources/views/resetPassword.html.twig b/Resources/views/resetPassword.html.twig index c57989f4d..626ca90c3 100644 --- a/Resources/views/resetPassword.html.twig +++ b/Resources/views/resetPassword.html.twig @@ -84,7 +84,7 @@ required: true, msg: '{{ "This field is mandatory"|trans }}' },{ - pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/, + pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' }], 'confirmPassword': [{ From fbcb8969a9a56bb4ea931e48eefd8e6edc3cc5fe Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 5 Mar 2021 18:32:48 +0530 Subject: [PATCH 58/85] updates --- Resources/views/Agents/createSupportAgent.html.twig | 13 ++++++------- Resources/views/Agents/updateSupportAgent.html.twig | 13 ++++++------- .../views/Customers/createSupportCustomer.html.twig | 13 ++++++------- .../views/Customers/updateSupportCustomer.html.twig | 13 ++++++------- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/Resources/views/Agents/createSupportAgent.html.twig b/Resources/views/Agents/createSupportAgent.html.twig index e4b9c82ed..4c463eaf1 100644 --- a/Resources/views/Agents/createSupportAgent.html.twig +++ b/Resources/views/Agents/createSupportAgent.html.twig @@ -377,13 +377,12 @@ return '{{ "This field must be a number" | trans}}'; } }, - 'user_form[password][first]': [{ - required: true, - msg: '{{ "This field is mandatory"|trans }}' - },{ - pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, - msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' - }], + 'user_form[password][first]' : function(value) { + if(value != undefined && value !== '') { + if(value.length < 8) + return '{{ "Password must contains 8 Characters" | trans}}'; + } + }, 'user_form[password][second]': { equalTo: 'user_form[password][first]', msg: 'The passwords does not match' diff --git a/Resources/views/Agents/updateSupportAgent.html.twig b/Resources/views/Agents/updateSupportAgent.html.twig index 926124680..8fee1bdf3 100644 --- a/Resources/views/Agents/updateSupportAgent.html.twig +++ b/Resources/views/Agents/updateSupportAgent.html.twig @@ -429,13 +429,12 @@ return '{{ "This field must be a number"|trans }}'; } }, - 'user_form[password][first]': [{ - required: true, - msg: '{{ "This field is mandatory"|trans }}' - },{ - pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, - msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' - }], + 'user_form[password][first]' : function(value) { + if(value != undefined && value !== '') { + if(value.length < 8) + return '{{ "Password must contains 8 Characters" | trans}}'; + } + }, 'user_form[password][second]': { equalTo: 'user_form[password][first]', msg: '{{ "The passwords does not match"|trans }}' diff --git a/Resources/views/Customers/createSupportCustomer.html.twig b/Resources/views/Customers/createSupportCustomer.html.twig index 787040c7b..e20e2deff 100644 --- a/Resources/views/Customers/createSupportCustomer.html.twig +++ b/Resources/views/Customers/createSupportCustomer.html.twig @@ -163,13 +163,12 @@ return '{{ "Contact number is invalid"|trans }}'; } }, - 'customer_form[password][first]': [{ - required: true, - msg: '{{ "This field is mandatory"|trans }}' - },{ - pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, - msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' - }], + 'customer_form[password][first]' : function(value) { + if(value != undefined && value !== '') { + if(value.length < 8) + return '{{ "Password must contains 8 Characters" | trans}}'; + } + }, 'customer_form[password][second]': { equalTo: 'customer_form[password][first]', msg: '{{ "The passwords does not match"|trans }}' diff --git a/Resources/views/Customers/updateSupportCustomer.html.twig b/Resources/views/Customers/updateSupportCustomer.html.twig index 91068d4f2..87987f3e5 100644 --- a/Resources/views/Customers/updateSupportCustomer.html.twig +++ b/Resources/views/Customers/updateSupportCustomer.html.twig @@ -166,13 +166,12 @@ return '{{ "Contact number is invalid"|trans }}'; } }, - 'customer_form[password][first]': [{ - required: true, - msg: '{{ "This field is mandatory"|trans }}' - },{ - pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8}$/, - msg: '{{ "passwords must contain maximum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed.)"|trans }}' - }], + 'customer_form[password][first]' : function(value) { + if(value != undefined && value !== '') { + if(value.length < 8) + return '{{ "Password must contains 8 Characters" | trans}}'; + } + }, 'customer_form[password][second]': { equalTo: 'customer_form[password][first]', msg: '{{ "The passwords does not match"|trans }}' From feffd96a722135f89c247e62be0c9913114ff3ee Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Tue, 9 Mar 2021 20:13:18 +0530 Subject: [PATCH 59/85] cc and bcc user with ticket link issue reolved --- Workflow/Actions/Ticket/MailCustomer.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Workflow/Actions/Ticket/MailCustomer.php b/Workflow/Actions/Ticket/MailCustomer.php index 72a7da9aa..c9f059975 100644 --- a/Workflow/Actions/Ticket/MailCustomer.php +++ b/Workflow/Actions/Ticket/MailCustomer.php @@ -75,13 +75,18 @@ public static function applyAction(ContainerInterface $container, $entity, $valu $headers['In-Reply-To'] = $currentThread->getMessageId(); } - $messageId = $container->get('email.service')->sendMail($subject, $message, $entity->getCustomer()->getEmail(), $headers, $entity->getMailboxEmail(), $attachments ?? [], $thread->getCc() ?: [], $thread->getBcc() ?: []); + $messageId = $container->get('email.service')->sendMail($subject, $message, $entity->getCustomer()->getEmail(), $headers, $entity->getMailboxEmail(), $attachments ?? []); if (!empty($messageId)) { $createdThread->setMessageId($messageId); $entityManager->persist($createdThread); $entityManager->flush(); } + + if($thread->getCc() || $thread->getBcc()) { + self::sendCcBccMail($container, $entity, $thread, $subject, $attachments); + } + } else { $message = $container->get('email.service')->sendMail($subject, $message, $entity->getCustomer()->getEmail()); } @@ -90,4 +95,11 @@ public static function applyAction(ContainerInterface $container, $entity, $valu break; } } + + public static function sendCcBccMail($container, $entity, $thread, $subject, $attachments) + { + $message = '

    Hello


    '.$thread->getMessage().'

    '; + + $messageId = $container->get('email.service')->sendMail($subject, $message, null, [], $entity->getMailboxEmail(), $attachments ?? [], $thread->getCc() ?: [], $thread->getBcc() ?: []); + } } From dec9b4dc895dabc28ecca4e1d55f107d46b30eac Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Thu, 11 Mar 2021 12:49:01 +0530 Subject: [PATCH 60/85] panel sitebar active status issue resolved --- Dashboard/NavigationTemplate.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Dashboard/NavigationTemplate.php b/Dashboard/NavigationTemplate.php index 32635b6b3..093307464 100644 --- a/Dashboard/NavigationTemplate.php +++ b/Dashboard/NavigationTemplate.php @@ -13,7 +13,7 @@ class NavigationTemplate implements ExtendableComponentInterface { CONST TEMPLATE = '
      [[ COLLECTION ]]
    '; - CONST TEMPLATE_ITEM = '
  • [[ SVG ]][[ NAME ]]
  • '; + CONST TEMPLATE_ITEM = '
  • [[ SVG ]][[ NAME ]]
  • '; private $segments = []; @@ -36,9 +36,10 @@ public function render() $router = $this->router; $request = $this->requestStack->getCurrentRequest(); + + $route = $this->requestStack->getCurrentRequest()->get('_route'); // Compile accessible segments by end-user $accessibleSegments = []; - foreach ($this->segments as $item) { if (null == $item::getRoles()) { $accessibleSegments[] = $item; @@ -54,11 +55,17 @@ public function render() } // Reduce the accessible segments into injectible html snippet - $html = array_reduce($accessibleSegments, function($html, $segment) use ($router, $request) { + $html = array_reduce($accessibleSegments, function($html, $segment) use ($router, $request, $route) { + $isActive = ''; + if($segment::getRouteName() == $route) { + $isActive = "uv-item-active"; + } + $html .= strtr(self::TEMPLATE_ITEM, [ '[[ SVG ]]' => $segment::getIcon(), '[[ NAME ]]' => $this->translator->trans($segment::getTitle()), '[[ URL ]]' => $router->generate($segment::getRouteName()), + '[[ isActive ]]' => $isActive, ]); return $html; From 6ce1f08abe08a500ceb3c0356f7ddd38144b6e19 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Fri, 12 Mar 2021 19:45:58 +0530 Subject: [PATCH 61/85] Code updates for isactive and isEnabled updates --- Controller/Account.php | 2 +- Controller/Customer.php | 2 +- Repository/UserRepository.php | 16 +++++++++------- Resources/public/js/_common.js | 2 +- .../views/Agents/listSupportAgents.html.twig | 8 ++++---- .../views/Agents/updateSupportAgent.html.twig | 2 +- .../Customers/listSupportCustomers.html.twig | 14 +++++++------- .../Customers/updateSupportCustomer.html.twig | 2 +- Services/UserService.php | 4 ++-- 9 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Controller/Account.php b/Controller/Account.php index 6488d4726..098ea5a82 100755 --- a/Controller/Account.php +++ b/Controller/Account.php @@ -215,7 +215,7 @@ public function editAgent($agentId) $user->setFirstName($data['firstName']); $user->setLastName($data['lastName']); $user->setEmail($data['email']); - $user->setIsEnabled(true); + $user->setIsEnabled(isset($data['isActive'])); $userInstance = $em->getRepository('UVDeskCoreFrameworkBundle:UserInstance')->findOneBy(['user' => $agentId]); diff --git a/Controller/Customer.php b/Controller/Customer.php index 5ea1b4714..8220f1bdb 100755 --- a/Controller/Customer.php +++ b/Controller/Customer.php @@ -136,7 +136,7 @@ public function editCustomer(Request $request) // User Instance $userInstance = $em->getRepository('UVDeskCoreFrameworkBundle:UserInstance')->findOneBy(array('user' => $user->getId())); $userInstance->setUser($user); - $userInstance->setIsActive(isset($data['isActive']) ? 1 : 0); + // $userInstance->setIsActive(isset($data['isActive']) ? 1 : 0); $userInstance->setIsVerified(0); if(isset($data['source'])) $userInstance->setSource($data['source']); diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index 8d8eeaace..86d70643d 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -41,7 +41,7 @@ public function getAllAgents(ParameterBag $params = null, ContainerInterface $co ->setParameter('fullName', '%' . urldecode(trim($fieldValue)) . '%') ->setParameter('email', '%' . urldecode(trim($fieldValue)) . '%'); } else if ('isActive' == $field) { - $queryBuilder->andWhere('userInstance.isActive = :isActive')->setParameter('isActive', $fieldValue); + $queryBuilder->andWhere('user.isEnabled = :isEnabled')->setParameter('isEnabled', $fieldValue); } } } @@ -69,8 +69,9 @@ public function getAllAgents(ParameterBag $params = null, ContainerInterface $co return [ 'id' => $user['id'], 'email' => $user['email'], + 'isEnabled' => $user['isEnabled'], 'smallThumbnail' => $user['userInstance'][0]['profileImagePath'] ?: null, - 'isActive' => $user['userInstance'][0]['isActive'], + // 'isActive' => $user['userInstance'][0]['isActive'], 'name' => ucwords(trim(implode(' ', [$user['firstName'], $user['lastName']]))), 'role' => $user['userInstance'][0]['supportRole']['description'], 'roleCode' => $user['userInstance'][0]['supportRole']['code'], @@ -103,7 +104,7 @@ public function getAllCustomer(ParameterBag $obj = null, $container) $data = array_reverse($data); foreach ($data as $key => $value) { if(!in_array($key,$this->safeFields)) { - if($key!='dateUpdated' AND $key!='dateAdded' AND $key!='search' AND $key!='starred' AND $key!='isActive') { + if($key!='dateUpdated' AND $key!='dateAdded' AND $key!='search' AND $key!='starred' AND $key!='isEnabled') { $qb->Andwhere('a.'.$key.' = :'.$key); $qb->setParameter($key, $value); } else { @@ -113,9 +114,9 @@ public function getAllCustomer(ParameterBag $obj = null, $container) $qb->setParameter('email', '%'.urldecode($value).'%'); } elseif($key == 'starred') { $qb->andwhere('userInstance.isStarred = 1'); - } else if($key == 'isActive') { - $qb->andwhere('userInstance.isActive = :isActive'); - $qb->setParameter('isActive', $value); + } else if($key == 'isEnabled') { + $qb->andwhere('a.isEnabled = :isEnabled'); + $qb->setParameter('isEnabled', $value); } } } @@ -151,9 +152,10 @@ public function getAllCustomer(ParameterBag $obj = null, $container) $data[] = array( 'id' => $customer[0]['id'], 'email' => $customer[0]['email'], + 'isEnabled'=> $customer[0]['isEnabled'], 'smallThumbnail' => $customer[0]['userInstance'][0]['profileImagePath'], 'isStarred' => $customer[0]['userInstance'][0]['isStarred'], - 'isActive' => $customer[0]['userInstance'][0]['isActive'], + // 'isActive' => $customer[0]['userInstance'][0]['isActive'], 'name' => $customer[0]['firstName'].' '.$customer[0]['lastName'], 'source' => $customer[0]['userInstance'][0]['source'], 'count' => $this->getCustomerTicketCount($customer[0]['id']), diff --git a/Resources/public/js/_common.js b/Resources/public/js/_common.js index ef8ae7ff8..2175d138e 100644 --- a/Resources/public/js/_common.js +++ b/Resources/public/js/_common.js @@ -148,7 +148,7 @@ $(function() { this.collection.reset(); this.collection.state.currentPage = null; this.collection.setSorting(null, null, {full: false}); - this.collection.filterParameters.isActive = Backbone.$(e.currentTarget).find('a').attr('data-id'); + this.collection.filterParameters.isEnabled = Backbone.$(e.currentTarget).find('a').attr('data-id'); var queryString = app.appView.buildQuery($.param(this.collection.getValidParameters())); router.navigate(queryString, {trigger: true}); }, diff --git a/Resources/views/Agents/listSupportAgents.html.twig b/Resources/views/Agents/listSupportAgents.html.twig index 88be7cfd5..6c128c52a 100755 --- a/Resources/views/Agents/listSupportAgents.html.twig +++ b/Resources/views/Agents/listSupportAgents.html.twig @@ -117,7 +117,7 @@ <%- email %> <%= role %> - <% if (isActive) { %> + <% if (isEnabled) { %> {{ 'Active'|trans }} <% } else { %> {{ 'Disabled'|trans }} @@ -148,7 +148,7 @@ model : AgentModel, url : "{{ path('helpdesk_member_account_collection_xhr') }}", filterParameters : { - "isActive" : "", + "isEnabled" : "", "search" : "" }, parseRecords: function (resp, options) { @@ -266,7 +266,7 @@ Router = Backbone.Router.extend({ routes: { 'page/:number(/sort/:sortField)(/direction/:order)' : 'paginate', - 'isActive/:status(/search/:query)(/page/:number)(/sort/:sortField)(/direction/:order)' : 'filterAgentByStatus', + 'isEnabled/:status(/search/:query)(/page/:number)(/sort/:sortField)(/direction/:order)' : 'filterAgentByStatus', 'search/:query(/page/:number)(/sort/:sortField)(/direction/:order)' : 'filterByQuery', '' : 'initializeList' }, @@ -297,7 +297,7 @@ resetParams : function(status, query) { if(query != null) query = query.replace(/\+/g,' '); - agentCollection.filterParameters.isActive = status; + agentCollection.filterParameters.isEnabled = status; var statusText = status ? $(".filter-by-status a[data-id='" + status + "']").text() : "{% trans %}All{% endtrans %}"; $(".filter-by-status .uv-dropdown-btn").text("{% trans %}Status:{% endtrans %} " + statusText); agentCollection.filterParameters.search = query; diff --git a/Resources/views/Agents/updateSupportAgent.html.twig b/Resources/views/Agents/updateSupportAgent.html.twig index 8fee1bdf3..4ac8aa670 100644 --- a/Resources/views/Agents/updateSupportAgent.html.twig +++ b/Resources/views/Agents/updateSupportAgent.html.twig @@ -165,7 +165,7 @@
    + {% if is_google_captcha_enabled == true %} +
    +
    +
    + {% else %} + + {% endif %}
    @@ -57,6 +64,10 @@ {% block footer %} {{ parent() }} + {% if is_google_captcha_enabled == true %} + + {% endif %} + + {% endif %} - {% endif %} + + - {% endif %} + + -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/Services/ReCaptchaService.php b/Services/ReCaptchaService.php index f490b7fb0..19a535d48 100644 --- a/Services/ReCaptchaService.php +++ b/Services/ReCaptchaService.php @@ -25,7 +25,7 @@ public function __construct(EntityManagerInterface $em, RequestStack $request, C */ public function getReCaptchaResponse($gRecaptchaResponse) { - $recaptcha = new \ReCaptcha\ReCaptcha($this->container->getParameter('recaptcha_secret_key')); + $recaptcha = new \ReCaptcha\ReCaptcha($this->getSecretKeyRecaptcha()); $resp = $recaptcha->verify($gRecaptchaResponse, $this->request->getCurrentRequest()->headers->get('host')); if ($resp->isSuccess()) { // verified! @@ -35,9 +35,19 @@ public function getReCaptchaResponse($gRecaptchaResponse) } } - public function getSiteKey() + public function getSecretKeyRecaptcha() { - return $this->container->getParameter('recaptcha_secret_key'); + $recaptchaDetail = $this->getRecaptchaDetails(); + return $recaptchaDetail->getSecretKey(); } + public function getRecaptchaDetails() + { + // find Recaptcha details + $em = $this->em; + $recaptchaRepo = $em->getRepository('UVDeskCoreFrameworkBundle:Recaptcha'); + $recaptcha = $recaptchaRepo->findAll(); + + return $recaptcha ? $recaptcha[0] : false; + } } diff --git a/Templates/config.yaml b/Templates/config.yaml index 75a9ffa6f..a3e1f6948 100644 --- a/Templates/config.yaml +++ b/Templates/config.yaml @@ -15,11 +15,6 @@ parameters: max_file_uploads: 20 upload_max_filesize: 2097152 - # Recaptcha site keys - is_google_captcha_enabled: false - recaptcha_site_key: 'site_key' - recaptcha_secret_key: 'secret_key' - uvdesk: site_url: 'localhost:8000' upload_manager: diff --git a/Templates/twig.yaml b/Templates/twig.yaml index 6baa0eb6b..17390c2a0 100644 --- a/Templates/twig.yaml +++ b/Templates/twig.yaml @@ -6,11 +6,9 @@ twig: max_post_size: '%max_post_size%' max_file_uploads: '%max_file_uploads%' upload_max_filesize: '%upload_max_filesize%' - is_google_captcha_enabled: '%is_google_captcha_enabled%' - recaptcha_site_key: '%recaptcha_site_key%' - recaptcha_secret_key: '%recaptcha_secret_key%' user_service: "@user.service" uvdesk_service: "@uvdesk.service" + recaptcha_service: "@recaptcha.service" ticket_service: "@ticket.service" csrf_token_generator: "@security.csrf.token_manager" email_service: "@email.service" From 50bd5c1dd3d9378337e29ab55abd860ef842d172 Mon Sep 17 00:00:00 2001 From: Sanjeev Papnoi Date: Sat, 27 Mar 2021 20:12:18 +0530 Subject: [PATCH 75/85] updates to save recaptcha details in database --- Resources/views/profile.html.twig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Resources/views/profile.html.twig b/Resources/views/profile.html.twig index 71ae525e1..7a2ef0560 100644 --- a/Resources/views/profile.html.twig +++ b/Resources/views/profile.html.twig @@ -4,6 +4,8 @@ {{ 'Profile'|trans }} {% endblock %} +{% set recaptchaDetail = recaptcha_service.getRecaptchaDetails() %} + {% block templateCSS %}