Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - magento#17080: Removed double occurrences from files (by @mage2pratik)
 - magento#17045: [Forwardport] Fixing annotations for some methods. (by @torhoehn)
 - magento#17052: [Forwardport] Fix for Magnifier in inside mode (by @torhoehn)
 - magento#16925: [Up Port] Replacing Usage of Deprecated Methods for Message Manager. (by @tiagosampaio)
 - magento#17055: [Forwardport] Credit memo email template file: fixing incorrect object type error (by @torhoehn)
 - magento#17028: [Forwardport] Fixes Black color coding standard. (by @chirag-wagento)
 - magento#17106: [Forwardport] Slight Changes to Code (by @mage2pratik)
 - magento#17107: [Forwardport] Reduce lengthy code of LoginPost (by @mage2pratik)


Fixed GitHub Issues:
 - magento#4977: Magnifier doesn't work with mode set to inner (reported by @theycallmepepper) has been fixed in magento#17052 by @torhoehn in 2.3-develop branch
   Related commits:
     1. 1db38b0
  • Loading branch information
magento-engcom-team authored Jul 25, 2018
2 parents 54d065a + 0f3e34d commit c268006
Show file tree
Hide file tree
Showing 76 changed files with 334 additions and 306 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ public function execute()
$this->_eventManager->dispatch('catalog_controller_category_delete', ['category' => $category]);
$this->_auth->getAuthStorage()->setDeletedPath($category->getPath());
$this->categoryRepository->delete($category);
$this->messageManager->addSuccess(__('You deleted the category.'));
$this->messageManager->addSuccessMessage(__('You deleted the category.'));
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
return $resultRedirect->setPath('catalog/*/edit', ['_current' => true]);
} catch (\Exception $e) {
$this->messageManager->addError(__('Something went wrong while trying to delete the category.'));
$this->messageManager->addErrorMessage(__('Something went wrong while trying to delete the category.'));
return $resultRedirect->setPath('catalog/*/edit', ['_current' => true]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function _validateProducts()
}

if ($error) {
$this->messageManager->addError($error);
$this->messageManager->addErrorMessage($error);
}

return !$error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function execute()
$this->_eventManager->dispatch('catalog_product_to_website_change', ['products' => $productIds]);
}

$this->messageManager->addSuccess(
$this->messageManager->addSuccessMessage(
__('A total of %1 record(s) were updated.', count($this->attributeHelper->getProductIds()))
);

Expand All @@ -205,9 +205,9 @@ public function execute()
$this->_productPriceIndexerProcessor->reindexList($this->attributeHelper->getProductIds());
}
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException(
$this->messageManager->addExceptionMessage(
$e,
__('Something went wrong while updating the product(s) attributes.')
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function execute()
$response->setError(true);
$response->setMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException(
$this->messageManager->addExceptionMessage(
$e,
__('Something went wrong while updating the product(s) attributes.')
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ public function execute()
// entity type check
$model->load($id);
if ($model->getEntityTypeId() != $this->_entityTypeId) {
$this->messageManager->addError(__('We can\'t delete the attribute.'));
$this->messageManager->addErrorMessage(__('We can\'t delete the attribute.'));
return $resultRedirect->setPath('catalog/*/');
}

try {
$model->delete();
$this->messageManager->addSuccess(__('You deleted the product attribute.'));
$this->messageManager->addSuccessMessage(__('You deleted the product attribute.'));
return $resultRedirect->setPath('catalog/*/');
} catch (\Exception $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
return $resultRedirect->setPath(
'catalog/*/edit',
['attribute_id' => $this->getRequest()->getParam('attribute_id')]
);
}
}
$this->messageManager->addError(__('We can\'t find an attribute to delete.'));
$this->messageManager->addErrorMessage(__('We can\'t find an attribute to delete.'));
return $resultRedirect->setPath('catalog/*/');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public function execute()
$model->load($id);

if (!$model->getId()) {
$this->messageManager->addError(__('This attribute no longer exists.'));
$this->messageManager->addErrorMessage(__('This attribute no longer exists.'));
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setPath('catalog/*/');
}

// entity type check
if ($model->getEntityTypeId() != $this->_entityTypeId) {
$this->messageManager->addError(__('This attribute cannot be edited.'));
$this->messageManager->addErrorMessage(__('This attribute cannot be edited.'));
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setPath('catalog/*/');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public function execute()
$product = $this->productBuilder->build($this->getRequest());
try {
$newProduct = $this->productCopier->copy($product);
$this->messageManager->addSuccess(__('You duplicated the product.'));
$this->messageManager->addSuccessMessage(__('You duplicated the product.'));
$resultRedirect->setPath('catalog/*/edit', ['_current' => true, 'id' => $newProduct->getId()]);
} catch (\Exception $e) {
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
$resultRedirect->setPath('catalog/*/edit', ['_current' => true]);
}
return $resultRedirect;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ public function execute()
if (($productId && !$product->getEntityId())) {
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
$this->messageManager->addError(__('This product doesn\'t exist.'));
$this->messageManager->addErrorMessage(__('This product doesn\'t exist.'));
return $resultRedirect->setPath('catalog/*/');
} elseif ($productId === 0) {
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
$this->messageManager->addError(__('Invalid product id. Should be numeric value greater than 0'));
$this->messageManager->addErrorMessage(__('Invalid product id. Should be numeric value greater than 0'));
return $resultRedirect->setPath('catalog/*/');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public function execute()
);

if ($model->itemExists()) {
$this->messageManager->addError(__('A group with the same name already exists.'));
$this->messageManager->addErrorMessage(__('A group with the same name already exists.'));
} else {
try {
$model->save();
} catch (\Exception $e) {
$this->messageManager->addError(__('Something went wrong while saving this group.'));
$this->messageManager->addErrorMessage(__('Something went wrong while saving this group.'));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public function execute()
$resultRedirect = $this->resultRedirectFactory->create();
try {
$this->attributeSetRepository->deleteById($setId);
$this->messageManager->addSuccess(__('The attribute set has been removed.'));
$this->messageManager->addSuccessMessage(__('The attribute set has been removed.'));
$resultRedirect->setPath('catalog/*/');
} catch (\Exception $e) {
$this->messageManager->addError(__('We can\'t delete this set right now.'));
$this->messageManager->addErrorMessage(__('We can\'t delete this set right now.'));
$resultRedirect->setUrl($this->_redirect->getRedirectUrl($this->getUrl('*')));
}
return $resultRedirect;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ public function execute()
$model->initFromSkeleton($this->getRequest()->getParam('skeleton_set'));
}
$model->save();
$this->messageManager->addSuccess(__('You saved the attribute set.'));
$this->messageManager->addSuccessMessage(__('You saved the attribute set.'));
} catch (\Magento\Framework\Exception\AlreadyExistsException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
$hasError = true;
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
$hasError = true;
} catch (\Exception $e) {
$this->messageManager->addException($e, __('Something went wrong while saving the attribute set.'));
$this->messageManager->addExceptionMessage($e, __('Something went wrong while saving the attribute set.'));
$hasError = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function execute()
$response->setError(true);
$response->setMessages([$e->getMessage()]);
} catch (\Exception $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
$layout = $this->layoutFactory->create();
$layout->initMessages();
$response->setError(true);
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Catalog/Controller/Product/Compare/Clear.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public function execute()

try {
$items->clear();
$this->messageManager->addSuccess(__('You cleared the comparison list.'));
$this->messageManager->addSuccessMessage(__('You cleared the comparison list.'));
$this->_objectManager->get(\Magento\Catalog\Helper\Product\Compare::class)->calculate();
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addException($e, __('Something went wrong clearing the comparison list.'));
$this->messageManager->addExceptionMessage($e, __('Something went wrong clearing the comparison list.'));
}

/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function execute()
$item->delete();
$productName = $this->_objectManager->get(\Magento\Framework\Escaper::class)
->escapeHtml($product->getName());
$this->messageManager->addSuccess(
$this->messageManager->addSuccessMessage(
__('You removed product %1 from the comparison list.', $productName)
);
$this->_eventManager->dispatch(
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Catalog/Controller/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,16 @@ public function execute()

if ($this->getRequest()->isPost() && $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED)) {
$product = $this->_initProduct();

if (!$product) {
return $this->noProductRedirect();
}

if ($specifyOptions) {
$notice = $product->getTypeInstance()->getSpecifyOptionMessage();
$this->messageManager->addNotice($notice);
$this->messageManager->addNoticeMessage($notice);
}

if ($this->getRequest()->isAjax()) {
$this->getResponse()->representJson(
$this->_objectManager->get(\Magento\Framework\Json\Helper\Data::class)->jsonEncode([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function getMainTable(int $storeId)
public function createTablesForStore(int $storeId)
{
$mainTableName = $this->getMainTable($storeId);
//Create index table for store based on on main replica table
//Create index table for store based on main replica table
//Using main replica table is necessary for backward capability and TableResolver plugin work
$this->createTable(
$this->getTable(AbstractAction::MAIN_INDEX_TABLE . $this->additionalTableSuffix),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected function _createItem($label, $value, $count = 0)
}

/**
* Get all product ids from from collection with applied filters
* Get all product ids from collection with applied filters
*
* @return array
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ protected function _saveValueTitles(\Magento\Framework\Model\AbstractModel $obje
}

/**
* Get first col from from first row for option table
* Get first col from first row for option table
*
* @param string $tableName
* @param int $optionId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ protected function _saveValueTitles(AbstractModel $object)
}

/**
* Get first col from from first row for option table
* Get first col from first row for option table
*
* @param string $tableName
* @param int $optionId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ define([
},

/**
* Has weight swither
* Has weight switcher
* @returns {*}
*/
hasWeightSwither: function () {
hasWeightSwitcher: function () {
return this.$weightSwitcher().is(':visible');
},

Expand Down Expand Up @@ -107,7 +107,7 @@ define([
'Magento_Catalog/js/product/weight-handler': function () {
this.bindAll();

if (this.hasWeightSwither()) {
if (this.hasWeightSwitcher()) {
this.switchWeight();
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<waitForPageLoad stepKey="waitForPriceRulePage"/>
<click stepKey="addNewRule" selector="{{AdminGridMainControls.add}}"/>

<!-- Fill the form according the the attributes of the entity -->
<!-- Fill the form according the attributes of the entity -->
<fillField stepKey="fillName" selector="{{AdminNewCatalogPriceRule.ruleName}}" userInput="{{catalogRule.name}}"/>
<fillField stepKey="fillDescription" selector="{{AdminNewCatalogPriceRule.description}}" userInput="{{catalogRule.description}}"/>
<selectOption stepKey="selectSite" selector="{{AdminNewCatalogPriceRule.websites}}" userInput="{{catalogRule.website_ids[0]}}"/>
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Cms/Controller/Adminhtml/Block/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ public function execute()
$model->load($id);
$model->delete();
// display success message
$this->messageManager->addSuccess(__('You deleted the block.'));
$this->messageManager->addSuccessMessage(__('You deleted the block.'));
// go to grid
return $resultRedirect->setPath('*/*/');
} catch (\Exception $e) {
// display error message
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
// go back to edit form
return $resultRedirect->setPath('*/*/edit', ['block_id' => $id]);
}
}
// display error message
$this->messageManager->addError(__('We can\'t find a block to delete.'));
$this->messageManager->addErrorMessage(__('We can\'t find a block to delete.'));
// go to grid
return $resultRedirect->setPath('*/*/');
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Cms/Controller/Adminhtml/Block/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function execute()
if ($id) {
$model->load($id);
if (!$model->getId()) {
$this->messageManager->addError(__('This block no longer exists.'));
$this->messageManager->addErrorMessage(__('This block no longer exists.'));
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setPath('*/*/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function __construct(

/**
* @return \Magento\Framework\Controller\ResultInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function execute()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function execute()
$block->delete();
}

$this->messageManager->addSuccess(__('A total of %1 record(s) have been deleted.', $collectionSize));
$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);
Expand Down
21 changes: 14 additions & 7 deletions app/code/Magento/Cms/Controller/Adminhtml/Page/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,42 @@ public function execute()
$id = $this->getRequest()->getParam('page_id');
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();

if ($id) {
$title = "";
try {
// init model and delete
$model = $this->_objectManager->create(\Magento\Cms\Model\Page::class);
$model->load($id);

$title = $model->getTitle();
$model->delete();

// display success message
$this->messageManager->addSuccess(__('The page has been deleted.'));
$this->messageManager->addSuccessMessage(__('The page has been deleted.'));

// go to grid
$this->_eventManager->dispatch(
'adminhtml_cmspage_on_delete',
['title' => $title, 'status' => 'success']
);
$this->_eventManager->dispatch('adminhtml_cmspage_on_delete', [
'title' => $title,
'status' => 'success'
]);

return $resultRedirect->setPath('*/*/');
} catch (\Exception $e) {
$this->_eventManager->dispatch(
'adminhtml_cmspage_on_delete',
['title' => $title, 'status' => 'fail']
);
// display error message
$this->messageManager->addError($e->getMessage());
$this->messageManager->addErrorMessage($e->getMessage());
// go back to edit form
return $resultRedirect->setPath('*/*/edit', ['page_id' => $id]);
}
}

// display error message
$this->messageManager->addError(__('We can\'t find a page to delete.'));
$this->messageManager->addErrorMessage(__('We can\'t find a page to delete.'));

// go to grid
return $resultRedirect->setPath('*/*/');
}
Expand Down
Loading

0 comments on commit c268006

Please sign in to comment.