diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php index 96d204f7400e0..29f7d7227a290 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php @@ -54,9 +54,9 @@ protected function _construct() $this->addButton( 'save_in_new_set', [ - 'label' => __('Save in New Product Template'), + 'label' => __('Save in New Attribute Set'), 'class' => 'save', - 'onclick' => 'saveAttributeInNewSet(\'' . __('Enter Name for New Product Template') . '\')' + 'onclick' => 'saveAttributeInNewSet(\'' . __('Enter Name for New Attribute Set') . '\')' ], 100 ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php index 34025f7fc5bcf..9215bdb305f89 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php @@ -129,7 +129,7 @@ protected function _prepareLayout() 'label' => __('Delete'), 'onclick' => 'deleteConfirm(\'' . $this->escapeJsQuote( __( - 'You are about to delete all products in this product template. ' + 'You are about to delete all products in this attribute set. ' . 'Are you sure you want to do that?' ) ) . '\', \'' . $this->getUrl( @@ -187,7 +187,7 @@ public function getSetFormHtml() */ protected function _getHeader() { - return __("Edit Product Template '%1'", $this->_getAttributeSet()->getAttributeSetName()); + return __("Edit Attribute Set '%1'", $this->_getAttributeSet()->getAttributeSetName()); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php index ab4bcab4dbf1d..ecfdb19e43025 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php @@ -43,7 +43,7 @@ protected function _prepareForm() /** @var \Magento\Framework\Data\Form $form */ $form = $this->_formFactory->create(); - $fieldset = $form->addFieldset('set_name', ['legend' => __('Edit Product Template Name')]); + $fieldset = $form->addFieldset('set_name', ['legend' => __('Edit Attribute Set Name')]); $fieldset->addField( 'attribute_set_name', 'text', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php index 42434c7094c64..f4f6dc467ca0d 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php @@ -57,7 +57,7 @@ protected function _prepareLayout() */ protected function _getHeader() { - return __('Add New Product Template'); + return __('Add New Attribute Set'); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php index cedf419205b6f..a04f09439e1bc 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php @@ -27,7 +27,7 @@ protected function _prepareLayout() 'addButton', 'Magento\Backend\Block\Widget\Button', [ - 'label' => __('Add Product Template'), + 'label' => __('Add Attribute Set'), 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/add') . '\')', 'class' => 'add primary add-set' ] @@ -48,7 +48,7 @@ public function getNewButtonHtml() */ protected function _getHeader() { - return __('Product Templates'); + return __('Attribute Sets'); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php index 5b8bb9a77fa3b..df7a36b961a34 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php @@ -42,7 +42,7 @@ public function __construct( public function getSelectorOptions() { return [ - 'source' => $this->getUrl('catalog/product/suggestProductTemplates'), + 'source' => $this->getUrl('catalog/product/suggestAttributeSets'), 'className' => 'category-select', 'showRecent' => true, 'storageKey' => 'product-template-key', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php index 8f6c08bb52bca..09fbbd9b2a292 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php @@ -249,7 +249,7 @@ protected function _prepareColumns() $this->addColumn( 'set_name', [ - 'header' => __('Product Template'), + 'header' => __('Attribute Set'), 'index' => 'attribute_set_id', 'type' => 'options', 'options' => $sets, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php index 0e87290ec2729..af104d601ac4e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php @@ -243,7 +243,7 @@ protected function _prepareColumns() $this->addColumn( 'set_name', [ - 'header' => __('Product Template'), + 'header' => __('Attribute Set'), 'index' => 'attribute_set_id', 'type' => 'options', 'options' => $sets, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php index cad5aafe5d0cc..2ea563292e69c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php @@ -239,7 +239,7 @@ protected function _prepareColumns() $this->addColumn( 'set_name', [ - 'header' => __('Product Template'), + 'header' => __('Attribute Set'), 'index' => 'attribute_set_id', 'type' => 'options', 'options' => $sets, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php index e6f1225991872..e426c08e70a44 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php @@ -263,7 +263,7 @@ protected function _prepareColumns() $this->addColumn( 'set_name', [ - 'header' => __('Product Template'), + 'header' => __('Attribute Set'), 'index' => 'attribute_set_id', 'type' => 'options', 'options' => $sets, diff --git a/app/code/Magento/Catalog/Block/Product/TemplateSelector.php b/app/code/Magento/Catalog/Block/Product/TemplateSelector.php index 0fa415acf082b..e2cb3d356a6f4 100644 --- a/app/code/Magento/Catalog/Block/Product/TemplateSelector.php +++ b/app/code/Magento/Catalog/Block/Product/TemplateSelector.php @@ -54,7 +54,7 @@ public function __construct( } /** - * Retrieve list of product templates with search part contained in label + * Retrieve list of attribute sets with search part contained in label * * @param string $labelPart * @return array diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php index 7d337411b0a23..26fea5b4039fd 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php @@ -27,7 +27,7 @@ public function __construct( $this->resultJsonFactory = $resultJsonFactory; } /** - * Add attribute to product template + * Add attribute to attribute set * * @return \Magento\Framework\Controller\Result\Json */ diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Add.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Add.php index 81f61ec8362a5..7e4bee7a76913 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Add.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Add.php @@ -37,7 +37,7 @@ public function execute() /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $resultPage->setActiveMenu('Magento_Catalog::catalog_attributes_sets'); - $resultPage->getConfig()->getTitle()->prepend(__('New Product Template')); + $resultPage->getConfig()->getTitle()->prepend(__('New Attribute Set')); $resultPage->addContent( $resultPage->getLayout()->createBlock('Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Toolbar\Add') ); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Delete.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Delete.php index 9849dc6884732..9585bce699f5f 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Delete.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Delete.php @@ -36,7 +36,7 @@ public function execute() $resultRedirect = $this->resultRedirectFactory->create(); try { $this->attributeSetRepository->deleteById($setId); - $this->messageManager->addSuccess(__('The product template has been removed.')); + $this->messageManager->addSuccess(__('The attribute set has been removed.')); $resultRedirect->setPath('catalog/*/'); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t delete this set right now.')); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php index d40982a5d5641..8f7dafbf28892 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php @@ -45,7 +45,7 @@ public function execute() /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $resultPage->setActiveMenu('Magento_Catalog::catalog_attributes_sets'); - $resultPage->getConfig()->getTitle()->prepend(__('Product Templates')); + $resultPage->getConfig()->getTitle()->prepend(__('Attribute Sets')); $resultPage->getConfig()->getTitle()->prepend( $attributeSet->getId() ? $attributeSet->getAttributeSetName() : __('New Set') ); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Index.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Index.php index 7b9edb21c7e2f..2e1e1a4b642f6 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Index.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Index.php @@ -37,9 +37,9 @@ public function execute() /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $resultPage->setActiveMenu('Magento_Catalog::catalog_attributes_sets'); - $resultPage->getConfig()->getTitle()->prepend(__('Product Templates')); + $resultPage->getConfig()->getTitle()->prepend(__('Attribute Sets')); $resultPage->addBreadcrumb(__('Catalog'), __('Catalog')); - $resultPage->addBreadcrumb(__('Manage Product Templates'), __('Product Templates')); + $resultPage->addBreadcrumb(__('Manage Attribute Sets'), __('Attribute Sets')); return $resultPage; } } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php index 5870190db02b7..480a079d53d7e 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php @@ -82,7 +82,7 @@ public function execute() } if (!$model->getId()) { throw new \Magento\Framework\Exception\LocalizedException( - __('This product template no longer exists.') + __('This attribute set no longer exists.') ); } $data = $this->_objectManager->get('Magento\Framework\Json\Helper\Data') @@ -100,12 +100,12 @@ public function execute() $model->initFromSkeleton($this->getRequest()->getParam('skeleton_set')); } $model->save(); - $this->messageManager->addSuccess(__('You saved the product template.')); + $this->messageManager->addSuccess(__('You saved the attribute set.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addError($e->getMessage()); $hasError = true; } catch (\Exception $e) { - $this->messageManager->addException($e, __('Something went wrong while saving the product template.')); + $this->messageManager->addException($e, __('Something went wrong while saving the attribute set.')); $hasError = true; } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/SuggestProductTemplates.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/SuggestAttributeSets.php similarity index 92% rename from app/code/Magento/Catalog/Controller/Adminhtml/Product/SuggestProductTemplates.php rename to app/code/Magento/Catalog/Controller/Adminhtml/Product/SuggestAttributeSets.php index d28b72799e770..456a579c6191d 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/SuggestProductTemplates.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/SuggestAttributeSets.php @@ -6,7 +6,7 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; -class SuggestProductTemplates extends \Magento\Backend\App\Action +class SuggestAttributeSets extends \Magento\Backend\App\Action { /** * @var \Magento\Framework\Controller\Result\JsonFactory @@ -34,7 +34,7 @@ public function __construct( } /** - * Action for product template selector + * Action for attribute set selector * * @return \Magento\Framework\Controller\Result\Json */ diff --git a/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php b/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php index a54b13b3d6fbc..b88dac52725b2 100644 --- a/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php +++ b/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php @@ -204,7 +204,7 @@ public function getFlatColumnsDdlDefinition() 'unsigned' => true, 'nullable' => false, 'default' => '0', - 'comment' => 'Product Template ID', + 'comment' => 'Attribute Set ID', ]; $columns['type_id'] = [ 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, diff --git a/app/code/Magento/Catalog/Model/Product/AttributeSet/Build.php b/app/code/Magento/Catalog/Model/Product/AttributeSet/Build.php index 7c5be52e6d7e8..a70ae16357594 100644 --- a/app/code/Magento/Catalog/Model/Product/AttributeSet/Build.php +++ b/app/code/Magento/Catalog/Model/Product/AttributeSet/Build.php @@ -79,7 +79,7 @@ public function getAttributeSet() $attributeSet = $this->attributeSetFactory->create(); $attributeSet->setEntityTypeId($this->entityTypeId)->load($this->name, 'attribute_set_name'); if ($attributeSet->getId()) { - throw new AlreadyExistsException(__('Product Template already exists.')); + throw new AlreadyExistsException(__('Attribute Set already exists.')); } $attributeSet->setAttributeSetName($this->name)->validate(); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product.php b/app/code/Magento/Catalog/Model/ResourceModel/Product.php index b4d5298035dad..130cd77177306 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product.php @@ -656,7 +656,7 @@ public function validate($object) $entityType = $this->typeFactory->create()->loadByCode(\Magento\Catalog\Model\Product::ENTITY); $attributeSet = $this->setFactory->create()->load($object->getAttributeSetId()); if ($attributeSet->getEntityTypeId() != $entityType->getId()) { - return ['attribute_set' => 'Invalid product template entity type']; + return ['attribute_set' => 'Invalid attribute set entity type']; } return parent::validate($object); diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php index c507f35db6644..927dd2596cb29 100644 --- a/app/code/Magento/Catalog/Setup/InstallSchema.php +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -42,7 +42,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Product Template ID' + 'Attribute Set ID' ) ->addColumn( 'type_id', diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Media/AttributeManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Media/AttributeManagementTest.php index 3e8a85a77166a..cc65bb7803ba8 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Media/AttributeManagementTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Media/AttributeManagementTest.php @@ -58,7 +58,7 @@ protected function setUp() public function testGetList() { - $attributeSetName = 'Default Product Template'; + $attributeSetName = 'Default Attribute Set'; $expectedResult = [ $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeInterface'), ]; diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/ProductTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/ProductTest.php index 9967344b70e8d..d3c8792274104 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/ProductTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/ProductTest.php @@ -56,7 +56,7 @@ protected function setUp() public function testValidateWrongAttributeSet() { $productTypeId = 4; - $expectedErrorMessage = ['attribute_set' => 'Invalid product template entity type']; + $expectedErrorMessage = ['attribute_set' => 'Invalid attribute set entity type']; $productMock = $this->getMock( '\Magento\Framework\DataObject', diff --git a/app/code/Magento/Catalog/etc/acl.xml b/app/code/Magento/Catalog/etc/acl.xml index 0811d1393129b..0fc34da258444 100644 --- a/app/code/Magento/Catalog/etc/acl.xml +++ b/app/code/Magento/Catalog/etc/acl.xml @@ -24,7 +24,7 @@ - + diff --git a/app/code/Magento/Catalog/etc/adminhtml/menu.xml b/app/code/Magento/Catalog/etc/adminhtml/menu.xml index 0d9783b0fea0a..53db61bd3a1cc 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/menu.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/menu.xml @@ -11,7 +11,7 @@ - + diff --git a/app/code/Magento/Catalog/i18n/de_DE.csv b/app/code/Magento/Catalog/i18n/de_DE.csv index ecbd2cb02116b..835c5a2fa1b33 100644 --- a/app/code/Magento/Catalog/i18n/de_DE.csv +++ b/app/code/Magento/Catalog/i18n/de_DE.csv @@ -160,7 +160,7 @@ Empty,Leer "Based On","Basierend auf" "Add New Attribute Set","Neuer Eigenschaftensatz hinzufügen" "Add New Set","Neuen Satz hinzufügen" -"Product Templates","Product Templates" +"Attribute Sets","Attribute Sets" "Close Window","Fenster Schließen" "New Product","Neues Produkt" "Save & Edit","Save & Edit" @@ -280,7 +280,7 @@ Categories,Kategorien "This attribute set no longer exists.","Dieses Eigenschaftenset existiert nicht mehr." "You saved the attribute set.","You saved the attribute set." "An error occurred while saving the attribute set.","Beim Speichern des Eigenschaftensatzes ist ein Fehler aufgetreten." -"New Product Template","New Product Template" +"New Attribute Set","New Attribute Set" "The attribute set has been removed.","The attribute set has been removed." "An error occurred while deleting this set.","An error occurred while deleting this set." "Search Terms","Search Terms" diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv index 2cfe7083932dd..e6583169c3b1a 100644 --- a/app/code/Magento/Catalog/i18n/en_US.csv +++ b/app/code/Magento/Catalog/i18n/en_US.csv @@ -160,7 +160,7 @@ Empty,Empty "Based On","Based On" "Add New Attribute Set","Add New Attribute Set" "Add New Set","Add New Set" -"Product Templates","Product Templates" +"Attribute Sets","Attribute Sets" "Close Window","Close Window" "New Product","New Product" "Save & Edit","Save & Edit" @@ -280,7 +280,7 @@ Categories,Categories "This attribute set no longer exists.","This attribute set no longer exists." "You saved the attribute set.","You saved the attribute set." "An error occurred while saving the attribute set.","An error occurred while saving the attribute set." -"New Product Template","New Product Template" +"New Attribute Set","New Attribute Set" "The attribute set has been removed.","The attribute set has been removed." "An error occurred while deleting this set.","An error occurred while deleting this set." "Search Terms","Search Terms" diff --git a/app/code/Magento/Catalog/i18n/es_ES.csv b/app/code/Magento/Catalog/i18n/es_ES.csv index 83b48a5ad10cb..2c45038e94f15 100644 --- a/app/code/Magento/Catalog/i18n/es_ES.csv +++ b/app/code/Magento/Catalog/i18n/es_ES.csv @@ -160,7 +160,7 @@ Empty,Vacío(a) "Based On","Basado en" "Add New Attribute Set","Agregar nuevo conjunto de atributos" "Add New Set","Agregar nuevo conjunto" -"Product Templates","Product Templates" +"Attribute Sets","Attribute Sets" "Close Window","Cerrar Ventana" "New Product","Nuevo producto" "Save & Edit","Save & Edit" @@ -280,7 +280,7 @@ Categories,Categorías "This attribute set no longer exists.","Este conjunto de atributos ya no existe." "You saved the attribute set.","You saved the attribute set." "An error occurred while saving the attribute set.","Se produjo un error mientras se guardaba el conjunto de atributos." -"New Product Template","New Product Template" +"New Attribute Set","New Attribute Set" "The attribute set has been removed.","The attribute set has been removed." "An error occurred while deleting this set.","An error occurred while deleting this set." "Search Terms","Search Terms" diff --git a/app/code/Magento/Catalog/i18n/fr_FR.csv b/app/code/Magento/Catalog/i18n/fr_FR.csv index 62cb82be60950..37740e1e7db80 100644 --- a/app/code/Magento/Catalog/i18n/fr_FR.csv +++ b/app/code/Magento/Catalog/i18n/fr_FR.csv @@ -160,7 +160,7 @@ Empty,Vide "Based On","Basé sur" "Add New Attribute Set","Ajouter un nouveau jeu d'attributs" "Add New Set","Ajouter une nouvelle série" -"Product Templates","Product Templates" +"Attribute Sets","Attribute Sets" "Close Window","Fermer la fenêtre" "New Product","Nouveau produit" "Save & Edit","Save & Edit" @@ -280,7 +280,7 @@ Categories,catégories "This attribute set no longer exists.","La série d'attributs n'existe plus." "You saved the attribute set.","You saved the attribute set." "An error occurred while saving the attribute set.","Une erreur est survenue pendant la sauvegarde de la série d'attributs." -"New Product Template","New Product Template" +"New Attribute Set","New Attribute Set" "The attribute set has been removed.","The attribute set has been removed." "An error occurred while deleting this set.","An error occurred while deleting this set." "Search Terms","Search Terms" diff --git a/app/code/Magento/Catalog/i18n/nl_NL.csv b/app/code/Magento/Catalog/i18n/nl_NL.csv index ee1eb9baee9d9..650ef84638334 100644 --- a/app/code/Magento/Catalog/i18n/nl_NL.csv +++ b/app/code/Magento/Catalog/i18n/nl_NL.csv @@ -160,7 +160,7 @@ Empty,Leeg "Based On","Gebaseerd op" "Add New Attribute Set","Voeg Nieuwe Attribuut Set toe" "Add New Set","Voeg Nieuwe Reeks Toe" -"Product Templates","Product Templates" +"Attribute Sets","Attribute Sets" "Close Window","Venster Sluiten" "New Product","Nieuw Product" "Save & Edit","Save & Edit" @@ -280,7 +280,7 @@ Categories,Categoriën "This attribute set no longer exists.","Deze attribuutset bestaat niet meer." "You saved the attribute set.","You saved the attribute set." "An error occurred while saving the attribute set.","Er is een fout opgetreden tijdens het opslaan van de attribuut set." -"New Product Template","New Product Template" +"New Attribute Set","New Attribute Set" "The attribute set has been removed.","The attribute set has been removed." "An error occurred while deleting this set.","An error occurred while deleting this set." "Search Terms","Search Terms" diff --git a/app/code/Magento/Catalog/i18n/pt_BR.csv b/app/code/Magento/Catalog/i18n/pt_BR.csv index 3e0887c87547d..d2c337913df3a 100644 --- a/app/code/Magento/Catalog/i18n/pt_BR.csv +++ b/app/code/Magento/Catalog/i18n/pt_BR.csv @@ -160,7 +160,7 @@ Empty,Vazio "Based On","Baseado Em" "Add New Attribute Set","Adicionar Novo Conjunto de Atributos" "Add New Set","Adicionar Novo Conjunto" -"Product Templates","Product Templates" +"Attribute Sets","Attribute Sets" "Close Window","Fechar Janela" "New Product","Novo Produto" "Save & Edit","Save & Edit" @@ -280,7 +280,7 @@ Categories,Categorias "This attribute set no longer exists.","Este conjunto de atributos não existe mais." "You saved the attribute set.","You saved the attribute set." "An error occurred while saving the attribute set.","Ocorreu um erro ao salvar o conjunto de atributos." -"New Product Template","New Product Template" +"New Attribute Set","New Attribute Set" "The attribute set has been removed.","The attribute set has been removed." "An error occurred while deleting this set.","An error occurred while deleting this set." "Search Terms","Search Terms" diff --git a/app/code/Magento/Catalog/i18n/zh_Hans_CN.csv b/app/code/Magento/Catalog/i18n/zh_Hans_CN.csv index 4774b64706d9a..ed8938feb0f02 100644 --- a/app/code/Magento/Catalog/i18n/zh_Hans_CN.csv +++ b/app/code/Magento/Catalog/i18n/zh_Hans_CN.csv @@ -160,7 +160,7 @@ Empty,空 "Based On",基于 "Add New Attribute Set",添加新属性集 "Add New Set",添加新集 -"Product Templates","Product Templates" +"Attribute Sets","Attribute Sets" "Close Window",关闭窗口 "New Product",新产品 "Save & Edit","Save & Edit" @@ -280,7 +280,7 @@ Categories,分类 "This attribute set no longer exists.",该属性已不存在。 "You saved the attribute set.","You saved the attribute set." "An error occurred while saving the attribute set.",保存属性集时发生错误。 -"New Product Template","New Product Template" +"New Attribute Set","New Attribute Set" "The attribute set has been removed.","The attribute set has been removed." "An error occurred while deleting this set.","An error occurred while deleting this set." "Search Terms","Search Terms" diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml index 06edcfbaa2588..dc12f76eb2f1a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml @@ -354,7 +354,7 @@ rightBeforeAppend : function(tree, nodeThis, node, newParent) { if (node.attributes.is_user_defined == 0) { alert({ - content: 'escapeJsQuote(__('You can\'t remove attributes from this product template.')) ?>' + content: 'escapeJsQuote(__('You can\'t remove attributes from this attribute set.')) ?>' }); return false; } else { @@ -370,7 +370,7 @@ if (node.attributes.is_unassignable == 0) { alert({ - content: 'escapeJsQuote(__('You can\'t remove attributes from this product template.')) ?>' + content: 'escapeJsQuote(__('You can\'t remove attributes from this attribute set.')) ?>' }); return false; } else { diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index a2a98fcdbc51e..24475736833f8 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -207,7 +207,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity ValidatorInterface::ERROR_INVALID_SCOPE => 'Invalid value in Scope column', ValidatorInterface::ERROR_INVALID_WEBSITE => 'Invalid value in Website column (website does not exists?)', ValidatorInterface::ERROR_INVALID_STORE => 'Invalid value in Store column (store doesn\'t exist?)', - ValidatorInterface::ERROR_INVALID_ATTR_SET => 'Invalid value for Product Template column (set doesn\'t exist?)', + ValidatorInterface::ERROR_INVALID_ATTR_SET => 'Invalid value for Attribute Set column (set doesn\'t exist?)', ValidatorInterface::ERROR_INVALID_TYPE => 'Product Type is invalid or not supported', ValidatorInterface::ERROR_INVALID_CATEGORY => 'Category does not exists', ValidatorInterface::ERROR_VALUE_IS_REQUIRED => 'Please make sure attribute "%s" is not empty.', @@ -217,7 +217,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity ValidatorInterface::ERROR_CHANGE_TYPE => 'Product type change is not allowed', ValidatorInterface::ERROR_DUPLICATE_SCOPE => 'Duplicate scope', ValidatorInterface::ERROR_DUPLICATE_SKU => 'Duplicate SKU', - ValidatorInterface::ERROR_CHANGE_ATTR_SET => 'Product template change is not allowed', + ValidatorInterface::ERROR_CHANGE_ATTR_SET => 'Attribute set change is not allowed', ValidatorInterface::ERROR_TYPE_UNSUPPORTED => 'Product type is not supported', ValidatorInterface::ERROR_ROW_IS_ORPHAN => 'Orphan rows that will be skipped due default row errors', ValidatorInterface::ERROR_INVALID_TIER_PRICE_QTY => 'Tier Price data price or quantity value is invalid', diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/ProductTemplate/Form.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/AttributeSet/Form.php similarity index 93% rename from app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/ProductTemplate/Form.php rename to app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/AttributeSet/Form.php index 09370fdce3e72..65c88dd19a05f 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/ProductTemplate/Form.php +++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/AttributeSet/Form.php @@ -7,7 +7,7 @@ /** * Product attribute set selector form */ -namespace Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\ProductTemplate; +namespace Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\AttributeSet; class Form extends \Magento\Backend\Block\Widget\Form\Generic { @@ -57,7 +57,7 @@ protected function _prepareForm() 'radio', [ 'after_element_html' => __( - 'Add configurable attributes to the current Product Template ("%1")', + 'Add configurable attributes to the current Attribute Set ("%1")', sprintf('%s', $this->getCurrentAttributeSetName()) ), 'name' => 'affected-attribute-set', @@ -70,7 +70,7 @@ protected function _prepareForm() 'new-affected-attribute-set', 'radio', [ - 'after_element_html' => __('Add configurable attributes to the new Product Template based on current'), + 'after_element_html' => __('Add configurable attributes to the new Attribute Set based on current'), 'name' => 'affected-attribute-set', 'class' => 'admin__control-radio', 'value' => 'new' @@ -80,7 +80,7 @@ protected function _prepareForm() 'new-attribute-set-name', 'text', [ - 'label' => __('New product template name'), + 'label' => __('New attribute set name'), 'name' => 'new-attribute-set-name', 'required' => true, 'css_class' => 'no-display', @@ -92,7 +92,7 @@ protected function _prepareForm() 'existing-affected-attribute-set', 'radio', [ - 'after_element_html' => __('Add configurable attributes to the existing Product Template'), + 'after_element_html' => __('Add configurable attributes to the existing Attribute Set'), 'name' => 'affected-attribute-set', 'required' => true, 'class' => 'admin__control-radio no-display', @@ -103,7 +103,7 @@ protected function _prepareForm() 'choose-affected-attribute-set', 'select', [ - 'label' => __('Choose existing Product Template'), + 'label' => __('Choose existing Attribute Set'), 'name' => 'attribute-set-name', 'required' => true, 'css_class' => 'no-display', diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml index b6683bdeca4a7..322360d8703f9 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml @@ -16,7 +16,7 @@ - + diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml index ea036bbf5d6c0..c9aeeddfd2b30 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml @@ -40,7 +40,7 @@ editSet.submit = editSet.submit.wrap(function(original) { editSet.rightBeforeAppend = editSet.rightBeforeAppend.wrap(function(original, tree, nodeThis, node, newParent) { if (node.attributes.is_configurable == 1) { alert({ - content: 'escapeJsQuote(__('This attribute is used in configurable products. You cannot remove it from the product template.')) ?>' + content: 'escapeJsQuote(__('This attribute is used in configurable products. You cannot remove it from the attribute set.')) ?>' }); return false; } @@ -50,7 +50,7 @@ editSet.rightBeforeAppend = editSet.rightBeforeAppend.wrap(function(original, tr editSet.rightBeforeInsert = editSet.rightBeforeInsert.wrap(function(original, tree, nodeThis, node, newParent) { if (node.attributes.is_configurable == 1) { alert({ - content: 'escapeJsQuote(__('This attribute is used in configurable products. You cannot remove it from the product template.')) ?>' + content: 'escapeJsQuote(__('This attribute is used in configurable products. You cannot remove it from the attribute set.')) ?>' }); return false; } diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml index 3f192bc072f9a..4716938b4a094 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml @@ -48,7 +48,7 @@ $form .modal({ - title: '', + title: '', closed: function () { resetValidation(); }, diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php index df81fff83bd33..f8b577df7c12c 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php @@ -8,20 +8,54 @@ namespace Magento\Paypal\Block\Adminhtml\Billing\Agreement\View\Tab; +use Magento\Paypal\Model\ResourceModel\Billing\Agreement as BillingAgreementResource; +use Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory; +use Magento\Backend\Block\Widget\Grid\Extended as ExtendedGrid; +use Magento\Backend\Block\Widget\Tab\TabInterface; +use Magento\Backend\Block\Template\Context as TemplateContext; +use Magento\Backend\Helper\Data as BackendHelper; +use Magento\Framework\Registry; + /** * Adminhtml billing agreement related orders tab */ -class Orders extends \Magento\Framework\View\Element\Text\ListText implements \Magento\Backend\Block\Widget\Tab\TabInterface +class Orders extends ExtendedGrid implements TabInterface { /** - * Initialize grid params - * - * @return void + * @var CollectionFactory */ - protected function _construct() - { - parent::_construct(); - $this->setId('billing_agreement_orders'); + protected $collectionFactory; + + /** + * @var Registry + */ + protected $coreRegistry; + + /** + * @var BillingAgreementResource + */ + protected $billingAgreementResource; + + /** + * @param TemplateContext $context + * @param BackendHelper $backendHelper + * @param CollectionFactory $collectionFactory + * @param Registry $coreRegistry + * @param BillingAgreementResource $billingAgreementResource + * @param array $data + */ + public function __construct( + TemplateContext $context, + BackendHelper $backendHelper, + CollectionFactory $collectionFactory, + Registry $coreRegistry, + BillingAgreementResource $billingAgreementResource, + array $data = [] + ) { + $this->coreRegistry = $coreRegistry; + $this->collectionFactory = $collectionFactory; + $this->billingAgreementResource = $billingAgreementResource; + parent::__construct($context, $backendHelper, $data); } /** @@ -55,4 +89,82 @@ public function isHidden() { return false; } + + /** + * {@inheritdoc} + */ + protected function _construct() + { + parent::_construct(); + $this->setId('billing_agreement_orders'); + $this->setUseAjax(true); + } + + /** + * Apply various selection filters to prepare the sales order grid collection. + * + * @return $this + */ + protected function _prepareCollection() + { + $billingAgreement = $this->coreRegistry->registry('current_billing_agreement'); + if ($billingAgreement) { + $collection = $this->collectionFactory->getReport('sales_order_grid_data_source')->addFieldToSelect( + 'entity_id' + )->addFieldToSelect( + 'increment_id' + )->addFieldToSelect( + 'customer_id' + )->addFieldToSelect( + 'created_at' + )->addFieldToSelect( + 'grand_total' + )->addFieldToSelect( + 'order_currency_code' + )->addFieldToSelect( + 'store_id' + )->addFieldToSelect( + 'billing_name' + )->addFieldToSelect( + 'shipping_name' + ); + $this->billingAgreementResource->addOrdersFilter($collection, $billingAgreement->getId()); + $this->setCollection($collection); + } + return parent::_prepareCollection(); + } + + /** + * {@inheritdoc} + */ + protected function _prepareColumns() + { + $this->addColumn('increment_id', ['header' => __('Order'), 'width' => '100', 'index' => 'increment_id']); + + $this->addColumn( + 'created_at', + ['header' => __('Purchased'), 'index' => 'created_at', 'type' => 'datetime'] + ); + + $this->addColumn('billing_name', ['header' => __('Bill-to Name'), 'index' => 'billing_name']); + $this->addColumn('shipping_name', ['header' => __('Ship-to Name'), 'index' => 'shipping_name']); + + $this->addColumn( + 'grand_total', + [ + 'header' => __('Order Total'), + 'index' => 'grand_total', + 'type' => 'currency', + 'currency' => 'order_currency_code' + ] + ); + + if (!$this->_storeManager->isSingleStoreMode()) { + $this->addColumn( + 'store_id', + ['header' => __('Purchase Point'), 'index' => 'store_id', 'type' => 'store', 'store_view' => true] + ); + } + return parent::_prepareColumns(); + } } diff --git a/app/code/Magento/Paypal/Model/ResourceModel/Billing/Agreement.php b/app/code/Magento/Paypal/Model/ResourceModel/Billing/Agreement.php index 6f714ae437e60..5344091f837bf 100644 --- a/app/code/Magento/Paypal/Model/ResourceModel/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Model/ResourceModel/Billing/Agreement.php @@ -39,11 +39,11 @@ public function addOrderRelation($agreementId, $orderId) /** * Add billing agreement filter on orders collection * - * @param \Magento\Sales\Model\ResourceModel\Order\Collection $orderCollection + * @param \Magento\Framework\Data\Collection\AbstractDb $orderCollection * @param string|int|array $agreementIds * @return $this */ - public function addOrdersFilter(\Magento\Sales\Model\ResourceModel\Order\Collection $orderCollection, $agreementIds) + public function addOrdersFilter(\Magento\Framework\Data\Collection\AbstractDb $orderCollection, $agreementIds) { $agreementIds = is_array($agreementIds) ? $agreementIds : [$agreementIds]; $orderCollection->getSelect()->joinInner( diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php index c2184950d83e0..784a78e5a4cae 100644 --- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php +++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php @@ -153,7 +153,7 @@ public function getAttributeObject() */ protected function _addSpecialAttributes(array &$attributes) { - $attributes['attribute_set_id'] = __('Product Template'); + $attributes['attribute_set_id'] = __('Attribute Set'); $attributes['category_ids'] = __('Category'); } diff --git a/app/code/Magento/Sales/Api/CreditmemoCommentRepositoryInterface.php b/app/code/Magento/Sales/Api/CreditmemoCommentRepositoryInterface.php index d7c1f067cc046..bc8cda48f2b21 100644 --- a/app/code/Magento/Sales/Api/CreditmemoCommentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/CreditmemoCommentRepositoryInterface.php @@ -32,10 +32,10 @@ public function get($id); * * Returns a credit memo comment search results interface. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\CreditmemoCommentSearchResultInterface Credit memo comment search results interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Deletes a specified credit memo comment. diff --git a/app/code/Magento/Sales/Api/CreditmemoItemRepositoryInterface.php b/app/code/Magento/Sales/Api/CreditmemoItemRepositoryInterface.php index b322cc7b68f48..9921c53a84385 100644 --- a/app/code/Magento/Sales/Api/CreditmemoItemRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/CreditmemoItemRepositoryInterface.php @@ -27,10 +27,10 @@ public function get($id); /** * Lists credit memo items that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\CreditmemoItemSearchResultInterface Credit memo item search results interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Deletes a specified credit memo item. diff --git a/app/code/Magento/Sales/Api/CreditmemoManagementInterface.php b/app/code/Magento/Sales/Api/CreditmemoManagementInterface.php index 551f48488869e..b2d7aab6eb09f 100644 --- a/app/code/Magento/Sales/Api/CreditmemoManagementInterface.php +++ b/app/code/Magento/Sales/Api/CreditmemoManagementInterface.php @@ -48,12 +48,10 @@ public function notify($id); * * @param \Magento\Sales\Api\Data\CreditmemoInterface $creditmemo * @param bool $offlineRequested - * @param bool $notifyCustomer * @return \Magento\Sales\Api\Data\CreditmemoInterface */ public function refund( \Magento\Sales\Api\Data\CreditmemoInterface $creditmemo, - $offlineRequested = false, - $notifyCustomer = false + $offlineRequested = false ); } diff --git a/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php b/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php index 8bb487d732299..e1577630215c4 100644 --- a/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php @@ -18,10 +18,10 @@ interface CreditmemoRepositoryInterface /** * Lists credit memos that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\CreditmemoSearchResultInterface Credit memo search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified credit memo. diff --git a/app/code/Magento/Sales/Api/InvoiceCommentRepositoryInterface.php b/app/code/Magento/Sales/Api/InvoiceCommentRepositoryInterface.php index f256bb88af2ab..d9d698b987b61 100644 --- a/app/code/Magento/Sales/Api/InvoiceCommentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/InvoiceCommentRepositoryInterface.php @@ -17,10 +17,10 @@ interface InvoiceCommentRepositoryInterface /** * Lists invoice comments that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\InvoiceCommentSearchResultInterface Invoice search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified invoice comment. diff --git a/app/code/Magento/Sales/Api/InvoiceItemRepositoryInterface.php b/app/code/Magento/Sales/Api/InvoiceItemRepositoryInterface.php index 90ae5cea092df..510623d1932ba 100644 --- a/app/code/Magento/Sales/Api/InvoiceItemRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/InvoiceItemRepositoryInterface.php @@ -16,10 +16,10 @@ interface InvoiceItemRepositoryInterface /** * Lists the invoice items that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Sales\Api\Data\InvoiceItemSearchResultInterface */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified invoice item. diff --git a/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php b/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php index 0fa5f268be642..9b864ba2ea380 100644 --- a/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php @@ -16,10 +16,10 @@ interface InvoiceRepositoryInterface /** * Lists invoices that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\InvoiceSearchResultInterface Invoice search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Return Invoice object diff --git a/app/code/Magento/Sales/Api/OrderAddressRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderAddressRepositoryInterface.php index 5c3db02774762..8071ec0c4894c 100644 --- a/app/code/Magento/Sales/Api/OrderAddressRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderAddressRepositoryInterface.php @@ -18,10 +18,10 @@ interface OrderAddressRepositoryInterface /** * Lists order addresses that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderAddressSearchResultInterface Order address search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified order address. diff --git a/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php index e1832a09e5568..6355db859bbcf 100644 --- a/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php @@ -18,10 +18,10 @@ interface OrderItemRepositoryInterface /** * Lists order items that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderItemSearchResultInterface Order item search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified order item. diff --git a/app/code/Magento/Sales/Api/OrderPaymentRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderPaymentRepositoryInterface.php index e4ff2acf54ba6..005de16342db3 100644 --- a/app/code/Magento/Sales/Api/OrderPaymentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderPaymentRepositoryInterface.php @@ -18,10 +18,10 @@ interface OrderPaymentRepositoryInterface /** * Lists order payments that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderPaymentSearchResultInterface Order payment search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified order payment. diff --git a/app/code/Magento/Sales/Api/OrderRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderRepositoryInterface.php index d8420ce0da729..50a683b437153 100644 --- a/app/code/Magento/Sales/Api/OrderRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderRepositoryInterface.php @@ -18,10 +18,10 @@ interface OrderRepositoryInterface /** * Lists orders that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderSearchResultInterface Order search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified order. diff --git a/app/code/Magento/Sales/Api/OrderStatusHistoryRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderStatusHistoryRepositoryInterface.php index b99bf0dc2c729..743f9aaa734e9 100644 --- a/app/code/Magento/Sales/Api/OrderStatusHistoryRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderStatusHistoryRepositoryInterface.php @@ -21,10 +21,10 @@ interface OrderStatusHistoryRepositoryInterface /** * Lists order status history comments that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderStatusHistorySearchResultInterface Order status history search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified order status comment. diff --git a/app/code/Magento/Sales/Api/ShipmentCommentRepositoryInterface.php b/app/code/Magento/Sales/Api/ShipmentCommentRepositoryInterface.php index e6605c9c5dd24..9ca3bb336f268 100644 --- a/app/code/Magento/Sales/Api/ShipmentCommentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/ShipmentCommentRepositoryInterface.php @@ -17,10 +17,10 @@ interface ShipmentCommentRepositoryInterface /** * Lists shipment comments that match specific search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\ShipmentCommentSearchResultInterface Shipment comment search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified shipment comment. diff --git a/app/code/Magento/Sales/Api/ShipmentItemRepositoryInterface.php b/app/code/Magento/Sales/Api/ShipmentItemRepositoryInterface.php index 0db3adabf885c..5d2d3946a9197 100644 --- a/app/code/Magento/Sales/Api/ShipmentItemRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/ShipmentItemRepositoryInterface.php @@ -17,10 +17,10 @@ interface ShipmentItemRepositoryInterface /** * Lists shipment items that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\ShipmentItemSearchResultInterface Shipment item search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified shipment item. diff --git a/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php b/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php index 1cfa85d87e66f..858347a6f166d 100644 --- a/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php @@ -17,10 +17,10 @@ interface ShipmentRepositoryInterface /** * Lists shipments that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\ShipmentSearchResultInterface Shipment search results interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified shipment. diff --git a/app/code/Magento/Sales/Api/ShipmentTrackRepositoryInterface.php b/app/code/Magento/Sales/Api/ShipmentTrackRepositoryInterface.php index 5d7817b0c828d..ada64b54d862f 100644 --- a/app/code/Magento/Sales/Api/ShipmentTrackRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/ShipmentTrackRepositoryInterface.php @@ -17,10 +17,10 @@ interface ShipmentTrackRepositoryInterface /** * Lists shipment tracks that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\ShipmentTrackSearchResultInterface Shipment track search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified shipment track. diff --git a/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php b/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php index 7a256e7deaf7c..be5315f1329cc 100644 --- a/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php @@ -16,10 +16,10 @@ interface TransactionRepositoryInterface /** * Lists transactions that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\TransactionSearchResultInterface Transaction search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria); + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria); /** * Loads a specified transaction. diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php index 1ee0386f87110..4af19b69b1361 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php @@ -160,8 +160,8 @@ public function getAddressCollection() ->setConditionType('eq') ->create(); $this->searchCriteriaBuilder->addFilters([$filter]); - $criteria = $this->searchCriteriaBuilder->create(); - $result = $this->addressService->getList($criteria); + $searchCriteria = $this->searchCriteriaBuilder->create(); + $result = $this->addressService->getList($searchCriteria); return $result->getItems(); } return []; diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/AddressSave.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/AddressSave.php index e3d15fd93cdd6..b10329e70d376 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/AddressSave.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/AddressSave.php @@ -16,13 +16,20 @@ class AddressSave extends \Magento\Sales\Controller\Adminhtml\Order public function execute() { $addressId = $this->getRequest()->getParam('address_id'); - $address = $this->_objectManager->create('Magento\Sales\Model\Order\Address')->load($addressId); + /** @var $address \Magento\Sales\Api\Data\OrderAddressInterface|\Magento\Sales\Model\Order\Address */ + $address = $this->_objectManager->create('Magento\Sales\Api\Data\OrderAddressInterface')->load($addressId); $data = $this->getRequest()->getPostValue(); $resultRedirect = $this->resultRedirectFactory->create(); if ($data && $address->getId()) { $address->addData($data); try { $address->save(); + $this->_eventManager->dispatch( + 'admin_sales_order_address_update', + [ + 'order_id' => $address->getParentId() + ] + ); $this->messageManager->addSuccess(__('You updated the order address.')); return $resultRedirect->setPath('sales/*/view', ['order_id' => $address->getParentId()]); } catch (\Magento\Framework\Exception\LocalizedException $e) { diff --git a/app/code/Magento/Sales/Model/Order/AddressRepository.php b/app/code/Magento/Sales/Model/Order/AddressRepository.php index 2e4c9df86fa22..ec5a39bce3b6c 100644 --- a/app/code/Magento/Sales/Model/Order/AddressRepository.php +++ b/app/code/Magento/Sales/Model/Order/AddressRepository.php @@ -14,6 +14,8 @@ /** * Repository class for @see \Magento\Sales\Api\Data\OrderAddressInterface + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class AddressRepository implements \Magento\Sales\Api\OrderAddressRepositoryInterface { @@ -77,24 +79,24 @@ public function get($id) /** * Find order addresses by criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Sales\Api\Data\OrderAddressInterface[] */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { //@TODO: fix search logic /** @var \Magento\Sales\Api\Data\OrderAddressSearchResultInterface $searchResult */ $searchResult = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $searchResult->setCurPage($criteria->getCurrentPage()); - $searchResult->setPageSize($criteria->getPageSize()); + $searchResult->setCurPage($searchCriteria->getCurrentPage()); + $searchResult->setPageSize($searchCriteria->getPageSize()); return $searchResult; } diff --git a/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php b/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php index 200a57a73fff5..c9621a7e668d3 100644 --- a/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php +++ b/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php @@ -87,21 +87,21 @@ public function create() /** * Lists credit memos that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\CreditmemoSearchResultInterface Credit memo search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { /** @var \Magento\Sales\Api\Data\CreditmemoSearchResultInterface $searchResult */ $searchResult = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $searchResult->setCurPage($criteria->getCurrentPage()); - $searchResult->setPageSize($criteria->getPageSize()); + $searchResult->setCurPage($searchCriteria->getCurrentPage()); + $searchResult->setPageSize($searchCriteria->getPageSize()); return $searchResult; } diff --git a/app/code/Magento/Sales/Model/Order/InvoiceRepository.php b/app/code/Magento/Sales/Model/Order/InvoiceRepository.php index 04275723bda95..6ac147108bb73 100644 --- a/app/code/Magento/Sales/Model/Order/InvoiceRepository.php +++ b/app/code/Magento/Sales/Model/Order/InvoiceRepository.php @@ -83,21 +83,21 @@ public function create() /** * Find entities by criteria * - * @param \Magento\Framework\Api\SearchCriteria $criteria + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Sales\Api\Data\InvoiceInterface[] */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { /** @var \Magento\Sales\Model\ResourceModel\Order\Invoice\Collection $collection */ $collection = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $collection->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $collection->setCurPage($criteria->getCurrentPage()); - $collection->setPageSize($criteria->getPageSize()); + $collection->setCurPage($searchCriteria->getCurrentPage()); + $collection->setPageSize($searchCriteria->getPageSize()); return $collection; } diff --git a/app/code/Magento/Sales/Model/Order/ItemRepository.php b/app/code/Magento/Sales/Model/Order/ItemRepository.php index 776b862828658..983a87834fabf 100644 --- a/app/code/Magento/Sales/Model/Order/ItemRepository.php +++ b/app/code/Magento/Sales/Model/Order/ItemRepository.php @@ -114,16 +114,16 @@ public function get($id) /** * Find entities by criteria * - * @param SearchCriteria $criteria + * @param SearchCriteria $searchCriteria * @return OrderItemInterface[] */ - public function getList(SearchCriteria $criteria) + public function getList(SearchCriteria $searchCriteria) { /** @var OrderItemSearchResultInterface $searchResult */ $searchResult = $this->searchResultFactory->create(); - $searchResult->setSearchCriteria($criteria); + $searchResult->setSearchCriteria($searchCriteria); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); diff --git a/app/code/Magento/Sales/Model/Order/Payment/Repository.php b/app/code/Magento/Sales/Model/Order/Payment/Repository.php index 2517c4b9adbcc..ef3fb08b5daa1 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Repository.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Repository.php @@ -47,21 +47,21 @@ public function __construct(Metadata $metaData, SearchResultFactory $searchResul /** * Lists order payments that match specified search criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria The search criteria. + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderPaymentSearchResultInterface Order payment search result interface. */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { /** @var \Magento\Sales\Model\ResourceModel\Order\Payment\Collection $collection */ $collection = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $collection->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $collection->setCurPage($criteria->getCurrentPage()); - $collection->setPageSize($criteria->getPageSize()); + $collection->setCurPage($searchCriteria->getCurrentPage()); + $collection->setPageSize($searchCriteria->getPageSize()); return $collection; } diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php index 051ab5401d59f..a3550d6073ecd 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php @@ -185,18 +185,18 @@ public function getByTransactionId($transactionId, $paymentId, $orderId) /** * {@inheritdoc} */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { /** @var TransactionResource\Collection $collection */ $collection = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $collection->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $collection->setCurPage($criteria->getCurrentPage()); - $collection->setPageSize($criteria->getPageSize()); + $collection->setCurPage($searchCriteria->getCurrentPage()); + $collection->setPageSize($searchCriteria->getPageSize()); $collection->addPaymentInformation(['method']); $collection->addOrderInformation(['increment_id']); return $collection; diff --git a/app/code/Magento/Sales/Model/Order/ShipmentRepository.php b/app/code/Magento/Sales/Model/Order/ShipmentRepository.php index c44fa79ae56c7..9cb32363b480f 100644 --- a/app/code/Magento/Sales/Model/Order/ShipmentRepository.php +++ b/app/code/Magento/Sales/Model/Order/ShipmentRepository.php @@ -14,6 +14,8 @@ /** * Repository class for @see \Magento\Sales\Api\Data\ShipmentInterface + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ShipmentRepository implements \Magento\Sales\Api\ShipmentRepositoryInterface { @@ -77,24 +79,24 @@ public function get($id) /** * Find shipments by criteria. * - * @param \Magento\Framework\Api\SearchCriteria $criteria + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Sales\Api\Data\ShipmentInterface[] */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { //@TODO: fix search logic /** @var \Magento\Sales\Api\Data\ShipmentSearchResultInterface $searchResult */ $searchResult = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $searchResult->setCurPage($criteria->getCurrentPage()); - $searchResult->setPageSize($criteria->getPageSize()); + $searchResult->setCurPage($searchCriteria->getCurrentPage()); + $searchResult->setPageSize($searchCriteria->getPageSize()); return $searchResult; } diff --git a/app/code/Magento/Sales/Model/OrderRepository.php b/app/code/Magento/Sales/Model/OrderRepository.php index 976a03486a4f1..1d4a7b8e66a9a 100644 --- a/app/code/Magento/Sales/Model/OrderRepository.php +++ b/app/code/Magento/Sales/Model/OrderRepository.php @@ -73,22 +73,22 @@ public function get($id) /** * Find entities by criteria * - * @param \Magento\Framework\Api\SearchCriteria $criteria + * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Sales\Api\Data\OrderInterface[] */ - public function getList(\Magento\Framework\Api\SearchCriteria $criteria) + public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { //@TODO: fix search logic /** @var \Magento\Sales\Api\Data\OrderSearchResultInterface $searchResult */ $searchResult = $this->searchResultFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $searchResult->addFieldToFilter($filter->getField(), [$condition => $filter->getValue()]); } } - $searchResult->setCurPage($criteria->getCurrentPage()); - $searchResult->setPageSize($criteria->getPageSize()); + $searchResult->setCurPage($searchCriteria->getCurrentPage()); + $searchResult->setPageSize($searchCriteria->getPageSize()); return $searchResult; } diff --git a/app/code/Magento/Sales/Model/ResourceModel/Order/Address.php b/app/code/Magento/Sales/Model/ResourceModel/Order/Address.php index 6df065f7ee303..625fe5e2b342f 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Order/Address.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Order/Address.php @@ -122,19 +122,4 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) } return $this; } - - /** - * Update related grid table after object save - * - * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\DataObject $object - * @return \Magento\Framework\Model\ResourceModel\Db\AbstractDb - */ - protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) - { - $resource = parent::_afterSave($object); - if ($object->getParentId()) { - $this->gridPool->refreshByOrderId($object->getParentId()); - } - return $resource; - } } diff --git a/app/code/Magento/Sales/Model/Service/CreditmemoService.php b/app/code/Magento/Sales/Model/Service/CreditmemoService.php index ea0e1ed82d1b3..1993e1d1cae54 100644 --- a/app/code/Magento/Sales/Model/Service/CreditmemoService.php +++ b/app/code/Magento/Sales/Model/Service/CreditmemoService.php @@ -108,8 +108,8 @@ public function getCommentsList($id) $this->searchCriteriaBuilder->addFilters( [$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()] ); - $criteria = $this->searchCriteriaBuilder->create(); - return $this->commentRepository->getList($criteria); + $searchCriteria = $this->searchCriteriaBuilder->create(); + return $this->commentRepository->getList($searchCriteria); } /** @@ -129,13 +129,11 @@ public function notify($id) * * @param \Magento\Sales\Api\Data\CreditmemoInterface $creditmemo * @param bool $offlineRequested - * @param bool $notifyCustomer * @return \Magento\Sales\Api\Data\CreditmemoInterface */ public function refund( \Magento\Sales\Api\Data\CreditmemoInterface $creditmemo, - $offlineRequested = false, - $notifyCustomer = false + $offlineRequested = false ) { $this->validateForRefund($creditmemo); $creditmemo->setState(\Magento\Sales\Model\Order\Creditmemo::STATE_REFUNDED); diff --git a/app/code/Magento/Sales/Model/Service/InvoiceService.php b/app/code/Magento/Sales/Model/Service/InvoiceService.php index 5c07bf365e9fb..7352d0f221e33 100644 --- a/app/code/Magento/Sales/Model/Service/InvoiceService.php +++ b/app/code/Magento/Sales/Model/Service/InvoiceService.php @@ -103,8 +103,8 @@ public function getCommentsList($id) $this->criteriaBuilder->addFilters( [$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()] ); - $criteria = $this->criteriaBuilder->create(); - return $this->commentRepository->getList($criteria); + $searchCriteria = $this->criteriaBuilder->create(); + return $this->commentRepository->getList($searchCriteria); } /** diff --git a/app/code/Magento/Sales/Model/Service/OrderService.php b/app/code/Magento/Sales/Model/Service/OrderService.php index 5df21bf9df691..29b719a1873a6 100644 --- a/app/code/Magento/Sales/Model/Service/OrderService.php +++ b/app/code/Magento/Sales/Model/Service/OrderService.php @@ -44,6 +44,11 @@ class OrderService implements OrderManagementInterface */ protected $eventManager; + /** + * @var \Magento\Sales\Model\Order\Email\Sender\OrderCommentSender + */ + protected $orderCommentSender; + /** * Constructor * @@ -53,6 +58,7 @@ class OrderService implements OrderManagementInterface * @param \Magento\Framework\Api\FilterBuilder $filterBuilder * @param \Magento\Sales\Model\OrderNotifier $notifier * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param \Magento\Sales\Model\Order\Email\Sender\OrderCommentSender $orderCommentSender */ public function __construct( \Magento\Sales\Api\OrderRepositoryInterface $orderRepository, @@ -60,7 +66,8 @@ public function __construct( \Magento\Framework\Api\SearchCriteriaBuilder $criteriaBuilder, \Magento\Framework\Api\FilterBuilder $filterBuilder, \Magento\Sales\Model\OrderNotifier $notifier, - \Magento\Framework\Event\ManagerInterface $eventManager + \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Sales\Model\Order\Email\Sender\OrderCommentSender $orderCommentSender ) { $this->orderRepository = $orderRepository; $this->historyRepository = $historyRepository; @@ -68,6 +75,7 @@ public function __construct( $this->filterBuilder = $filterBuilder; $this->notifier = $notifier; $this->eventManager = $eventManager; + $this->orderCommentSender = $orderCommentSender; } /** @@ -98,8 +106,8 @@ public function getCommentsList($id) $this->criteriaBuilder->addFilters( [$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()] ); - $criteria = $this->criteriaBuilder->create(); - return $this->historyRepository->getList($criteria); + $searchCriteria = $this->criteriaBuilder->create(); + return $this->historyRepository->getList($searchCriteria); } /** @@ -114,6 +122,9 @@ public function addComment($id, \Magento\Sales\Api\Data\OrderStatusHistoryInterf $order = $this->orderRepository->get($id); $order->addStatusHistory($statusHistory); $this->orderRepository->save($order); + $notify = isset($statusHistory['is_customer_notified']) ? $statusHistory['is_customer_notified'] : false; + $comment = trim(strip_tags($statusHistory->getComment())); + $this->orderCommentSender->send($order, $notify, $comment); return true; } diff --git a/app/code/Magento/Sales/Model/Service/ShipmentService.php b/app/code/Magento/Sales/Model/Service/ShipmentService.php index 6523e8e83825e..62593c1b1d0dc 100644 --- a/app/code/Magento/Sales/Model/Service/ShipmentService.php +++ b/app/code/Magento/Sales/Model/Service/ShipmentService.php @@ -91,8 +91,8 @@ public function getCommentsList($id) $this->criteriaBuilder->addFilters( [$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()] ); - $criteria = $this->criteriaBuilder->create(); - return $this->commentRepository->getList($criteria); + $searchCriteria = $this->criteriaBuilder->create(); + return $this->commentRepository->getList($searchCriteria); } /** diff --git a/app/code/Magento/Sales/Observer/GridProcessAddressChange.php b/app/code/Magento/Sales/Observer/GridProcessAddressChange.php new file mode 100644 index 0000000000000..e053801290dbe --- /dev/null +++ b/app/code/Magento/Sales/Observer/GridProcessAddressChange.php @@ -0,0 +1,44 @@ +gridPool= $gridPool; + } + + /** + * Refresh addresses in grids according to performed changed + * This is manual admin action, as result we perform this operation without delay + * + * @param EventObserver $observer + * @return void + */ + public function execute(EventObserver $observer) + { + $this->gridPool->refreshByOrderId($observer->getOrderId()); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php index 4a2ef97a19764..0cb9a4dc71576 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php @@ -148,10 +148,10 @@ public function testGetList() ->method('getFilters') ->willReturn([$filter]); - $criteria = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') + $searchCriteria = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') ->disableOriginalConstructor() ->getMock(); - $criteria->expects($this->once()) + $searchCriteria->expects($this->once()) ->method('getFilterGroups') ->willReturn($filterGroups); @@ -166,7 +166,7 @@ public function testGetList() ->method('create') ->willReturn($collection); - $this->assertEquals($collection, $this->invoice->getList($criteria)); + $this->assertEquals($collection, $this->invoice->getList($searchCriteria)); } public function testDelete() diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php index f943f6632225b..3dd1590bf72ad 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php @@ -170,14 +170,14 @@ public function testGetList() ->method('getFilters') ->willReturn([$filter]); - $criteria = $this->getMock( + $searchCriteria = $this->getMock( 'Magento\Framework\Api\SearchCriteria', ['getFilterGroups'], [], '', false ); - $criteria->expects($this->once()) + $searchCriteria->expects($this->once()) ->method('getFilterGroups') ->willReturn([$filterGroup]); @@ -196,7 +196,7 @@ public function testGetList() ->method('create') ->willReturn($collection); - $this->assertEquals($collection, $this->subject->getList($criteria)); + $this->assertEquals($collection, $this->subject->getList($searchCriteria)); } public function testDelete() diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php index cba7908dacd42..25357bd65177f 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php @@ -153,10 +153,10 @@ public function testGetList() ->method('getFilters') ->willReturn([$filter]); - $criteria = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') + $searchCriteria = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') ->disableOriginalConstructor() ->getMock(); - $criteria->expects($this->once()) + $searchCriteria->expects($this->once()) ->method('getFilterGroups') ->willReturn($filterGroups); @@ -171,7 +171,7 @@ public function testGetList() ->method('create') ->willReturn($collection); - $this->assertEquals($collection, $this->creditmemo->getList($criteria)); + $this->assertEquals($collection, $this->creditmemo->getList($searchCriteria)); } public function testDelete() diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php index e2deb200dbcfc..314271c315696 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php @@ -200,10 +200,10 @@ public function testGetList() ->method('getFilters') ->willReturn([$filterMock]); - $criteriaMock = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') + $searchCriteriaMock = $this->getMockBuilder('Magento\Framework\Api\SearchCriteria') ->disableOriginalConstructor() ->getMock(); - $criteriaMock->expects($this->once()) + $searchCriteriaMock->expects($this->once()) ->method('getFilterGroups') ->willReturn([$filterGroupMock]); @@ -230,7 +230,7 @@ public function testGetList() ->willReturn($searchResultMock); $model = $this->getModel($orderItemMock, $productType); - $this->assertSame($searchResultMock, $model->getList($criteriaMock)); + $this->assertSame($searchResultMock, $model->getList($searchCriteriaMock)); } public function testDeleteById() diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php index 36a8360ee094f..f76732578da21 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php @@ -170,14 +170,14 @@ public function testGetList() ->method('getFilters') ->willReturn([$filter]); - $criteria = $this->getMock( + $searchCriteria = $this->getMock( 'Magento\Framework\Api\SearchCriteria', ['getFilterGroups'], [], '', false ); - $criteria->expects($this->once()) + $searchCriteria->expects($this->once()) ->method('getFilterGroups') ->willReturn([$filterGroup]); @@ -196,7 +196,7 @@ public function testGetList() ->method('create') ->willReturn($collection); - $this->assertEquals($collection, $this->subject->getList($criteria)); + $this->assertEquals($collection, $this->subject->getList($searchCriteria)); } public function testDelete() diff --git a/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/AddressTest.php b/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/AddressTest.php index ffeb136782b1c..8ac891f47b43e 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/AddressTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/AddressTest.php @@ -40,11 +40,6 @@ class AddressTest extends \PHPUnit_Framework_TestCase */ protected $validatorMock; - /** - * @var \Magento\Sales\Model\ResourceModel\GridPool|\PHPUnit_Framework_MockObject_MockObject - */ - protected $gridPoolMock; - /** * @var \Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot|\PHPUnit_Framework_MockObject_MockObject */ @@ -87,13 +82,6 @@ public function setUp() '', false ); - $this->gridPoolMock = $this->getMock( - 'Magento\Sales\Model\ResourceModel\GridPool', - ['refreshByOrderId'], - [], - '', - false - ); $this->entitySnapshotMock = $this->getMock( 'Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot', [], @@ -117,7 +105,6 @@ public function setUp() [ 'resource' => $this->appResourceMock, 'validator' => $this->validatorMock, - 'gridPool' => $this->gridPoolMock, 'entitySnapshot' => $this->entitySnapshotMock ] ); @@ -136,13 +123,9 @@ public function testSave() ->method('isModified') ->with($this->addressMock) ->willReturn(true); - $this->addressMock->expects($this->exactly(3)) + $this->addressMock->expects($this->once()) ->method('getParentId') ->will($this->returnValue(1)); - $this->gridPoolMock->expects($this->once()) - ->method('refreshByOrderId') - ->with($this->equalTo(1)) - ->will($this->returnSelf()); $this->addressResource->save($this->addressMock); } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Service/OrderServiceTest.php b/app/code/Magento/Sales/Test/Unit/Model/Service/OrderServiceTest.php index dfbdd79bd3373..71a4bf2c0bb48 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Service/OrderServiceTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Service/OrderServiceTest.php @@ -14,51 +14,67 @@ class OrderServiceTest extends \PHPUnit_Framework_TestCase * @var \Magento\Sales\Model\Service\OrderService */ protected $orderService; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Api\OrderRepositoryInterface */ protected $orderRepositoryMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Api\OrderStatusHistoryRepositoryInterface */ protected $orderStatusHistoryRepositoryMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Api\SearchCriteriaBuilder */ protected $searchCriteriaBuilderMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Api\SearchCriteria */ protected $searchCriteriaMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Api\FilterBuilder */ protected $filterBuilderMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Api\Filter */ protected $filterMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Model\OrderNotifier */ protected $orderNotifierMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Model\Order */ protected $orderMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Model\Order\Status\History */ protected $orderStatusHistoryMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Api\Data\OrderStatusHistorySearchResultInterface */ protected $orderSearchResultMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Event\ManagerInterface */ protected $eventManagerMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Model\Order\Email\Sender\OrderCommentSender + */ + protected $orderCommentSender; + protected function setUp() { $this->orderRepositoryMock = $this->getMockBuilder( @@ -116,13 +132,20 @@ protected function setUp() ) ->disableOriginalConstructor() ->getMock(); + $this->orderCommentSender = $this->getMockBuilder( + 'Magento\Sales\Model\Order\Email\Sender\OrderCommentSender' + ) + ->disableOriginalConstructor() + ->getMock(); + $this->orderService = new \Magento\Sales\Model\Service\OrderService( $this->orderRepositoryMock, $this->orderStatusHistoryRepositoryMock, $this->searchCriteriaBuilderMock, $this->filterBuilderMock, $this->orderNotifierMock, - $this->eventManagerMock + $this->eventManagerMock, + $this->orderCommentSender ); } @@ -174,6 +197,7 @@ public function testGetCommentsList() public function testAddComment() { + $clearComment = "Comment text here..."; $this->orderRepositoryMock->expects($this->once()) ->method('get') ->with(123) @@ -182,10 +206,16 @@ public function testAddComment() ->method('addStatusHistory') ->with($this->orderStatusHistoryMock) ->willReturn($this->orderMock); + $this->orderStatusHistoryMock->expects($this->once()) + ->method('getComment') + ->willReturn("

" . $clearComment); $this->orderRepositoryMock->expects($this->once()) ->method('save') ->with($this->orderMock) ->willReturn([]); + $this->orderCommentSender->expects($this->once()) + ->method('send') + ->with($this->orderMock, false, $clearComment); $this->assertTrue($this->orderService->addComment(123, $this->orderStatusHistoryMock)); } diff --git a/app/code/Magento/Sales/Test/Unit/Observer/GridProcessAddressChangeTest.php b/app/code/Magento/Sales/Test/Unit/Observer/GridProcessAddressChangeTest.php new file mode 100644 index 0000000000000..d6a8e5fab14f4 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Observer/GridProcessAddressChangeTest.php @@ -0,0 +1,51 @@ +gridPoolMock = $this->getMockBuilder('Magento\Sales\Model\ResourceModel\GridPool') + ->disableOriginalConstructor() + ->getMock(); + $this->eventObserverMock = $this->getMockBuilder('Magento\Framework\Event\Observer') + ->disableOriginalConstructor() + ->setMethods(['getOrderId']) + ->getMock(); + $this->observer = new \Magento\Sales\Observer\GridProcessAddressChange($this->gridPoolMock); + } + + public function testGridsReindex() + { + $this->eventObserverMock->expects($this->once()) + ->method('getOrderId') + ->willReturn(100500); + $this->gridPoolMock->expects($this->once()) + ->method('refreshByOrderId') + ->with(100500); + $this->assertNull($this->observer->execute($this->eventObserverMock)); + } +} diff --git a/app/code/Magento/Sales/etc/events.xml b/app/code/Magento/Sales/etc/events.xml index f02fcdd77a5bc..4dfe0d47c9c9a 100644 --- a/app/code/Magento/Sales/etc/events.xml +++ b/app/code/Magento/Sales/etc/events.xml @@ -33,6 +33,9 @@ + + + diff --git a/app/code/Magento/SalesRule/Model/Plugin/Rule.php b/app/code/Magento/SalesRule/Model/Plugin/Rule.php index 7bf8cb3c43d8a..8aa29ffe419e7 100644 --- a/app/code/Magento/SalesRule/Model/Plugin/Rule.php +++ b/app/code/Magento/SalesRule/Model/Plugin/Rule.php @@ -13,7 +13,7 @@ class Rule * @return \Magento\SalesRule\Model\Rule * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundLoadCouponCode( + public function aroundLoadRelations( \Magento\SalesRule\Model\Rule $subject, \Closure $proceed ) { diff --git a/app/code/Magento/SalesRule/Model/Rule.php b/app/code/Magento/SalesRule/Model/Rule.php index 200a836592c1c..4ecc75f77dd89 100644 --- a/app/code/Magento/SalesRule/Model/Rule.php +++ b/app/code/Magento/SalesRule/Model/Rule.php @@ -231,11 +231,23 @@ protected function _construct() */ protected function _afterLoad() { - $this->loadCouponCode(); + $this->loadRelations(); return parent::_afterLoad(); } /** + * Load all relative data + * + * @return void + */ + public function loadRelations() + { + $this->loadCouponCode(); + } + + /** + * Load coupon code + * * @return void */ public function loadCouponCode() diff --git a/app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php b/app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php index 1d1a6be10918d..9ceb8221d17a2 100644 --- a/app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php +++ b/app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php @@ -77,6 +77,7 @@ public function execute(EventObserver $observer) $rule = $this->_ruleFactory->create(); $rule->load($ruleId); if ($rule->getId()) { + $rule->loadCouponCode(); $rule->setTimesUsed($rule->getTimesUsed() + 1); $rule->save(); diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/Plugin/RuleTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/Plugin/RuleTest.php index fb788c5cf5b6f..a30a4acb36a0f 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/Plugin/RuleTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/Plugin/RuleTest.php @@ -14,7 +14,7 @@ class RuleTest extends \PHPUnit_Framework_TestCase protected $plugin; /**} - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\SalesRule\Model\Rule|\PHPUnit_Framework_MockObject_MockObject */ protected $subject; @@ -36,11 +36,11 @@ public function setUp() $this->plugin = $objectManager->getObject('Magento\SalesRule\Model\Plugin\Rule'); } - public function testLoadCouponCode() + public function testLoadRelations() { $this->assertEquals( $this->subject, - $this->plugin->aroundLoadCouponCode($this->subject, $this->genericClosure) + $this->plugin->aroundLoadRelations($this->subject, $this->genericClosure) ); } } diff --git a/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml b/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml index e7835bee90cc6..331903c8ced11 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/pager.phtml @@ -116,7 +116,7 @@ isShowPerPage()): ?>
- getAvailableLimit() as $_key => $_limit): ?>