Skip to content

Commit

Permalink
Merge branch 'v1.1.6_micro' of https://github.com/uvdesk/core-framework
Browse files Browse the repository at this point in the history
… into v1.1.6_micro
  • Loading branch information
ayushrajsrivastava.akeneo736 committed Dec 2, 2024
2 parents 38317ff + 3411873 commit 3bd5326
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 9 deletions.
10 changes: 9 additions & 1 deletion Controller/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function editAgent($agentId)
return $this->redirect($this->generateUrl('helpdesk_member_dashboard'));
}

// @TODO: Refactor
// @TODO: Refactor
$em = $this->getDoctrine()->getManager();
$request = $this->container->get('request_stack')->getCurrentRequest();

Expand Down Expand Up @@ -323,6 +323,14 @@ public function editAgent($agentId)
$userInstance->removeSupportTeam($removeteam);
$em->persist($userInstance);
}
} else {
foreach ($oldSupportTeam as $supportTeam) {
$userInstance->removeSupportTeam($supportTeam);

$em->persist($userInstance);
}

$em->flush();
}

if (isset($data['groups'])) {
Expand Down
7 changes: 3 additions & 4 deletions Controller/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(UserService $userService, UVDeskService $uvdeskServi

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

Expand All @@ -62,7 +62,7 @@ public function agentActivityXHR(Request $request)

public function agentActivityData(Request $request)
{
if (!$this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_AGENT_ACTIVITY')){
if (! $this->userService->isAccessAuthorized('ROLE_AGENT_MANAGE_REPORTS')) {
throw new \Exception('Access Denied', 403);
}

Expand All @@ -73,7 +73,7 @@ public function agentActivityData(Request $request)
$endDate = $reportService->parameters['before'];

$agentIds = [];
if(isset($reportService->parameters['agent']))
if (isset($reportService->parameters['agent']))
$agentIds = explode(',', $reportService->parameters['agent']);

$userService = $this->userService;
Expand Down Expand Up @@ -159,7 +159,6 @@ public function achievementInsightsAction()
public function getAchievementsXhr(Request $request, ContainerInterface $container)
{
$json = array();

if ($request->isXmlHttpRequest()) {
$repository = $this->getDoctrine()->getRepository(TicketRating::class);
$json = $repository->getRatedTicketList($request->query, $container);
Expand Down
10 changes: 10 additions & 0 deletions Controller/SavedReplies.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ public function updateSavedReplies(Request $request, ContainerInterface $contain
$templateId = $request->attributes->get('template');
$repository = $this->getDoctrine()->getRepository(CoreFrameworkBundleEntities\SavedReplies::class);

$template = $repository->getSavedReply($templateId, $container);
if (! empty($template)) {
$groupSupports = count($template->getSupportGroups());
$teamSupports = count($template->getSupportTeams());

if ($template->getUser()->getId() != $this->getUser()->getId() && empty($groupSupports) && empty($teamSupports)) {
throw new \Exception('Access Denied', 403);
}
}

if (empty($templateId)) {
$template = new CoreFrameworkBundleEntities\SavedReplies();
} else {
Expand Down
3 changes: 2 additions & 1 deletion Controller/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ public function downloadAttachment(Request $request)

$response->setStatusCode(200);
$response->sendHeaders();
$response->setContent(readfile($path));

readfile($path);

return $response;
}
Expand Down
2 changes: 1 addition & 1 deletion Repository/ThreadRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function findThreadByRefrenceId($referenceIds)
$queryBuilder = $this->getEntityManager()->createQueryBuilder()
->select('t')
->from(Ticket::class, 't')
->where('t.referenceIds = :referenceIds')->setParameter('referenceIds', "%$referenceIds%")
->where('t.referenceIds LIKE :referenceIds')->setParameter('referenceIds', "%$referenceIds%")
->orderBy('t.id', 'DESC')
->setMaxResults(1)
;
Expand Down
14 changes: 12 additions & 2 deletions Resources/views/ticket.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -1562,12 +1562,22 @@
},
'reply' : {
fn: function(value) {
if(!tinyMCE.get("uv-edit-create-thread"))
var content = tinyMCE.activeEditor.getContent();
content = content.replace(/&nbsp;/g, '').replace(/<[^>]*>/g, '');

if (content.trim() == '') {
return true;
} else {
return false;
}

if (! tinyMCE.get("uv-edit-create-thread"))
return false;
var html = tinyMCE.get("uv-edit-create-thread").getContent();
if(app.appView.stripHTML(html) != '') {
if (app.appView.stripHTML(html) != '') {
return false;
}

return true;
},
msg : '{{ "This field is mandatory" | trans}}'
Expand Down

0 comments on commit 3bd5326

Please sign in to comment.