ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace JR\NetSuite\Controller\Adminhtml\RmaQueue;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
use JR\NetSuite\Queue\RmaQueueManager;
|
||||
|
||||
/**
|
||||
* Class ClearHistory from controller
|
||||
*/
|
||||
class Fetch extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'JR_NetSuite::rmaqueue';
|
||||
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* @var RmaQueueManager
|
||||
*/
|
||||
protected $rmaQueueManager;
|
||||
|
||||
public function __construct(
|
||||
\Magento\Backend\App\Action\Context $context,
|
||||
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
|
||||
RmaQueueManager $rmaQueueManager
|
||||
) {
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
$this->rmaQueueManager = $rmaQueueManager;
|
||||
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$result = $this->rmaQueueManager->fetchAndEnqueue();
|
||||
|
||||
if ($result['error']) {
|
||||
$this->messageManager->addErrorMessage(__('Error while fetching data from NetSuite. ' . $result['message']));
|
||||
} else {
|
||||
$this->messageManager->addSuccessMessage(__('Data fetched successfully. ' . $result['message']));
|
||||
}
|
||||
$this->_redirect('jr_netsuite/rmaqueue/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed(static::MENU_ID);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
namespace JR\NetSuite\Controller\Adminhtml\RmaQueue;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
use JR\NetSuite\Cron\RmaSyncCron;
|
||||
|
||||
/**
|
||||
* Class ClearHistory from controller
|
||||
*/
|
||||
class Import extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'JR_NetSuite::rmaqueue';
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* @var RmaSyncCron
|
||||
*/
|
||||
protected $rmaSyncCron;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\ResourceConnection
|
||||
*/
|
||||
protected $_resource;
|
||||
|
||||
public function __construct(
|
||||
\Magento\Backend\App\Action\Context $context,
|
||||
\Magento\Framework\App\ResourceConnection $resource,
|
||||
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
|
||||
RmaSyncCron $rmaSyncCron
|
||||
) {
|
||||
$this->_resource = $resource;
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
$this->rmaSyncCron = $rmaSyncCron;
|
||||
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
try {
|
||||
$processed = 0;
|
||||
// do {
|
||||
$count = $this->rmaSyncCron->processQueueItems();
|
||||
if ($count) {
|
||||
$processed += $count;
|
||||
}
|
||||
// } while ($count);
|
||||
$this->messageManager->addSuccessMessage(__('A total of %1 rmas imported.', $processed));
|
||||
} catch (\Exception $e) {
|
||||
$this->messageManager->addErrorMessage($e->getMessage());
|
||||
}
|
||||
$this->_redirect('jr_netsuite/rmaqueue/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed(static::MENU_ID);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace JR\NetSuite\Controller\Adminhtml\RmaQueue;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
use Magento\Framework\App\Action\HttpGetActionInterface;
|
||||
use Magento\Framework\View\Result\Page;
|
||||
use JR\NetSuite\Controller\Adminhtml\RmaQueue;
|
||||
|
||||
class Index extends RmaQueue
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\View\Result\PageFactory
|
||||
*/
|
||||
private $resultPageFactory;
|
||||
|
||||
/**
|
||||
* @param \Magento\Backend\App\Action\Context $context
|
||||
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
PageFactory $resultPageFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the page defined in view/adminhtml/layout/jr_netsuite_rmaqueue_index.xml
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/** @var Page $resultPage */
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$resultPage->setActiveMenu('JR_NetSuite::rmaqueue');
|
||||
$resultPage->getConfig()->getTitle()->prepend(__('RMA Queue'));
|
||||
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* @category JR
|
||||
* @package JR_NetSuite
|
||||
* @author JR Software Private Limited
|
||||
* @copyright Copyright (c) JR Software Private Limited (https://JR.com)
|
||||
* @license https://store.JR.com/license.html
|
||||
*/
|
||||
namespace JR\NetSuite\Controller\Adminhtml\RmaQueue;
|
||||
|
||||
use Magento\Framework\Controller\ResultFactory;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Ui\Component\MassAction\Filter;
|
||||
use JR\NetSuite\Model\ResourceModel\RmaQueue\CollectionFactory;
|
||||
|
||||
class MassDelete extends \Magento\Backend\App\Action
|
||||
{
|
||||
/**
|
||||
* Massactions filter.
|
||||
*
|
||||
* @var Filter
|
||||
*/
|
||||
private $filter;
|
||||
|
||||
/**
|
||||
* @var CollectionFactory
|
||||
*/
|
||||
private $collectionFactory;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param Filter $filter
|
||||
* @param CollectionFactory $collectionFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Filter $filter,
|
||||
CollectionFactory $collectionFactory
|
||||
) {
|
||||
$this->filter = $filter;
|
||||
$this->collectionFactory = $collectionFactory;
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute action
|
||||
*
|
||||
* @return \Magento\Backend\Model\View\Result\Redirect
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$collection = $this->filter->getCollection($this->collectionFactory->create());
|
||||
$accountsCount = 0;
|
||||
foreach ($collection->getItems() as $account) {
|
||||
$this->deleteObj($account);
|
||||
++$accountsCount;
|
||||
}
|
||||
$this->messageManager->addSuccess(__('A total of %1 record(s) have been deleted.', $accountsCount));
|
||||
|
||||
return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('*/*/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object.
|
||||
*
|
||||
* @param mixed $object
|
||||
* @return void
|
||||
*/
|
||||
private function deleteObj($object)
|
||||
{
|
||||
$object->delete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace JR\NetSuite\Controller\Adminhtml\RmaQueue;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Framework\App\Action\HttpGetActionInterface;
|
||||
use Magento\Framework\View\Result\Page;
|
||||
use JR\NetSuite\Model\ResourceModel\RmaQueueFactory;
|
||||
|
||||
/**
|
||||
* Class ViewJson
|
||||
*/
|
||||
class View extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'JR_NetSuite::rmaqueue';
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory = false;
|
||||
|
||||
/**
|
||||
* @var RmaQueueFactory
|
||||
*/
|
||||
protected $rmaQueueFactory;
|
||||
|
||||
/**
|
||||
* Index constructor.
|
||||
*
|
||||
* @param \Magento\Backend\App\Action\Context $context
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
RmaQueueFactory $rmaQueueFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->rmaQueueFactory = $rmaQueueFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the page defined in json form
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
|
||||
$entity_id = $this->getRequest()->getParam('entity_id');
|
||||
|
||||
if ($entity_id > 0) {
|
||||
$prductQueue = $this->rmaQueueFactory->create()->load($entity_id);
|
||||
if ($prductQueue) {
|
||||
$resJson = $prductQueue->getData('data');
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(200);
|
||||
exit($resJson);
|
||||
}
|
||||
|
||||
}
|
||||
$this->messageManager->addErrorMessage(__('No record found!'));
|
||||
$this->_redirect('jrnetsuite/rmaqueue/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed('JR_NetSuite::rma_queue');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user