ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\Logviewer;
|
||||
|
||||
use Magento\Framework\App\Action\Action;
|
||||
use Magento\Framework\App\Action\Context;
|
||||
use Magento\Framework\App\Filesystem\DirectoryList;
|
||||
use Caratlane\NetSuite\Helper\IntegrationConstants;
|
||||
|
||||
class ClearLogs extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::log';
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\Response\Http\FileFactory
|
||||
*/
|
||||
protected $fileFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Filesystem\Driver\File
|
||||
*/
|
||||
protected $fileDriver;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Filesystem
|
||||
*/
|
||||
protected $fileSystem;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
|
||||
*/
|
||||
protected $timezone;
|
||||
|
||||
public function __construct(
|
||||
\Magento\Backend\App\Action\Context $context,
|
||||
\Magento\Framework\App\Response\Http\FileFactory $fileFactory,
|
||||
\Magento\Framework\Filesystem\Driver\File $fileDriver,
|
||||
\Magento\Framework\Filesystem $fileSystem,
|
||||
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
|
||||
) {
|
||||
$this->fileFactory = $fileFactory;
|
||||
$this->fileDriver = $fileDriver;
|
||||
$this->fileSystem = $fileSystem;
|
||||
$this->timezone = $timezone;
|
||||
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$contents = '';
|
||||
$today = $this->timezone->date()->format('d-m-Y');
|
||||
$date = $this->getRequest()->getParam('date');
|
||||
$logfile = $this->getRequest()->getParam('logfile');
|
||||
|
||||
if ($date == "") {
|
||||
$date = $today;
|
||||
}
|
||||
|
||||
if ($logfile == '') {
|
||||
$this->messageManager->addErrorMessage(__('Please select log first and try again!'));
|
||||
$this->_redirect('caratlane/logviewer/index');
|
||||
return;
|
||||
}
|
||||
|
||||
$filePath = IntegrationConstants::NETSUITE_LOG_DIR.$date.'/'.$logfile;
|
||||
$varDir = $this->fileSystem->getDirectoryRead(DirectoryList::VAR_DIR);
|
||||
$fileAbsolutePath = $varDir->getAbsolutePath($filePath);
|
||||
|
||||
if ($this->fileDriver->isExists($fileAbsolutePath)) {
|
||||
$f = $this->fileDriver->fileOpen($fileAbsolutePath, "r+");
|
||||
if ($f !== false) {
|
||||
ftruncate($f, 0);
|
||||
$this->fileDriver->fileClose($f);
|
||||
}
|
||||
$this->messageManager->addSuccessMessage(__('Logfile cleaned successfully.'));
|
||||
$this->_redirect('caratlane/logviewer/index');
|
||||
} else {
|
||||
$this->messageManager->addErrorMessage(__('Log file not exist!'));
|
||||
$this->_redirect('caratlane/logviewer/index');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed(static::MENU_ID);
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\Logviewer;
|
||||
|
||||
use Magento\Framework\App\Action\Action;
|
||||
use Magento\Framework\App\Action\Context;
|
||||
use Magento\Framework\App\Filesystem\DirectoryList;
|
||||
use Caratlane\NetSuite\Helper\IntegrationConstants;
|
||||
|
||||
/**
|
||||
* DownloadLogs log from controller
|
||||
*/
|
||||
class DownloadLogs extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::log';
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\Response\Http\FileFactory
|
||||
*/
|
||||
protected $fileFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Filesystem\Driver\File
|
||||
*/
|
||||
protected $fileDriver;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Filesystem
|
||||
*/
|
||||
protected $fileSystem;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
|
||||
*/
|
||||
protected $timezone;
|
||||
|
||||
public function __construct(
|
||||
\Magento\Backend\App\Action\Context $context,
|
||||
\Magento\Framework\App\Response\Http\FileFactory $fileFactory,
|
||||
\Magento\Framework\Filesystem\Driver\File $fileDriver,
|
||||
\Magento\Framework\Filesystem $fileSystem,
|
||||
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
|
||||
) {
|
||||
$this->fileFactory = $fileFactory;
|
||||
$this->fileDriver = $fileDriver;
|
||||
$this->fileSystem = $fileSystem;
|
||||
$this->timezone = $timezone;
|
||||
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$today = $this->timezone->date()->format('d-m-Y');
|
||||
$date = $this->getRequest()->getParam('date');
|
||||
$logfile = $this->getRequest()->getParam('logfile');
|
||||
|
||||
if ($date == "") {
|
||||
$date = $today;
|
||||
}
|
||||
|
||||
if ($logfile == '') {
|
||||
$this->messageManager->addErrorMessage(__('Please select log first and try again!'));
|
||||
$this->_redirect('caratlane/logviewer/index');
|
||||
return;
|
||||
}
|
||||
|
||||
$filePath = IntegrationConstants::NETSUITE_LOG_DIR.$date.'/'.$logfile;
|
||||
$varDir = $this->fileSystem->getDirectoryRead(DirectoryList::VAR_DIR);
|
||||
$fileAbsolutePath = $varDir->getAbsolutePath($filePath);
|
||||
|
||||
if ($this->fileDriver->isExists($fileAbsolutePath)) {
|
||||
$content['type'] = 'filename';
|
||||
$content['value'] = $fileAbsolutePath;
|
||||
$content['rm'] = 0;
|
||||
return $this->fileFactory->create($logfile, $content, DirectoryList::VAR_DIR);
|
||||
} else {
|
||||
$this->messageManager->addErrorMessage(__('Log file not exist!'));
|
||||
$this->_redirect('caratlane/logviewer/index');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed(static::MENU_ID);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\Logviewer;
|
||||
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\App\Action\HttpGetActionInterface;
|
||||
use Magento\Framework\View\Result\Page;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
/**
|
||||
* Class Index from controller
|
||||
*/
|
||||
class Index extends Action implements HttpGetActionInterface
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::log';
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* Index constructor.
|
||||
*
|
||||
* @param Context $context
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
PageFactory $resultPageFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the page defined in view/adminhtml/layout/caratlane_logviewer_index.xml
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$resultPage->setActiveMenu(static::MENU_ID);
|
||||
$resultPage->getConfig()->getTitle()->prepend(__('Debug Log Viewer'));
|
||||
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
/**
|
||||
* Class ClearHistory from controller
|
||||
*/
|
||||
class ClearHistory extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::log';
|
||||
|
||||
protected $resultPageFactory;
|
||||
|
||||
public function __construct(
|
||||
\Magento\Backend\App\Action\Context $context,
|
||||
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
|
||||
\Caratlane\NetSuite\Model\NetSuiteFactory $masterlogsFactory
|
||||
) {
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
$this->masterlogsFactory = $masterlogsFactory;
|
||||
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$model = $this->masterlogsFactory->create();
|
||||
if (!count($model->getCollection()->getData())) {
|
||||
$this->messageManager->addErrorMessage(__('There is no records to delete.'));
|
||||
$this->_redirect('caratlane/netsuite/index');
|
||||
return;
|
||||
}
|
||||
|
||||
if (count($model->getCollection()->getData())) {
|
||||
$connection = $model->getCollection()->getConnection();
|
||||
$tableName = $model->getCollection()->getMainTable();
|
||||
$connection->truncateTable($tableName);
|
||||
}
|
||||
|
||||
$this->messageManager->addSuccessMessage(__('History has been removed successfully.'));
|
||||
$this->_redirect('caratlane/netsuite/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed(static::MENU_ID);
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
/**
|
||||
* Class ClearTrackOrderHistory
|
||||
*/
|
||||
class ClearOrderstatusHistory extends \Magento\Backend\App\Action
|
||||
{
|
||||
|
||||
const MENU_ID = 'Caratlane_NetSuite::orderupdate';
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\View\Result\PageFactory
|
||||
*/
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* @var \Caratlane\NetSuite\Model\NetSuiteOrdersUpdateFactory
|
||||
*/
|
||||
protected $netSuiteOrdersUpdate;
|
||||
|
||||
public function __construct(
|
||||
\Magento\Backend\App\Action\Context $context,
|
||||
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
|
||||
\Caratlane\NetSuite\Model\NetSuiteOrdersUpdateFactory $netSuiteOrdersUpdate
|
||||
) {
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
$this->netSuiteOrdersUpdate = $netSuiteOrdersUpdate;
|
||||
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$model = $this->netSuiteOrdersUpdate->create();
|
||||
if (!count($model->getCollection()->getData())) {
|
||||
$this->messageManager->addErrorMessage(__('There is no records to delete.'));
|
||||
$this->_redirect('caratlane/netsuite/orderupdate');
|
||||
return;
|
||||
}
|
||||
|
||||
if (count($model->getCollection()->getData())) {
|
||||
$connection = $model->getCollection()->getConnection();
|
||||
$tableName = $model->getCollection()->getMainTable();
|
||||
$connection->truncateTable($tableName);
|
||||
}
|
||||
|
||||
$this->messageManager->addSuccessMessage(__('History has been removed successfully.'));
|
||||
$this->_redirect('caratlane/netsuite/orderupdate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed(static::MENU_ID);
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
/**
|
||||
* Class ClearShipmentHistory from controller
|
||||
*/
|
||||
class ClearShipmentHistory extends \Magento\Backend\App\Action
|
||||
{
|
||||
|
||||
const MENU_ID = 'Caratlane_NetSuite::createshipment';
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\View\Result\PageFactory
|
||||
*/
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* @var \Caratlane\NetSuite\Model\NetsuiteShipmentsFactory
|
||||
*/
|
||||
protected $netsuiteShipments;
|
||||
|
||||
public function __construct(
|
||||
\Magento\Backend\App\Action\Context $context,
|
||||
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
|
||||
\Caratlane\NetSuite\Model\NetsuiteShipmentsFactory $netsuiteShipments
|
||||
) {
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
$this->netsuiteShipments = $netsuiteShipments;
|
||||
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$model = $this->netsuiteShipments->create();
|
||||
if (!count($model->getCollection()->getData())) {
|
||||
$this->messageManager->addErrorMessage(__('There is no records to delete.'));
|
||||
$this->_redirect('caratlane/netsuite/createshipments');
|
||||
return;
|
||||
}
|
||||
|
||||
if (count($model->getCollection()->getData())) {
|
||||
$connection = $model->getCollection()->getConnection();
|
||||
$tableName = $model->getCollection()->getMainTable();
|
||||
$connection->truncateTable($tableName);
|
||||
}
|
||||
|
||||
$this->messageManager->addSuccessMessage(__('History has been removed successfully.'));
|
||||
$this->_redirect('caratlane/netsuite/createshipments');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed(static::MENU_ID);
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Caratlane
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Caratlane.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.Caratlane.com/LICENSE.txt
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to any file if you wish to upgrade this extension
|
||||
* version in the future.
|
||||
*
|
||||
* @category Caratlane
|
||||
* @package Caratlane_NetSuite
|
||||
* @copyright Copyright (c) Caratlane (https://www.Caratlane.com/)
|
||||
* @license https://www.Caratlane.com/LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\App\Action\HttpGetActionInterface;
|
||||
use Magento\Framework\View\Result\Page;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
class CreateShipments extends Action implements HttpGetActionInterface
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::createshipment';
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* Index constructor.
|
||||
*
|
||||
* @param Context $context
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
PageFactory $resultPageFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the page defined in view/adminhtml/layout/netsuite_logviewer_index.xml
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$resultPage->setActiveMenu(static::MENU_ID);
|
||||
$resultPage->getConfig()->getTitle()->prepend(__('Shipment Logs'));
|
||||
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
use Caratlane\NetSuite\Model\NetsuiteShipments;
|
||||
|
||||
/**
|
||||
* Class CreateShippmentView from controller
|
||||
*/
|
||||
class CreateShippmentView extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::createshipment';
|
||||
|
||||
/**
|
||||
* @var Caratlane\NetSuite\Model\NetsuiteShipments
|
||||
*/
|
||||
protected $netsuiteShipments;
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory = false;
|
||||
|
||||
/**
|
||||
* Index constructor.
|
||||
*
|
||||
* @param \Magento\Backend\App\Action\Context $context
|
||||
* @param NetsuiteShipments $netsuiteShipments
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
NetsuiteShipments $netsuiteShipments,
|
||||
\Magento\Backend\App\Action\Context $context
|
||||
) {
|
||||
$this->netsuiteShipments = $netsuiteShipments;
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the page defined in view/adminhtml/layout/netsuit_logviewer_index.xml
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$entity_id = $this->getRequest()->getParam('entity_id');
|
||||
if ($entity_id > 0) {
|
||||
$model = $this->netsuiteShipments->load($entity_id);
|
||||
if ($model) {
|
||||
$resJson = $model->getData('json_data');
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(200);
|
||||
exit($resJson);
|
||||
}
|
||||
}
|
||||
$this->messageManager->addErrorMessage(__('No record found!'));
|
||||
$this->_redirect('caratlane/netsuite/createshipments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules
|
||||
* @return Int
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed('Caratlane_NetSuite::createshipment');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\App\Action\HttpGetActionInterface;
|
||||
use Magento\Framework\View\Result\Page;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
class Index extends Action implements HttpGetActionInterface
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::log';
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* Index constructor.
|
||||
*
|
||||
* @param Context $context
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
PageFactory $resultPageFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the page defined in view/adminhtml/layout/caratlane_netswite_index.xml
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$resultPage->setActiveMenu(static::MENU_ID);
|
||||
$resultPage->getConfig()->getTitle()->prepend(__('NetSuite: Orders Logs'));
|
||||
|
||||
return $resultPage;
|
||||
}
|
||||
public function pushOrders($ordersJsonData)
|
||||
{
|
||||
$this->helper->pushCurlData($ordersJsonData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Framework\App\Action\HttpPostActionInterface;
|
||||
use Magento\Framework\Controller\ResultFactory;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Ui\Component\MassAction\Filter;
|
||||
use Caratlane\NetSuite\Model\ResourceModel\NetSuite\CollectionFactory;
|
||||
|
||||
/**
|
||||
* Class MassDelete from controller
|
||||
*/
|
||||
class MassDelete extends \Magento\Backend\App\Action implements HttpPostActionInterface
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::log';
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @throws \Magento\Framework\Exception\LocalizedException|\Exception
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$collection = $this->filter->getCollection($this->collectionFactory->create());
|
||||
$collectionSize = $collection->getSize();
|
||||
|
||||
foreach ($collection as $page) {
|
||||
$page->delete();
|
||||
}
|
||||
|
||||
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been deleted.', $collectionSize));
|
||||
|
||||
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
|
||||
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
|
||||
|
||||
return $resultRedirect->setPath('*/*/');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Caratlane
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Caratlane.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.Caratlane.com/LICENSE.txt
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to any file if you wish to upgrade this extension
|
||||
* version in the future.
|
||||
*
|
||||
* @category Caratlane
|
||||
* @package Caratlane_NetSuite
|
||||
* @copyright Copyright (c) Caratlane (https://www.Caratlane.com/)
|
||||
* @license https://www.Caratlane.com/LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\App\Action\HttpGetActionInterface;
|
||||
use Magento\Framework\View\Result\Page;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
class OrderUpdate extends Action implements HttpGetActionInterface
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::orderupdate';
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* Index constructor.
|
||||
*
|
||||
* @param Context $context
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
PageFactory $resultPageFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the page defined in view/adminhtml/layout/netsuite_logviewer_index.xml
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$resultPage->setActiveMenu(static::MENU_ID);
|
||||
$resultPage->getConfig()->getTitle()->prepend(__('Order Update Logs'));
|
||||
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Framework\App\Action\HttpPostActionInterface;
|
||||
use Magento\Framework\Controller\ResultFactory;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Ui\Component\MassAction\Filter;
|
||||
use Caratlane\NetSuite\Model\ResourceModel\NetSuiteOrdersUpdate\CollectionFactory;
|
||||
|
||||
/**
|
||||
* Class OrderUpdateMassDelete from controller
|
||||
*/
|
||||
class OrderupdateMassDelete extends \Magento\Backend\App\Action implements HttpPostActionInterface
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::orderupdate';
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @throws \Magento\Framework\Exception\LocalizedException|\Exception
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$collection = $this->filter->getCollection($this->collectionFactory->create());
|
||||
$collectionSize = $collection->getSize();
|
||||
|
||||
foreach ($collection as $page) {
|
||||
$page->delete();
|
||||
}
|
||||
|
||||
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been deleted.', $collectionSize));
|
||||
|
||||
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
|
||||
$this->_redirect('caratlane/netsuite/orderupdate');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
/**
|
||||
* Class ViewJson
|
||||
*/
|
||||
class ResponseView extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::log';
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory = false;
|
||||
|
||||
/**
|
||||
* Index constructor.
|
||||
*
|
||||
* @param \Magento\Backend\App\Action\Context $context
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
/*public function __construct(
|
||||
\Magento\Backend\App\Action\Context $context
|
||||
) {
|
||||
parent::__construct($context);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Load the page to view response in json format
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$entity_id = $this->getRequest()->getParam('entity_id');
|
||||
if ($entity_id > 0) {
|
||||
$model = $this->_objectManager->create(\Caratlane\NetSuite\Model\NetSuite::class)->load($entity_id);
|
||||
if ($model) {
|
||||
$resJson = $model->getData('response_info');
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(200);
|
||||
exit($resJson);
|
||||
}
|
||||
}
|
||||
$this->messageManager->addErrorMessage(__('No record found!'));
|
||||
$this->_redirect('caratlane/netsuite/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules
|
||||
* @return Int
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed('Caratlane_NetSuite::log');
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Framework\App\Action\HttpPostActionInterface;
|
||||
use Magento\Framework\Controller\ResultFactory;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Ui\Component\MassAction\Filter;
|
||||
use Caratlane\NetSuite\Model\ResourceModel\NetsuiteShipments\CollectionFactory;
|
||||
|
||||
/**
|
||||
* Class ShipmentMassDelete from controller
|
||||
*/
|
||||
class ShipmentMassDelete extends \Magento\Backend\App\Action implements HttpPostActionInterface
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::createshipment';
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @throws \Magento\Framework\Exception\LocalizedException|\Exception
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$collection = $this->filter->getCollection($this->collectionFactory->create());
|
||||
$collectionSize = $collection->getSize();
|
||||
|
||||
foreach ($collection as $page) {
|
||||
$page->delete();
|
||||
}
|
||||
|
||||
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been deleted.', $collectionSize));
|
||||
|
||||
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
|
||||
$this->_redirect('caratlane/netsuite/createshipments');
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Framework\App\Action\HttpPostActionInterface;
|
||||
use Magento\Framework\Controller\ResultFactory;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Ui\Component\MassAction\Filter;
|
||||
use Caratlane\NetSuite\Model\ResourceModel\NetsuiteUpdateinvoicepdf\CollectionFactory;
|
||||
|
||||
/**
|
||||
* Class ShipmentMassDelete from controller
|
||||
*/
|
||||
class UpdateinvoiceMassDelete extends \Magento\Backend\App\Action implements HttpPostActionInterface
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::updateinvoicepdf';
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @throws \Magento\Framework\Exception\LocalizedException|\Exception
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$collection = $this->filter->getCollection($this->collectionFactory->create());
|
||||
$collectionSize = $collection->getSize();
|
||||
|
||||
foreach ($collection as $page) {
|
||||
$page->delete();
|
||||
}
|
||||
|
||||
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been deleted.', $collectionSize));
|
||||
|
||||
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
|
||||
$this->_redirect('caratlane/netsuite/updateinvoicepdf');
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Caratlane
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Caratlane.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.Caratlane.com/LICENSE.txt
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to any file if you wish to upgrade this extension
|
||||
* version in the future.
|
||||
*
|
||||
* @category Caratlane
|
||||
* @package Caratlane_NetSuite
|
||||
* @copyright Copyright (c) Caratlane (https://www.Caratlane.com/)
|
||||
* @license https://www.Caratlane.com/LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\App\Action\HttpGetActionInterface;
|
||||
use Magento\Framework\View\Result\Page;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
class Updateinvoicepdf extends Action implements HttpGetActionInterface
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::updateinvoicepdf';
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* Index constructor.
|
||||
*
|
||||
* @param Context $context
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
PageFactory $resultPageFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the page defined in view/adminhtml/layout/netsuite_logviewer_index.xml
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$resultPage->setActiveMenu(static::MENU_ID);
|
||||
$resultPage->getConfig()->getTitle()->prepend(__('Update Invoice PDF'));
|
||||
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
use Caratlane\NetSuite\Model\NetsuiteUpdateinvoicepdf;
|
||||
|
||||
/**
|
||||
* Class CreateShippmentView
|
||||
*/
|
||||
class Updateinvoicepdfview extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::updateinvoicepdf';
|
||||
|
||||
/**
|
||||
* @var Caratlane\NetSuite\Model\NetsuiteUpdateinvoicepdf
|
||||
*/
|
||||
protected $netsuiteUpdateinvoicepdf;
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory = false;
|
||||
|
||||
/**
|
||||
* Index constructor.
|
||||
*
|
||||
* @param \Magento\Backend\App\Action\Context $context
|
||||
* @param NetsuiteUpdateinvoicepdf $netsuiteUpdateinvoicepdf
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
public function __construct(
|
||||
NetsuiteUpdateinvoicepdf $netsuiteUpdateinvoicepdf,
|
||||
\Magento\Backend\App\Action\Context $context
|
||||
) {
|
||||
$this->netsuiteUpdateinvoicepdf = $netsuiteUpdateinvoicepdf;
|
||||
parent::__construct($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the page defined in view/adminhtml/layout/netsuit_logviewer_index.xml
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$entity_id = $this->getRequest()->getParam('entity_id');
|
||||
if ($entity_id > 0) {
|
||||
$model = $this->netsuiteUpdateinvoicepdf->load($entity_id);
|
||||
if ($model) {
|
||||
$resJson = $model->getData('json_data');
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(200);
|
||||
exit($resJson);
|
||||
}
|
||||
}
|
||||
$this->messageManager->addErrorMessage(__('No record found!'));
|
||||
$this->_redirect('caratlane/netsuite/updateinvoicepdf');
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules
|
||||
* @return Int
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed('Caratlane_NetSuite::updateinvoicepdf');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\NetSuite;
|
||||
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Framework\View\Result\PageFactory;
|
||||
|
||||
/**
|
||||
* Class ViewJson
|
||||
*/
|
||||
class View extends \Magento\Backend\App\Action
|
||||
{
|
||||
const MENU_ID = 'Caratlane_NetSuite::log';
|
||||
|
||||
/**
|
||||
* @var PageFactory
|
||||
*/
|
||||
protected $resultPageFactory = false;
|
||||
|
||||
/**
|
||||
* Index constructor.
|
||||
*
|
||||
* @param \Magento\Backend\App\Action\Context $context
|
||||
* @param PageFactory $resultPageFactory
|
||||
*/
|
||||
/*public function __construct(
|
||||
\Magento\Backend\App\Action\Context $context
|
||||
) {
|
||||
parent::__construct($context);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Load the page defined in json form
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
|
||||
$entity_id = $this->getRequest()->getParam('entity_id');
|
||||
|
||||
if ($entity_id > 0) {
|
||||
$model = $this->_objectManager->create(\Caratlane\NetSuite\Model\NetSuite::class)->load($entity_id);
|
||||
if ($model) {
|
||||
$resJson = $model->getData('request_info');
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(200);
|
||||
exit($resJson);
|
||||
}
|
||||
|
||||
}
|
||||
$this->messageManager->addErrorMessage(__('No record found!'));
|
||||
$this->_redirect('caratlane/netsuite/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules
|
||||
*
|
||||
* @return Int
|
||||
*/
|
||||
protected function _isAllowed()
|
||||
{
|
||||
return $this->_authorization->isAllowed('Caratlane_NetSuite::log');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* @author 18th DigiTech Team
|
||||
* @copyright Copyright (c) 2020 18th DigiTech (https://www.18thdigitech.com)
|
||||
* @package Caratlane_NetSuite
|
||||
*/
|
||||
namespace Caratlane\NetSuite\Controller\Adminhtml\Order;
|
||||
|
||||
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
|
||||
use Magento\Backend\App\Action\Context;
|
||||
use Magento\Ui\Component\MassAction\Filter;
|
||||
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory;
|
||||
use Magento\Sales\Api\OrderManagementInterface;
|
||||
|
||||
class PushNetSuite extends \Magento\Sales\Controller\Adminhtml\Order\AbstractMassAction
|
||||
{
|
||||
/**
|
||||
* @var OrderManagementInterface
|
||||
*/
|
||||
protected $orderManagement;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param Filter $filter
|
||||
* @param CollectionFactory $collectionFactory
|
||||
* @param OrderManagementInterface $orderManagement
|
||||
* @param \Caratlane\NetSuite\Model\NetSuiteFactory $netsuitefactory
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Filter $filter,
|
||||
CollectionFactory $collectionFactory,
|
||||
\Caratlane\NetSuite\Model\NetSuiteFactory $netsuitefactory
|
||||
) {
|
||||
parent::__construct($context, $filter);
|
||||
$this->collectionFactory = $collectionFactory;
|
||||
$this->netsuitefactory = $netsuitefactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hold selected orders
|
||||
*
|
||||
* @param AbstractCollection $collection
|
||||
* @return \Magento\Backend\Model\View\Result\Redirect
|
||||
*/
|
||||
protected function massAction(AbstractCollection $collection)
|
||||
{
|
||||
$countOrder = 0;
|
||||
foreach ($collection->getItems() as $order) {
|
||||
if (!$order->getEntityId()) {
|
||||
continue;
|
||||
}
|
||||
$order->setNetsuiteMaxAttempt(0);
|
||||
$order->setPushToNetsuite(0);
|
||||
$order->setNetsuiteCreatedAt(null);
|
||||
$order->setNetsuiteId(null);
|
||||
$order->save();
|
||||
$countOrder++;
|
||||
}
|
||||
$countNonPushOrder = $collection->count() - $countOrder;
|
||||
|
||||
if ($countNonPushOrder && $countOrder) {
|
||||
$this->messageManager->addError(__('%1 order(s) were not pushed to NetSuite.', $countNonPushOrder));
|
||||
} elseif ($countNonPushOrder) {
|
||||
$this->messageManager->addError(__('No order(s) were reset to NetSuite.'));
|
||||
}
|
||||
|
||||
if ($countOrder) {
|
||||
$this->messageManager->addSuccess(__('Reset %1 order(s) for NetSuite orders.', $countOrder));
|
||||
}
|
||||
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
$resultRedirect->setPath($this->getComponentRefererUrl());
|
||||
return $resultRedirect;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user