![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-tax-import-export/Controller/Adminhtml/Rate/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\TaxImportExport\Controller\Adminhtml\Rate; use Magento\Framework\Controller\ResultFactory; class ImportPost extends \Magento\TaxImportExport\Controller\Adminhtml\Rate { /** * import action from import/export tax * * @return \Magento\Backend\Model\View\Result\Redirect */ public function execute() { $importRatesFile = $this->getRequest()->getFiles('import_rates_file'); if ($this->getRequest()->isPost() && isset($importRatesFile['tmp_name'])) { try { /** @var $importHandler \Magento\TaxImportExport\Model\Rate\CsvImportHandler */ $importHandler = $this->_objectManager->create( \Magento\TaxImportExport\Model\Rate\CsvImportHandler::class ); $importHandler->importFromCsvFile($importRatesFile); $this->messageManager->addSuccess(__('The tax rate has been imported.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Invalid file upload attempt')); } } else { $this->messageManager->addError(__('Invalid file upload attempt')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); $resultRedirect->setUrl($this->_redirect->getRedirectUrl()); return $resultRedirect; } /** * @return bool */ protected function _isAllowed() { return $this->_authorization->isAllowed( 'Magento_Tax::manage_tax' ) || $this->_authorization->isAllowed( 'Magento_TaxImportExport::import_export' ); } }