Skip to content

Commit

Permalink
Merge branch 'v1.1.6_micro' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
papnoisanjeev committed Dec 23, 2024
2 parents 2ed2c8f + 39a0a52 commit ba4d561
Show file tree
Hide file tree
Showing 138 changed files with 5,427 additions and 2,172 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG-1.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@ CHANGELOG for 1.1.x

This changelog references any relevant changes introduced in 1.1 minor versions.

* 1.1.6 (2024-12-23)
* Issue #508 #549 - Filter issue resolved for customer filtering.
* Issue #552 - In agent activity option: date filter should be select correct date format.
* Issue #524 - ticket is in trashed folder and we will reply from the admin then it should not send mail to the customer.
* Issue #577 - Customer name edit from admin side on ticket view page, if we leave space in starting customer name is removed in ticket view.
* Issue #587 - ticket is updated from the ticket list page flash message should be same of updated option.
* Issue #582 - In agent option, the permission tab should be shown a privileges icon.
* Issue #583 - If extra enter space leave in ticket type, group, and team description so ticket threads do not loads on ticket view page
* Issue #573 - In the search filter, if we space to leave in the start and last search filter not working.
* Issue #702 #601 - system can't calculate kudos score.
* Issue #594 - The ticket view page is not showing the proper date time format.
* Issue #605 - If saved Replies sharing without any group and team to another agent or administrator so here shows same saved reply instead of the 403 page.
* Issue #606 - When mail reply from collaborator side in agent and customer reply email template so collaborator email reply creates a new ticket
* Teams not removing from edit agent page - resolved
* Issue #665 - When upload txt file in ticket , total count of words attaching at the end of the file.
* Issue #644 - On the agent side should not be showing the reports icon without given any agent activity privileges.
* Issue #656 - In spam settings: If email added in spam so should not be ticket created from the admin end.
* Issue #656 - In spam settings: If email added in spam so should not be ticket created from the admin end.
* Download link correction for ticket.
* Initial thread opening issue if multiple emails in cc or collaborator.
* Microsoft redirect URL update.
* Lang select snippets position issue resolved on dashboard.

Features:
* Microsoft modern app support added.
* Added option for select and save country for a ticket.
* Round Robin Ticket assignment option added.
* Showing customer email along with name in side filters ticket list.
* In case of multiple attachments now added cross button for each attachment,
So that user can remove a particular attachment.
* Attachments renaming true for security purpose.

* 1.1.4 (2023-06-13)
* Update: Render package version number dynamically

Expand Down
110 changes: 58 additions & 52 deletions Controller/Account.php

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Controller/AccountXHR.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Webkul\UVDesk\CoreFrameworkBundle\Entity\SavedFilters;
use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents;
use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService;

class AccountXHR extends AbstractController
{
private $eventDispatcher;
Expand All @@ -41,6 +40,7 @@ public function listAgentsXHR(Request $request, ContainerInterface $container)
$agentCollection = $userRepository->getAllAgents($request->query, $container);
return new Response(json_encode($agentCollection), 200, ['Content-Type' => 'application/json']);
}

return new Response(json_encode([]), 404);
}

Expand Down Expand Up @@ -113,7 +113,7 @@ public function savedFiltersXHR(Request $request)
$user = $this->userService->getCurrentUser();
$userData = $user->getAgentInstance();

if($request->getMethod() == 'POST') {
if ($request->getMethod() == 'POST') {
$content = $request->request->all();
$filter = new SavedFilters();
$filter->setName($content['name']);
Expand All @@ -122,7 +122,7 @@ public function savedFiltersXHR(Request $request)
$em->persist($filter);
$em->flush();

if(isset($content['is_default'])) {
if (isset($content['is_default'])) {
$userData->setDefaultFiltering($filter->getId());
$em->persist($userData);
$em->flush();
Expand All @@ -138,9 +138,9 @@ public function savedFiltersXHR(Request $request)
$filter->setRoute($content['route']);
$em->flush();

if(isset($content['is_default']))
if (isset($content['is_default']))
$userData->setDefaultFiltering($filter->getId());
elseif($filter->getId() == $userData->getDefaultFiltering())
elseif ($filter->getId() == $userData->getDefaultFiltering())
$userData->setDefaultFiltering(0);

$em->persist($userData);
Expand All @@ -149,7 +149,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->translator->trans('Success ! Filter has been updated successfully.');
} elseif($request->getMethod() == 'DELETE') {
} elseif ($request->getMethod() == 'DELETE') {

$id = $request->attributes->get('filterId');
$filter = $em->getRepository(SavedFilters::class)->find($id);
Expand Down
18 changes: 11 additions & 7 deletions Controller/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ public function clearProjectCache(Request $request)
$processId = (int) $output[0];

$responseContent = [
'alertClass' => 'success',
'alertClass' => 'success',
'alertMessage' => $this->translator->trans('Success ! Project cache cleared successfully.')
];

return new Response(json_encode($responseContent), 200, ['Content-Type' => 'application/json']);
}

$responseContent = [
'alertClass' => 'warning',
'alertClass' => 'warning',
'alertMessage' => $this->translator->trans('Error! Something went wrong.')
];

Expand Down Expand Up @@ -100,7 +101,7 @@ public function forgotPassword(Request $request)
$repository = $this->getDoctrine()->getRepository(User::class);
$user = $entityManager->getRepository(User::class)->findOneByEmail($form->getData()->getEmail());

if (!empty($user)) {
if (! empty($user)) {
// Trigger agent forgot password event
$event = new CoreWorkflowEvents\User\ForgotPassword();
$event
Expand All @@ -125,9 +126,12 @@ public function updateCredentials($email, $verificationCode, Request $request, U
{
$entityManager = $this->getDoctrine()->getManager();
$user = $entityManager->getRepository(User::class)->findOneByEmail($email);
$lastupdatedInstance = $entityManager->getRepository(User::class)->LastupdatedRole($user);
$lastUpdatedInstance = $entityManager->getRepository(User::class)->lastUpdatedRole($user);

if (empty($user) || $user->getVerificationCode() != $verificationCode) {
if (
empty($user)
|| $user->getVerificationCode() != $verificationCode
) {
$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'));
Expand All @@ -145,9 +149,9 @@ public function updateCredentials($email, $verificationCode, Request $request, U

$this->addFlash('success', $this->translator->trans('Your password has been successfully updated. Login using updated password'));

if($lastupdatedInstance[0]->getSupportRole()->getId() != 4){
if ($lastUpdatedInstance[0]->getSupportRole()->getId() != 4) {
return $this->redirect($this->generateUrl('helpdesk_member_handle_login'));
}else{
} else {
return $this->redirect($this->generateUrl('helpdesk_knowledgebase'));
}
} else {
Expand Down
61 changes: 34 additions & 27 deletions Controller/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function createCustomer(Request $request)

// Profile upload validation
$validMimeType = ['image/jpeg', 'image/png', 'image/jpg'];
if(isset($uploadedFiles['profileImage'])){
if(!in_array($uploadedFiles['profileImage']->getMimeType(), $validMimeType)){
if (isset($uploadedFiles['profileImage'])) {
if (!in_array($uploadedFiles['profileImage']->getMimeType(), $validMimeType)) {
$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'));
}
Expand All @@ -74,12 +74,12 @@ public function createCustomer(Request $request)

$user = $this->userService->createUserInstance($formDetails['email'], $fullname, $supportRole, [
'contact' => $formDetails['contactNumber'],
'source' => 'website',
'active' => !empty($formDetails['isActive']) ? true : false,
'image' => $uploadedFiles['profileImage'],
'source' => 'website',
'active' => !empty($formDetails['isActive']) ? true : false,
'image' => $uploadedFiles['profileImage'],
]);

if(!empty($user)){
if (!empty($user)){
$user->setIsEnabled(true);
$entityManager->persist($user);
$entityManager->flush();
Expand All @@ -95,7 +95,7 @@ public function createCustomer(Request $request)
}

return $this->render('@UVDeskCoreFramework/Customers/createSupportCustomer.html.twig', [
'user' => new User(),
'user' => new User(),
'errors' => json_encode([])
]);
}
Expand All @@ -109,34 +109,35 @@ public function editCustomer(Request $request)
$em = $this->getDoctrine()->getManager();
$repository = $em->getRepository(User::class);

if($userId = $request->attributes->get('customerId')) {
if ($userId = $request->attributes->get('customerId')) {
$user = $repository->findOneBy(['id' => $userId]);
if(!$user)
if (!$user)
$this->noResultFound();
}
if ($request->getMethod() == "POST") {
$contentFile = $request->files->get('customer_form');

// Customer Profile upload validation
$validMimeType = ['image/jpeg', 'image/png', 'image/jpg'];
if(isset($contentFile['profileImage'])){
if(!in_array($contentFile['profileImage']->getMimeType(), $validMimeType)){
if (isset($contentFile['profileImage'])) {
if (!in_array($contentFile['profileImage']->getMimeType(), $validMimeType)) {
$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([])]);
}
}
if($userId) {

if ($userId) {
$data = $request->request->all();
$data = $data['customer_form'];
$checkUser = $em->getRepository(User::class)->findOneBy(array('email' => $data['email']));
$errorFlag = 0;

if($checkUser) {
if ($checkUser) {
if($checkUser->getId() != $userId)
$errorFlag = 1;
}

if(!$errorFlag && 'hello@uvdesk.com' !== $user->getEmail()) {
if (!$errorFlag && 'hello@uvdesk.com' !== $user->getEmail()) {
if (
isset($data['password']['first']) && !empty(trim($data['password']['first']))
&& isset($data['password']['second']) && !empty(trim($data['password']['second']))
Expand All @@ -146,9 +147,9 @@ public function editCustomer(Request $request)
}

$email = $user->getEmail();
$user->setFirstName($data['firstName']);
$user->setLastName($data['lastName']);
$user->setEmail($data['email']);
$user->setFirstName(trim($data['firstName']));
$user->setLastName(trim($data['lastName']));
$user->setEmail(trim($data['email']));
$user->setIsEnabled(true);
$em->persist($user);

Expand All @@ -158,10 +159,11 @@ public function editCustomer(Request $request)
$userInstance->setIsActive(isset($data['isActive']) ? $data['isActive'] : 0);
$userInstance->setIsVerified(0);

if(isset($data['contactNumber'])) {
if (isset($data['contactNumber'])) {
$userInstance->setContactNumber($data['contactNumber']);
}
if(isset($contentFile['profileImage'])) {

if (isset($contentFile['profileImage'])) {
// Removed profile image from database and path
$fileService = new Fileservice;
if ($userInstance->getProfileImagePath()) {
Expand All @@ -188,12 +190,13 @@ public function editCustomer(Request $request)
$this->eventDispatcher->dispatch($event, 'uvdesk.automation.workflow.execute');

$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->translator->trans('Error ! User with same email is already exist.'));
}
}
} elseif($request->getMethod() == "PUT") {
} elseif ($request->getMethod() == "PUT") {
$content = json_decode($request->getContent(), true);
$userId = $content['id'];
$user = $repository->findOneBy(['id' => $userId]);
Expand All @@ -212,14 +215,14 @@ public function editCustomer(Request $request)
if (!$errorFlag && 'hello@uvdesk.com' !== $user->getEmail()) {
$name = explode(' ', $content['name']);
$lastName = isset($name[1]) ? $name[1] : ' ';
$user->setFirstName($name[0]);
$user->setLastName($lastName);
$user->setEmail($content['email']);
$user->setFirstName(trim($name[0]));
$user->setLastName(trim($lastName));
$user->setEmail(trim($content['email']));
$em->persist($user);

//user Instance
$userInstance = $em->getRepository(UserInstance::class)->findOneBy(array('user' => $user->getId()));
if(isset($content['contactNumber'])){
if (isset($content['contactNumber'])){
$userInstance->setContactNumber($content['contactNumber']);
}
$em->persist($userInstance);
Expand All @@ -234,7 +237,7 @@ public function editCustomer(Request $request)

return new Response(json_encode($json), 200, []);
}
// dump($user); die;

return $this->render('@UVDeskCoreFramework/Customers/updateSupportCustomer.html.twig', [
'user' => $user,
'errors' => json_encode([])
Expand All @@ -260,8 +263,10 @@ public function bookmarkCustomer(Request $request)
$data = json_decode($request->getContent(), true);
$id = $request->attributes->get('id') ? : $data['id'];
$user = $em->getRepository(User::class)->findOneBy(['id' => $id]);
if(!$user) {

if (!$user) {
$json['error'] = 'resource not found';

return new JsonResponse($json, Response::HTTP_NOT_FOUND);
}
$userInstance = $em->getRepository(UserInstance::class)->findOneBy(array(
Expand All @@ -270,7 +275,7 @@ public function bookmarkCustomer(Request $request)
)
);

if($userInstance->getIsStarred()) {
if ($userInstance->getIsStarred()) {
$userInstance->setIsStarred(0);
$em->persist($userInstance);
$em->flush();
Expand All @@ -283,8 +288,10 @@ public function bookmarkCustomer(Request $request)
$json['alertClass'] = 'success';
$json['message'] = $this->translator->trans('starred Action Completed successfully');
}

$response = new Response(json_encode($json));
$response->headers->set('Content-Type', 'application/json');

return $response;
}
}
19 changes: 9 additions & 10 deletions Controller/CustomerXHR.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public function __construct(UserService $userService, EventDispatcherInterface $

public function listCustomersXHR(Request $request, ContainerInterface $container)
{
if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) {
if (! $this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) {
return $this->redirect($this->generateUrl('helpdesk_member_dashboard'));
}

$json = array();

if($request->isXmlHttpRequest()) {
if ($request->isXmlHttpRequest()) {
$repository = $this->getDoctrine()->getRepository(User::class);
$json = $repository->getAllCustomer($request->query, $container);
}
Expand All @@ -47,18 +47,17 @@ public function listCustomersXHR(Request $request, ContainerInterface $container

public function removeCustomerXHR(Request $request)
{
if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) {
if (! $this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_CUSTOMER')) {
return $this->redirect($this->generateUrl('helpdesk_member_dashboard'));
}

$json = array();
if($request->getMethod() == "DELETE") {
if ($request->getMethod() == "DELETE") {
$em = $this->getDoctrine()->getManager();
$id = $request->attributes->get('customerId');
$user = $em->getRepository(User::class)->findOneBy(['id' => $id]);

if($user) {

if ($user) {
$this->userService->removeCustomer($user);
// Trigger customer created event
$event = new CoreWorkflowEvents\Customer\Delete();
Expand All @@ -68,18 +67,18 @@ public function removeCustomerXHR(Request $request)

$this->eventDispatcher->dispatch($event, 'uvdesk.automation.workflow.execute');

$json['alertClass'] = 'success';
$json['alertClass'] = 'success';
$json['alertMessage'] = $this->translator->trans('Success ! Customer removed successfully.');
} else {
$json['alertClass'] = 'danger';
$json['alertClass'] = 'danger';
$json['alertMessage'] = $this->translator->trans('Error ! Invalid customer id.');
$json['statusCode'] = Response::HTTP_NOT_FOUND;
$json['statusCode'] = Response::HTTP_NOT_FOUND;
}
}

$response = new Response(json_encode($json));
$response->headers->set('Content-Type', 'application/json');
return $response;

return $response;
}
}
Loading

0 comments on commit ba4d561

Please sign in to comment.