Skip to content

Commit

Permalink
implementation of reply from thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramakant Pandey committed Jan 30, 2017
1 parent 6f9373f commit a82cd71
Show file tree
Hide file tree
Showing 29 changed files with 151 additions and 864 deletions.
8 changes: 6 additions & 2 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ Legend

-------------------------------- Version 2.0.0 --------------------------------------

+ Admin can all the tickets.
+ Customer can create or view his/her tickets
+Integrate Uvdesk Helpdesk System with magento
+Admin can manage tickets from magento backend.
+Admin can reply on tickets.
+Admin can delete any ticket.
+Customers can reply to tickets from their magento store account on front-end.
+Real time synchronization between Uvdesk Helpdesk System and magento Store tickets.
12 changes: 5 additions & 7 deletions src/app/code/Webkul/UvDeskConnector/Block/AllTickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ class AllTickets extends \Magento\Framework\View\Element\Template
{

/**
* [__construct description]
* @param \Magento\Framework\View\Element\Template\Context $context [description]
* @param \Webkul\LoginForm\Model\NewsFactory $model [description]
* @param array $data [description]
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Webkul\UvDeskConnector\Helper\Tickets $ticketHelper
* @param \Webkul\UvDeskConnector\Model\TicketManager $ticketManager
* @param \Magento\Customer\Model\Session $customerSession
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
Expand Down Expand Up @@ -50,9 +51,6 @@ public function getTicketsAccToCustomer()
$pageNo = null;
}
$tickets = $this->_ticketManager->getAllTicketss($pageNo,null,null,null,$customerUvdeskId,null,null,null,null,null,null);
// echo "<pre>";
// print_r($tickets);
// die;
return $this->_ticketHelper->formatData($tickets);
}

Expand Down
8 changes: 6 additions & 2 deletions src/app/code/Webkul/UvDeskConnector/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ Legend

-------------------------------- Version 2.0.0 --------------------------------------

+ Admin can all the tickets.
+ Customer can create or view his/her tickets
+Integrate Uvdesk Helpdesk System with magento
+Admin can manage tickets from magento backend.
+Admin can reply on tickets.
+Admin can delete any ticket.
+Customers can reply to tickets from their magento store account on front-end.
+Real time synchronization between Uvdesk Helpdesk System and magento Store tickets.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Webkul Software.
*
* @category Webkul
* @package Webkul_UvDeskConnector
* @author Webkul
* @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/
* Webkul Software.
*
* @category Webkul
* @package Webkul_UvDeskConnector
* @author Webkul Software Private Limited
* @copyright Copyright (c) 2010-2017 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/

namespace Webkul\UvDeskConnector\Controller\Adminhtml\Tickets;

Expand All @@ -34,9 +34,6 @@ public function __construct(

public function execute()
{
echo "here";
print_r($this->getRequest()->getParams());
die;
$resultPage = $this->_resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend(__('Tickets'));
return $resultPage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Webkul Software.
*
* @category Webkul
* @package Webkul_UvDeskConnector
* @author Webkul
* @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/
* Webkul Software.
*
* @category Webkul
* @package Webkul_UvDeskConnector
* @author Webkul Software Private Limited
* @copyright Copyright (c) 2010-2017 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/

namespace Webkul\UvDeskConnector\Controller\Adminhtml\Tickets;

Expand All @@ -19,10 +19,12 @@ class DownloadAttachment extends \Magento\Backend\App\Action
/** @var \Magento\Framework\View\Result\PageFactory */
protected $_resultPageFactory;

/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
*/
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
* @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
* @param \Webkul\UvDeskConnector\Model\TicketManager $ticketManager
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory,
Expand All @@ -41,28 +43,11 @@ public function execute()
$attachmenId = $this->getRequest()->getParam('attachment_id');
$name = $this->getRequest()->getParam('name');
$file = $this->_ticketManager->downloadAttachment($attachmenId);
// echo "<pre>";
// print_r($file);
// die;

header('Content-Disposition: attachment; filename="'.$name.'"');
header('Content-Type: '.$file['info']['content_type']); # Don't use application/force-download - it's not a real MIME type, and the Content-Disposition header is sufficient
header('Content-Type: '.$file['info']['content_type']);
header('Content-Length: ' . strlen($file['response']));
header('Connection: close');
echo $file['response'];
// $this->getResponse () ->setHttpResponseCode ( 200 )
// ->setHeader ( 'Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true )
// ->setHeader ( 'Pragma', 'public', true )
// ->setHeader ( 'Content-type', 'application/force-download' )
// ->setHeader ( 'Content-Length', 696 )
// ->setHeader ('Content-Disposition', 'attachment' . '; filename=' . basename('http://testingnew.voipkul.com/en/api/ticket/attachment/18077.json') );
// $this->getResponse ()->clearBody ();
// $this->getResponse ()->sendHeaders ();
// readfile ( 'http://testingnew.voipkul.com/en/api/ticket/attachment/18077.json' );
// exit;
// $resultPage = $this->_resultPageFactory->create();
// $resultPage->getConfig()->getTitle()->prepend(__('Tickets'));
// return $resultPage;
}

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Webkul Software.
*
* @category Webkul
* @package Webkul_UvDeskConnector
* @author Webkul
* @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/
* Webkul Software.
*
* @category Webkul
* @package Webkul_UvDeskConnector
* @author Webkul Software Private Limited
* @copyright Copyright (c) 2010-2017 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/

namespace Webkul\UvDeskConnector\Controller\Adminhtml\Tickets;

Expand All @@ -28,10 +28,13 @@ class GetTickets extends \Magento\Backend\App\Action
/** @var \Webkul\UvDeskConnector\Helper\Tickets */
protected $_ticketsHelper;

/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
*/
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
* @param \Webkul\UvDeskConnector\Model\TicketManager $ticketManager
* @param \Webkul\UvDeskConnector\Helper\Tickets $ticketsHelper
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
Expand All @@ -49,9 +52,6 @@ public function __construct(

public function execute()
{
// echo "<pre>";
// print_r($this->getRequest()->getParams());
// die;
$page = $this->checkStatus('pageNo');
$label = $this->checkStatus('labels');
$tab = $this->checkStatus('tab');
Expand All @@ -62,30 +62,20 @@ public function execute()
$priority = $this->checkStatus('priority');
$type = $this->checkStatus('type');
$tag = $this->checkStatus('tag');
$mailbox =$this->checkStatus('mailbox');
// $this->_ticketsHelper->formatParameter($this->getRequest()->getParams());
// $tab = $this->getRequest()->getParam('tab');
// $label = $this->getRequest()->getParam('labels');
// $agent = $this->getRequest()->getParam('agent');
// $customer = $this->getRequest()->getparam('customer');
$tickets = $this->_ticketManager->getAllTicketss($page,$label,$tab,$agent,$customer,$group,$team,$priority,$type,$tag,$mailbox);
// echo "<pre>";
// print_r($tickets);
// die;
$mailbox =$this->checkStatus('mailbox');
$tickets = $this->_ticketManager->getAllTicketss($page, $label, $tab, $agent, $customer, $group, $team, $priority, $type, $tag, $mailbox);
$formatedTickets = $this->_ticketsHelper->formatData($tickets);
// echo "<pre>";
// print_r($formatedTickets);
// die;
$this->getResponse()->setHeader('Content-type', 'application/json');
$this->getResponse()->setBody($this->_json->jsonEncode($formatedTickets));
// $resultPage = $this->_resultPageFactory->create();
// $resultPage->getConfig()->getTitle()->prepend(__('Tickets'));
// return $resultPage;
}

public function checkStatus($code){
public function checkStatus($code)
{
$flag = $this->getRequest()->getParam($code);
if(isset($flag)) {
if (isset($flag)) {
return $this->getRequest()->getParam($code);
} else {
return null;
Expand All @@ -99,6 +89,6 @@ public function checkStatus($code){
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Webkul_UvDeskConnector::tickets_gettickets');
return $this->_authorization->isAllowed('Webkul_UvDeskConnector::tickets_index');
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Webkul Software.
*
* @category Webkul
* @package Webkul_UvDeskConnector
* @author Webkul
* @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/
* Webkul Software.
*
* @category Webkul
* @package Webkul_UvDeskConnector
* @author Webkul Software Private Limited
* @copyright Copyright (c) 2010-2017 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/

namespace Webkul\UvDeskConnector\Controller\Adminhtml\Tickets;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Webkul Software.
*
* @category Webkul
* @package Webkul_UvDeskConnector
* @author Webkul
* @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/
* Webkul Software.
*
* @category Webkul
* @package Webkul_UvDeskConnector
* @author Webkul Software Private Limited
* @copyright Copyright (c) 2010-2017 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/

namespace Webkul\UvDeskConnector\Controller\Adminhtml\Tickets;

Expand Down Expand Up @@ -44,10 +44,12 @@ public function execute()
$ticketId = isset($post['ticket_id'])?$post['ticket_id']:null;
$tickeIncrementId = isset($post['incremet_id'])?$post['incremet_id']:null;
$reply = isset($post['product']['description'])?$post['product']['description']:null;
if(isset($post['addReply']) && $post['addReply'] == 1 ){
if (isset($post['addReply']) && $post['addReply'] == 1 ) {
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
$response = $this->_ticketManager->addReplyToTicket($ticketId,$tickeIncrementId,$reply);
$resultRedirect->setPath('uvdeskcon/tickets/ticketthread/', ['id' => $ticketId,'increment_id'=>$tickeIncrementId]);
$response = $this->_ticketManager->addReplyToTicket($ticketId, $tickeIncrementId, $reply);
$resultRedirect->setPath(
'uvdeskcon/tickets/ticketthread/', ['id' => $ticketId,'increment_id'=>$tickeIncrementId]
);
return $resultRedirect;
}

Expand All @@ -59,6 +61,6 @@ public function execute()
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Webkul_UvDeskConnector::tickets_ticketthread');
return $this->_authorization->isAllowed('Webkul_UvDeskConnector::tickets_index');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function execute()
'name'=>$customerDetail['name'],
'from'=>$customerDetail['email'],
'subject'=>$post['subject'],
'reply'=>'klklllkl',
'reply'=>$post['message'],
'type'=>$post['type']
];
$response = $this->_ticketManager->createTicket($ticketData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function execute()
$post = $this->getRequest()->getParams();
if (isset($post['pageNo']) && isset($post['isAjax'])) {
$customerUvdeskId = $this->_customerSession->getCustomerUvdeskId();
$tickets = $this->_ticketManager->getAllTicketss($post['pageNo'],null,null,null,$customerUvdeskId);
$tickets = $this->_ticketManager->getAllTicketss($post['pageNo'], null, null, null, $customerUvdeskId);
$formatedTickets = $this->_ticketsHelper->formatData($tickets);
$this->getResponse()->setHeader('Content-type', 'application/json');
$this->getResponse()->setBody($this->_json->jsonEncode($formatedTickets));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public function __construct(
Context $context,
PageFactory $resultPageFactory,
\Webkul\UvDeskConnector\Model\TicketManager $ticketManager
) {
)
{
$this->_resultPageFactory = $resultPageFactory;
$this->_ticketManager = $ticketManager;
parent::__construct($context);
Expand All @@ -48,16 +49,17 @@ public function execute()
{
$resultPage = $this->_resultPageFactory->create();
// $resultPage->getConfig()->getTitle()->set(__('UVdesk Add On'));

// $resultPage->getConfig()->getTitle()->prepend(__('Tickets'));
$post = $this->getRequest()->getParams();
$ticketId = isset($post['ticket_id'])?$post['ticket_id']:null;
$tickeIncrementId = isset($post['incremet_id'])?$post['incremet_id']:null;
$reply = isset($post['product']['description'])?$post['product']['description']:null;
if(isset($post['addReply']) && $post['addReply'] == 1 ){
if (isset($post['addReply']) && $post['addReply'] == 1 ) {
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
$response = $this->_ticketManager->addReplyToTicket($ticketId,$tickeIncrementId,$reply);
$resultRedirect->setPath('uvdeskcon/ticketview/index/', ['id' => $ticketId,'increment_id'=>$tickeIncrementId]);
$response = $this->_ticketManager->addReplyToTicket($ticketId, $tickeIncrementId, $reply);
$resultRedirect->setPath(
'uvdeskcon/ticketview/index/', ['id' => $ticketId,'increment_id'=>$tickeIncrementId]
);
return $resultRedirect;
}
return $resultPage;
Expand Down
15 changes: 2 additions & 13 deletions src/app/code/Webkul/UvDeskConnector/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

class Data extends AbstractHelper
{
{

/**
* @var \Magento\Config\Model\ResourceModel\Config
Expand Down Expand Up @@ -66,16 +66,5 @@ public function getCompanyDomainName()
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
return $companyDomainName;
}


// public function getAccessToken()
// {
// return 'A289AA1A50DA12175D033D194DE5F5E813781A289AA1A50DA12175D033D194DE5F5E8';
// }

// public function getCompanyDomainName()
// {
// return 'testingnew';
// }
}
}
Loading

0 comments on commit a82cd71

Please sign in to comment.