diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status/Save.php index 89a7b1b8576fd..3456d31b95628 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status/Save.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status/Save.php @@ -8,6 +8,11 @@ class Save extends \Magento\Sales\Controller\Adminhtml\Order\Status { + /** + * @var \Magento\Backend\Model\View\Result\Redirect + */ + private $resultRedirect; + /** * Save status form processing * @@ -17,8 +22,7 @@ public function execute() { $data = $this->getRequest()->getPostValue(); $isNew = $this->getRequest()->getParam('is_new'); - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultRedirectFactory->create(); + $this->resultRedirect = $this->resultRedirectFactory->create(); if ($data) { $statusCode = $this->getRequest()->getParam('status'); @@ -37,35 +41,55 @@ public function execute() $label = $filterManager->stripTags($label); } - $status = $this->_objectManager->create(\Magento\Sales\Model\Order\Status::class)->load($statusCode); - // check if status exist - if ($isNew && $status->getStatus()) { - $this->messageManager->addError(__('We found another order status with the same order status code.')); - $this->_getSession()->setFormData($data); - return $resultRedirect->setPath('sales/*/new'); - } - - $status->setData($data)->setStatus($statusCode); - - try { - $status->save(); - $this->messageManager->addSuccess(__('You saved the order status.')); - return $resultRedirect->setPath('sales/*/'); - } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); - } catch (\Exception $e) { - $this->messageManager->addException( - $e, - __('We can\'t add the order status right now.') - ); + if ($this->updateStatus($isNew, $data, $statusCode) !== false) { + return $this->resultRedirect; } + $this->_getSession()->setFormData($data); if ($isNew) { - return $resultRedirect->setPath('sales/*/new'); - } else { - return $resultRedirect->setPath('sales/*/edit', ['status' => $this->getRequest()->getParam('status')]); + return $this->resultRedirect->setPath('sales/*/new'); } + return $this->resultRedirect->setPath( + 'sales/*/edit', + ['status' => $this->getRequest()->getParam('status')] + ); + } + return $this->resultRedirect->setPath('sales/*/'); + } + + /** + * Update the order status + * + * @param bool $isNew + * @param array $data + * @param string $statusCode + * @return bool + */ + private function updateStatus($isNew, $data, $statusCode) + { + $status = $this->_objectManager->create(\Magento\Sales\Model\Order\Status::class)->load($statusCode); + // check if status exist + if ($isNew && $status->getStatus()) { + $this->messageManager->addError(__('We found another order status with the same order status code.')); + $this->_getSession()->setFormData($data); + return $this->resultRedirect->setPath('sales/*/new'); + } + + $status->setData($data)->setStatus($statusCode); + + try { + $status->save(); + $this->messageManager->addSuccess(__('You saved the order status.')); + return $this->resultRedirect->setPath('sales/*/'); + } catch (\Magento\Framework\Exception\LocalizedException $e) { + $this->messageManager->addError($e->getMessage()); + } catch (\Exception $e) { + $this->messageManager->addException( + $e, + __('We can\'t add the order status right now.') + ); } - return $resultRedirect->setPath('sales/*/'); + + return false; } } diff --git a/app/code/Magento/Theme/Model/Design/Config/Validator.php b/app/code/Magento/Theme/Model/Design/Config/Validator.php index 8890b3997a443..0ffce61c92be4 100644 --- a/app/code/Magento/Theme/Model/Design/Config/Validator.php +++ b/app/code/Magento/Theme/Model/Design/Config/Validator.php @@ -75,20 +75,33 @@ public function validate(DesignConfigInterface $designConfig) } $text = $template->getTemplateText(); $template->revertDesign(); - // Check if template body has a reference to the same config path - if (preg_match_all(Template::CONSTRUCTION_TEMPLATE_PATTERN, $text, $constructions, PREG_SET_ORDER)) { - foreach ($constructions as $construction) { - $configPath = isset($construction[2]) ? $construction[2] : ''; - $params = $this->getParameters($configPath); - if (isset($params['config_path']) && $params['config_path'] == $data['config_path']) { - throw new LocalizedException( - __( - "The %templateName contains an incorrect configuration. The template has " . - "a reference to itself. Either remove or change the reference.", - ["templateName" => $name] - ) - ); - }; + $this->checkTemplateConfiguration($data, $text, $name); + } + } + + /** + * Check if template body has a reference to the same config path + * + * @param array $data + * @param string $text + * @param string $name + * @throws LocalizedException + * @return void + */ + private function checkTemplateConfiguration($data, $text, $name) + { + if (preg_match_all(Template::CONSTRUCTION_TEMPLATE_PATTERN, $text, $constructions, PREG_SET_ORDER)) { + foreach ($constructions as $construction) { + $configPath = isset($construction[2]) ? $construction[2] : ''; + $params = $this->getParameters($configPath); + if (isset($params['config_path']) && $params['config_path'] == $data['config_path']) { + throw new LocalizedException( + __( + "The %templateName contains an incorrect configuration. The template has " . + "a reference to itself. Either remove or change the reference.", + ["templateName" => $name] + ) + ); } } } diff --git a/lib/web/css/docs/docs.css b/lib/web/css/docs/docs.css index 784f101b65ae0..2da7410363b42 100644 --- a/lib/web/css/docs/docs.css +++ b/lib/web/css/docs/docs.css @@ -4187,7 +4187,7 @@ select { color: #000066; } .example-message-4:before { - background: #green; + background: green; width: 30px; content: ''; display: block; @@ -4230,7 +4230,7 @@ select { border: 5px solid transparent; height: 0; width: 0; - border-left-color: #green; + border-left-color: green; left: 30px; } .example-message-4 > *:first-child:after { diff --git a/lib/web/jquery/fileUploader/css/jquery.fileupload-ui.css b/lib/web/jquery/fileUploader/css/jquery.fileupload-ui.css index e36a93df36b57..52f1e013dbb5f 100644 --- a/lib/web/jquery/fileUploader/css/jquery.fileupload-ui.css +++ b/lib/web/jquery/fileUploader/css/jquery.fileupload-ui.css @@ -53,13 +53,13 @@ } /* Fix for IE 6: */ -*html .fileinput-button { +* html .fileinput-button { line-height: 22px; margin: 1px -3px 0 0; } /* Fix for IE 7: */ -*+html .fileinput-button { +* + html .fileinput-button { margin: 1px 0 0 0; }