Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update in tickets view page for source #650

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Controller/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
use Webkul\UVDesk\CoreFrameworkBundle\Entity\User;
use Webkul\UVDesk\CoreFrameworkBundle\Entity\TicketPriority;
use Webkul\UVDesk\CoreFrameworkBundle\Entity\TicketStatus;
use Webkul\UVDesk\CoreFrameworkBundle\Entity as CoreEntites;


class Ticket extends AbstractController
{
Expand Down Expand Up @@ -172,11 +174,11 @@ public function saveTicket(Request $request)
$requestParams = $request->request->all();
$entityManager = $this->getDoctrine()->getManager();
$response = $this->redirect($this->generateUrl('helpdesk_member_ticket_collection'));

if ($request->getMethod() != 'POST' || false == $this->userService->isAccessAuthorized('ROLE_AGENT_CREATE_TICKET')) {
return $response;
}

// Get referral ticket if any
$ticketValidationGroup = 'CreateTicket';
$referralURL = $request->headers->get('referer');
Expand All @@ -185,16 +187,23 @@ public function saveTicket(Request $request)
$iterations = explode('/', $referralURL);
$referralId = array_pop($iterations);
$expectedReferralURL = $this->generateUrl('helpdesk_member_ticket', ['ticketId' => $referralId], UrlGeneratorInterface::ABSOLUTE_URL);

if ($referralURL === $expectedReferralURL) {
$referralTicket = $entityManager->getRepository(CoreBundleTicket::class)->findOneById($referralId);

if (!empty($referralTicket)) {
$ticketValidationGroup = 'CustomerCreateTicket';
}
}
}

$email = $request->request->get('from');
$website = $entityManager->getRepository(CoreEntites\Website::class)->findOneByCode('knowledgebase');
if(!empty($email) && $this->ticketService->isEmailBlocked($email, $website)) {
$request->getSession()->getFlashBag()->set('warning', $this->translator->trans('Warning ! Cannot create ticket, given email is blocked.'));
return $this->redirect($this->generateUrl('helpdesk_member_ticket_collection'));
}

$ticketType = $entityManager->getRepository(TicketType::class)->findOneById($requestParams['type']);

try {
Expand Down
7 changes: 7 additions & 0 deletions Resources/views/Snippets/createMemberTicket.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,13 @@
},
'reply' : {
fn: function(value) {
var content = tinyMCE.activeEditor.getContent();
if (content) {
return false;
}else {
return true;
}

if(!tinyMCE.get("uv-edit-create-thread"))
return false;
var html = tinyMCE.get("uv-edit-create-thread").getContent();
Expand Down
2 changes: 2 additions & 0 deletions Resources/views/ticket.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@
<span class="uv-icon-channel uv-channel-email"></span> <span>{{ 'Email'|trans }}</span>
{% elseif ticket.source == 'formbuilder' %}
<span class="uv-icon-channel uv-channel-form"></span> <span>{{ 'Formbuilder'|trans }}</span>
{% elseif ticket.source == 'api' %}
<span class="uv-icon-channel uv-channel-api"></span> <span>{{ 'Api'|trans }}</span>
{% else %}
<span class="uv-icon-channel uv-channel-web"></span> <span>{{ 'Website'|trans }}</span>
{% endif %}
Expand Down