diff --git a/app/code/Magento/Analytics/ReportXml/DB/SelectBuilder.php b/app/code/Magento/Analytics/ReportXml/DB/SelectBuilder.php index 81ee9b15781d1..b4b7adebf7459 100644 --- a/app/code/Magento/Analytics/ReportXml/DB/SelectBuilder.php +++ b/app/code/Magento/Analytics/ReportXml/DB/SelectBuilder.php @@ -11,6 +11,7 @@ /** * Responsible for Select object creation, works as a builder. Returns Select as result; + * * Used in SQL assemblers. */ class SelectBuilder @@ -85,11 +86,13 @@ public function getJoins() * Set joins conditions * * @param array $joins - * @return void + * @return $this */ public function setJoins($joins) { $this->joins = $joins; + + return $this; } /** @@ -106,11 +109,13 @@ public function getConnectionName() * Set connection name * * @param string $connectionName - * @return void + * @return $this */ public function setConnectionName($connectionName) { $this->connectionName = $connectionName; + + return $this; } /** @@ -127,11 +132,13 @@ public function getColumns() * Set columns * * @param array $columns - * @return void + * @return $this */ public function setColumns($columns) { $this->columns = $columns; + + return $this; } /** @@ -148,11 +155,13 @@ public function getFilters() * Set filters * * @param array $filters - * @return void + * @return $this */ public function setFilters($filters) { $this->filters = $filters; + + return $this; } /** @@ -169,11 +178,13 @@ public function getFrom() * Set from condition * * @param array $from - * @return void + * @return $this */ public function setFrom($from) { $this->from = $from; + + return $this; } /** @@ -236,11 +247,13 @@ public function getGroup() * Set group * * @param array $group - * @return void + * @return $this */ public function setGroup($group) { $this->group = $group; + + return $this; } /** @@ -257,11 +270,13 @@ public function getParams() * Set parameters * * @param array $params - * @return void + * @return $this */ public function setParams($params) { $this->params = $params; + + return $this; } /** @@ -278,10 +293,12 @@ public function getHaving() * Set having condition * * @param array $having - * @return void + * @return $this */ public function setHaving($having) { $this->having = $having; + + return $this; } } diff --git a/app/code/Magento/Analytics/Test/Unit/ReportXml/DB/SelectBuilderTest.php b/app/code/Magento/Analytics/Test/Unit/ReportXml/DB/SelectBuilderTest.php index 8be2f0ee968ef..a4362d583dfbc 100644 --- a/app/code/Magento/Analytics/Test/Unit/ReportXml/DB/SelectBuilderTest.php +++ b/app/code/Magento/Analytics/Test/Unit/ReportXml/DB/SelectBuilderTest.php @@ -64,12 +64,12 @@ public function testCreate() ['link-type' => 'right', 'table' => 'attribute', 'condition' => 'neq'], ]; $groups = ['id', 'name']; - $this->selectBuilder->setConnectionName($connectionName); - $this->selectBuilder->setFrom($from); - $this->selectBuilder->setColumns($columns); - $this->selectBuilder->setFilters([$filter]); - $this->selectBuilder->setJoins($joins); - $this->selectBuilder->setGroup($groups); + $this->selectBuilder->setConnectionName($connectionName) + ->setFrom($from) + ->setColumns($columns) + ->setFilters([$filter]) + ->setJoins($joins) + ->setGroup($groups); $this->resourceConnectionMock->expects($this->once()) ->method('getConnection') ->with($connectionName) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml index 805e9783f3f18..52d5dd6d114ee 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml @@ -43,7 +43,7 @@ data-validate="{required:true}" value="" placeholder="" - autocomplete="new-password" + autocomplete="off" /> diff --git a/app/code/Magento/Bundle/etc/db_schema.xml b/app/code/Magento/Bundle/etc/db_schema.xml index 8092f34c533fa..f1c1e7ae782dc 100644 --- a/app/code/Magento/Bundle/etc/db_schema.xml +++ b/app/code/Magento/Bundle/etc/db_schema.xml @@ -120,11 +120,11 @@ + comment="Entity ID"/> + comment="Customer Group ID"/> + comment="Entity ID"/> + comment="Website ID"/> + comment="Stock ID"/> + comment="Entity ID"/> + comment="Website ID"/> + default="0" comment="Tax Class ID"/> + comment="Entity ID"/> + comment="Website ID"/> + default="0" comment="Tax Class ID"/> + comment="Entity ID"/> + comment="Website ID"/> + comment="Entity ID"/> + comment="Website ID"/> + comment="Entity ID"/> + comment="Website ID"/> + comment="Entity ID"/> + comment="Website ID"/> providers[$type]->getLinkedProducts($product); $converter = $this->converterPool->getConverter($type); - $output = []; $sorterItems = []; foreach ($products as $item) { - $output[$item->getId()] = $converter->convert($item); + $itemId = $item->getId(); + $sorterItems[$itemId] = $converter->convert($item); + $sorterItems[$itemId]['position'] = $sorterItems[$itemId]['position'] ?? 0; } - foreach ($output as $item) { - $itemPosition = $item['position']; - if (!isset($sorterItems[$itemPosition])) { - $sorterItems[$itemPosition] = $item; - } else { - $newPosition = $itemPosition + 1; - $sorterItems[$newPosition] = $item; - } - } - ksort($sorterItems); + usort($sorterItems, function ($itemA, $itemB) { + $posA = intval($itemA['position']); + $posB = intval($itemB['position']); + + return $posA <=> $posB; + }); + return $sorterItems; } } diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductContentSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductContentSection.xml index a2ad155672a1a..784eff12a6c04 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductContentSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductContentSection.xml @@ -13,5 +13,6 @@ + diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml new file mode 100644 index 0000000000000..060720ab007eb --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml @@ -0,0 +1,129 @@ + + + + + + + + + + <description value="Product image should be deleted from all scopes"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-94265"/> + <group value="Catalog"/> + </annotations> + <before> + <!--Create 2 websites (with stores, store views)--> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="_defaultCategory" stepKey="category"/> + <createData entity="_defaultProduct" stepKey="product"> + <requiredEntity createDataKey="category"/> + </createData> + <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite"> + <argument name="newWebsiteName" value="FirstWebSite"/> + <argument name="websiteCode" value="FirstWebSiteCode"/> + </actionGroup> + <actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore" after="createWebsite"> + <argument name="website" value="FirstWebSite"/> + <argument name="storeGroupName" value="NewStore"/> + <argument name="storeGroupCode" value="Base1"/> + </actionGroup> + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView" after="createNewStore"> + <argument name="StoreGroup" value="staticFirstStoreGroup"/> + <argument name="customStore" value="staticStore"/> + </actionGroup> + + <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createSecondWebsite" after="createCustomStoreView"> + <argument name="newWebsiteName" value="SecondWebSite"/> + <argument name="websiteCode" value="SecondWebSiteCode"/> + </actionGroup> + <actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createSecondStore" after="createSecondWebsite"> + <argument name="website" value="SecondWebSite"/> + <argument name="storeGroupName" value="SecondStore"/> + <argument name="storeGroupCode" value="Base2"/> + </actionGroup> + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView2" after="createSecondStore"> + <argument name="StoreGroup" value="staticStoreGroup"/> + <argument name="customStore" value="staticSecondStore"/> + </actionGroup> + </before> + + <after> + <actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/> + <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> + <argument name="websiteName" value="FirstWebSite"/> + </actionGroup> + + <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite"> + <argument name="websiteName" value="SecondWebSite"/> + </actionGroup> + <deleteData createDataKey="category" stepKey="deletePreReqCategory"/> + <deleteData createDataKey="product" stepKey="deleteFirstProduct"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Create product--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPage"/> + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> + + <!--Open created product--> + <click selector="{{AdminProductGridSection.productGridNameProduct($$product.name$$)}}" stepKey="createdProduct"/> + <waitForPageLoad stepKey="waitForOpenedCreatedProduct"/> + + <!-- Add image to product --> + <actionGroup ref="addProductImage" stepKey="addFirstImageForProduct"> + <argument name="image" value="TestImageNew"/> + </actionGroup> + + <!-- Add second image to product --> + <actionGroup ref="addProductImage" stepKey="addSecondImageForProduct"> + <argument name="image" value="MagentoLogo"/> + </actionGroup> + <!--"Product in Websites": select both Websites--> + <actionGroup ref="ProductSetWebsite" stepKey="ProductSetWebsite1"> + <argument name="website" value="FirstWebSite"/> + </actionGroup> + <actionGroup ref="ProductSetWebsite" stepKey="ProductSetWebsite2"> + <argument name="website" value="SecondWebSite"/> + </actionGroup> + + <!--Go to "Catalog" -> "Products". Open created product--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoaded"/> + <click selector="{{AdminProductGridSection.productGridNameProduct($$product.name$$)}}" stepKey="openCreatedProduct"/> + <waitForPageLoad stepKey="waitForCreatedProductOpened"/> + + <!--Delete Image 1--> + <actionGroup ref="removeProductImage" stepKey="removeProductImage"/> + + <!--Click "Save" in the upper right corner--> + <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + + <!--Switch to "Store view 1"--> + <actionGroup ref="SwitchToTheNewStoreView" stepKey="selectStoreView"> + <argument name="storeViewName" value="Store View"/> + </actionGroup> + + <!-- Assert product first image not in admin product form --> + <actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInAdminProductPage"> + <argument name="image" value="TestImageNew"/> + </actionGroup> + + <!--Switch to "Store view 2"--> + <actionGroup ref="SwitchToTheNewStoreView" stepKey="selectSecondStoreView"> + <argument name="storeViewName" value="Second Store View"/> + </actionGroup> + + <!-- Verify that Image 1 is deleted from the Second Store View list --> + <actionGroup ref="assertProductImageNotInAdminProductPage" stepKey="assertProductImageNotInSecondStoreViewPage"> + <argument name="image" value="TestImageNew"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Unit/Model/CollectionProviderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/CollectionProviderTest.php index d8931cbbfcf73..f0e17c7938b27 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/CollectionProviderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/CollectionProviderTest.php @@ -57,10 +57,14 @@ public function testGetCollection() $linkedProductOneMock = $this->createMock(Product::class); $linkedProductTwoMock = $this->createMock(Product::class); $linkedProductThreeMock = $this->createMock(Product::class); + $linkedProductFourMock = $this->createMock(Product::class); + $linkedProductFiveMock = $this->createMock(Product::class); $linkedProductOneMock->expects($this->once())->method('getId')->willReturn(1); $linkedProductTwoMock->expects($this->once())->method('getId')->willReturn(2); $linkedProductThreeMock->expects($this->once())->method('getId')->willReturn(3); + $linkedProductFourMock->expects($this->once())->method('getId')->willReturn(4); + $linkedProductFiveMock->expects($this->once())->method('getId')->willReturn(5); $this->converterPoolMock->expects($this->once()) ->method('getConverter') @@ -71,9 +75,11 @@ public function testGetCollection() [$linkedProductOneMock, ['name' => 'Product One', 'position' => 10]], [$linkedProductTwoMock, ['name' => 'Product Two', 'position' => 2]], [$linkedProductThreeMock, ['name' => 'Product Three', 'position' => 2]], + [$linkedProductFourMock, ['name' => 'Product Four', 'position' => null]], + [$linkedProductFiveMock, ['name' => 'Product Five']], ]; - $this->converterMock->expects($this->exactly(3))->method('convert')->willReturnMap($map); + $this->converterMock->expects($this->exactly(5))->method('convert')->willReturnMap($map); $this->providerMock->expects($this->once()) ->method('getLinkedProducts') @@ -82,14 +88,18 @@ public function testGetCollection() [ $linkedProductOneMock, $linkedProductTwoMock, - $linkedProductThreeMock + $linkedProductThreeMock, + $linkedProductFourMock, + $linkedProductFiveMock, ] ); $expectedResult = [ - 2 => ['name' => 'Product Two', 'position' => 2], - 3 => ['name' => 'Product Three', 'position' => 2], - 10 => ['name' => 'Product One', 'position' => 10], + 0 => ['name' => 'Product Four', 'position' => 0], + 1 => ['name' => 'Product Five', 'position' => 0], + 2 => ['name' => 'Product Three', 'position' => 2], + 3 => ['name' => 'Product Two', 'position' => 2], + 4 => ['name' => 'Product One', 'position' => 10], ]; $actualResult = $this->model->getCollection($this->productMock, 'crosssell'); diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php index ed737df708ab8..681435851fbde 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php @@ -118,7 +118,7 @@ private function getCacheManager() } /** - * {@inheritdoc} + * @inheritdoc * @since 101.0.0 */ public function modifyMeta(array $meta) @@ -130,7 +130,7 @@ public function modifyMeta(array $meta) } /** - * {@inheritdoc} + * @inheritdoc * @since 101.0.0 */ public function modifyData(array $data) @@ -289,6 +289,7 @@ protected function customizeCategoriesField(array $meta) 'source' => 'product_details', 'displayArea' => 'insideGroup', 'sortOrder' => 20, + 'dataScope' => $fieldCode, ], ], ] diff --git a/app/code/Magento/Catalog/etc/db_schema.xml b/app/code/Magento/Catalog/etc/db_schema.xml index 7b4e1a96adda0..860e5fee9f157 100644 --- a/app/code/Magento/Catalog/etc/db_schema.xml +++ b/app/code/Magento/Catalog/etc/db_schema.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> <table name="catalog_product_entity" resource="default" engine="innodb" comment="Catalog Product Table"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="smallint" name="attribute_set_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Attribute Set ID"/> <column xsi:type="varchar" name="type_id" nullable="false" length="32" default="simple" comment="Type ID"/> @@ -41,7 +41,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="datetime" name="value" on_update="false" nullable="true" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -76,7 +76,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="decimal" name="value" scale="4" precision="12" unsigned="false" nullable="true" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -112,7 +112,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="int" name="value" padding="11" unsigned="false" nullable="true" identity="false" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -148,7 +148,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="text" name="value" nullable="true" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -183,7 +183,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="varchar" name="value" nullable="true" length="255" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -218,7 +218,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="int" name="position" padding="11" unsigned="false" nullable="false" identity="false" default="0" comment="Position"/> <column xsi:type="varchar" name="value" nullable="true" length="255" comment="Value"/> @@ -251,7 +251,7 @@ </table> <table name="catalog_category_entity" resource="default" engine="innodb" comment="Catalog Category Table"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="smallint" name="attribute_set_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Attribute Set ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" @@ -286,7 +286,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="datetime" name="value" on_update="false" nullable="true" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -324,7 +324,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="decimal" name="value" scale="4" precision="12" unsigned="false" nullable="true" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -363,7 +363,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="int" name="value" padding="11" unsigned="false" nullable="true" identity="false" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -402,7 +402,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="text" name="value" nullable="true" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -440,7 +440,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="varchar" name="value" nullable="true" length="255" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -738,7 +738,7 @@ <column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" comment="Value ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="smallint" name="all_groups" padding="5" unsigned="true" nullable="false" identity="false" default="1" comment="Is Applicable To All Customer Groups"/> <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false" @@ -805,7 +805,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0"/> + default="0" comment="Entity ID"/> <column xsi:type="varchar" name="label" nullable="true" length="255" comment="Label"/> <column xsi:type="int" name="position" padding="10" unsigned="true" nullable="true" identity="false" comment="Position"/> @@ -1651,7 +1651,8 @@ comment="Link Media value to Product entity table"> <column xsi:type="int" name="value_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Value media Entry ID"/> - <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"/> + <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" + comment="Product Entity ID"/> <constraint xsi:type="foreign" name="FK_A6C6C8FAA386736921D3A7C4B50B1185" table="catalog_product_entity_media_gallery_value_to_entity" column="value_id" referenceTable="catalog_product_entity_media_gallery" referenceColumn="value_id" diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index b755d91e403ff..7c56c266a64ef 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -5,6 +5,7 @@ */ namespace Magento\CatalogImportExport\Model\Import; +use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Config as CatalogConfig; use Magento\Catalog\Model\Product\Visibility; use Magento\CatalogImportExport\Model\Import\Product\MediaGalleryProcessor; @@ -15,6 +16,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Filesystem; use Magento\Framework\Intl\DateTimeFactory; use Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor; @@ -732,6 +734,11 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity */ private $dateTimeFactory; + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + /** * @param \Magento\Framework\Json\Helper\Data $jsonHelper * @param \Magento\ImportExport\Helper\Data $importExportData @@ -776,7 +783,9 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param MediaGalleryProcessor $mediaProcessor * @param StockItemImporterInterface|null $stockItemImporter * @param DateTimeFactory $dateTimeFactory + * @param ProductRepositoryInterface|null $productRepository * @SuppressWarnings(PHPMD.ExcessiveParameterList) + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function __construct( \Magento\Framework\Json\Helper\Data $jsonHelper, @@ -821,7 +830,8 @@ public function __construct( ImageTypeProcessor $imageTypeProcessor = null, MediaGalleryProcessor $mediaProcessor = null, StockItemImporterInterface $stockItemImporter = null, - DateTimeFactory $dateTimeFactory = null + DateTimeFactory $dateTimeFactory = null, + ProductRepositoryInterface $productRepository = null ) { $this->_eventManager = $eventManager; $this->stockRegistry = $stockRegistry; @@ -875,6 +885,8 @@ public function __construct( ->initImagesArrayKeys(); $this->validator->init($this); $this->dateTimeFactory = $dateTimeFactory ?? ObjectManager::getInstance()->get(DateTimeFactory::class); + $this->productRepository = $productRepository ?? ObjectManager::getInstance() + ->get(ProductRepositoryInterface::class); } /** @@ -1698,6 +1710,14 @@ protected function _saveProducts() $websiteId = $this->storeResolver->getWebsiteCodeToId($websiteCode); $this->websitesCache[$rowSku][$websiteId] = true; } + } else { + $product = $this->retrieveProductBySku($rowSku); + if ($product) { + $websiteIds = $product->getWebsiteIds(); + foreach ($websiteIds as $websiteId) { + $this->websitesCache[$rowSku][$websiteId] = true; + } + } } // 3. Categories phase @@ -1996,6 +2016,11 @@ protected function processRowCategories($rowData) . ' ' . $error['exception']->getMessage() ); } + } else { + $product = $this->retrieveProductBySku($rowData['sku']); + if ($product) { + $categoryIds = $product->getCategoryIds(); + } } return $categoryIds; } @@ -2998,4 +3023,20 @@ private function formatStockDataForRow(array $rowData): array return $row; } + + /** + * Retrieve product by sku. + * + * @param string $sku + * @return \Magento\Catalog\Api\Data\ProductInterface|null + */ + private function retrieveProductBySku($sku) + { + try { + $product = $this->productRepository->get($sku); + } catch (NoSuchEntityException $e) { + return null; + } + return $product; + } } diff --git a/app/code/Magento/CatalogRule/etc/db_schema.xml b/app/code/Magento/CatalogRule/etc/db_schema.xml index f4c40a6930cc0..25c9d866167ce 100644 --- a/app/code/Magento/CatalogRule/etc/db_schema.xml +++ b/app/code/Magento/CatalogRule/etc/db_schema.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> <table name="catalogrule" resource="default" engine="innodb" comment="CatalogRule"> <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="name" nullable="true" length="255" comment="Name"/> <column xsi:type="text" name="description" nullable="true" comment="Description"/> <column xsi:type="date" name="from_date" comment="From"/> @@ -39,7 +39,7 @@ <column xsi:type="int" name="rule_product_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Rule Product Id"/> <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" default="0" - comment="Rule Id"/> + comment="Rule ID"/> <column xsi:type="int" name="from_time" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="From Time"/> <column xsi:type="int" name="to_time" padding="10" unsigned="true" nullable="false" identity="false" default="0" @@ -119,7 +119,7 @@ </table> <table name="catalogrule_group_website" resource="default" engine="innodb" comment="CatalogRule Group Website"> <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" default="0" - comment="Rule Id"/> + comment="Rule ID"/> <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="Customer Group Id"/> <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false" @@ -137,7 +137,8 @@ </index> </table> <table name="catalogrule_website" resource="default" engine="innodb" comment="Catalog Rules To Websites Relations"> - <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"/> + <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" + comment="Rule ID"/> <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false" comment="Website Id"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -156,7 +157,8 @@ </table> <table name="catalogrule_customer_group" resource="default" engine="innodb" comment="Catalog Rules To Customer Groups Relations"> - <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"/> + <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" + comment="Rule ID"/> <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Customer Group Id"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -177,7 +179,7 @@ <column xsi:type="int" name="rule_product_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Rule Product Id"/> <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" default="0" - comment="Rule Id"/> + comment="Rule ID"/> <column xsi:type="int" name="from_time" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="From Time"/> <column xsi:type="int" name="to_time" padding="10" unsigned="true" nullable="false" identity="false" default="0" @@ -259,7 +261,7 @@ <table name="catalogrule_group_website_replica" resource="default" engine="innodb" comment="CatalogRule Group Website"> <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" default="0" - comment="Rule Id"/> + comment="Rule ID"/> <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="Customer Group Id"/> <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false" diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/CategoryProcessUrlRewriteMovingObserverTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/CategoryProcessUrlRewriteMovingObserverTest.php new file mode 100644 index 0000000000000..b12da6243a903 --- /dev/null +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/CategoryProcessUrlRewriteMovingObserverTest.php @@ -0,0 +1,144 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogUrlRewrite\Test\Unit\Observer; + +use Magento\Catalog\Model\Category; +use Magento\CatalogUrlRewrite\Block\UrlKeyRenderer; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; +use Magento\CatalogUrlRewrite\Model\Map\DatabaseMapPool; +use Magento\CatalogUrlRewrite\Model\Map\DataCategoryUrlRewriteDatabaseMap; +use Magento\CatalogUrlRewrite\Model\Map\DataProductUrlRewriteDatabaseMap; +use Magento\CatalogUrlRewrite\Model\UrlRewriteBunchReplacer; +use Magento\CatalogUrlRewrite\Observer\CategoryProcessUrlRewriteMovingObserver; +use Magento\CatalogUrlRewrite\Observer\UrlRewriteHandler; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use Magento\UrlRewrite\Model\UrlPersistInterface; + +/** + * Class CategoryProcessUrlRewriteMovingObserverTest + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class CategoryProcessUrlRewriteMovingObserverTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var CategoryProcessUrlRewriteMovingObserver + */ + private $observer; + + /** + * @var CategoryUrlRewriteGenerator|\PHPUnit_Framework_MockObject_MockObject + */ + private $categoryUrlRewriteGeneratorMock; + + /** + * @var UrlPersistInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $urlPersistMock; + + /** + * @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $scopeConfigMock; + + /** + * @var UrlRewriteHandler|\PHPUnit_Framework_MockObject_MockObject + */ + private $urlRewriteHandlerMock; + + /** + * @var DatabaseMapPool|\PHPUnit_Framework_MockObject_MockObject + */ + private $databaseMapPoolMock; + + /** + * Set Up + */ + protected function setUp() + { + $this->categoryUrlRewriteGeneratorMock = $this->createMock(CategoryUrlRewriteGenerator::class); + $this->urlPersistMock = $this->createMock(UrlPersistInterface::class); + $this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class); + $this->urlRewriteHandlerMock = $this->createMock(UrlRewriteHandler::class); + /** @var UrlRewriteBunchReplacer|\PHPUnit_Framework_MockObject_MockObject $urlRewriteMock */ + $urlRewriteMock = $this->createMock(UrlRewriteBunchReplacer::class); + $this->databaseMapPoolMock = $this->createMock(DatabaseMapPool::class); + + $this->observer = new CategoryProcessUrlRewriteMovingObserver( + $this->categoryUrlRewriteGeneratorMock, + $this->urlPersistMock, + $this->scopeConfigMock, + $this->urlRewriteHandlerMock, + $urlRewriteMock, + $this->databaseMapPoolMock, + [ + DataCategoryUrlRewriteDatabaseMap::class, + DataProductUrlRewriteDatabaseMap::class + ] + ); + } + + /** + * Test category process rewrite url by changing the parent + * + * @return void + */ + public function testCategoryProcessUrlRewriteAfterMovingWithChangedParentId() + { + /** @var Observer|\PHPUnit_Framework_MockObject_MockObject $observerMock */ + $observerMock = $this->createMock(Observer::class); + $eventMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->setMethods(['getCategory']) + ->getMock(); + $categoryMock = $this->createPartialMock(Category::class, [ + 'dataHasChangedFor', + 'getEntityId', + 'getStoreId', + 'setData' + ]); + + $categoryMock->expects($this->once())->method('dataHasChangedFor')->with('parent_id') + ->willReturn(true); + $eventMock->expects($this->once())->method('getCategory')->willReturn($categoryMock); + $observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock); + $this->scopeConfigMock->expects($this->once())->method('isSetFlag') + ->with(UrlKeyRenderer::XML_PATH_SEO_SAVE_HISTORY)->willReturn(true); + $this->categoryUrlRewriteGeneratorMock->expects($this->once())->method('generate') + ->with($categoryMock, true)->willReturn(['category-url-rewrite']); + $this->urlRewriteHandlerMock->expects($this->once())->method('generateProductUrlRewrites') + ->with($categoryMock)->willReturn(['product-url-rewrite']); + $this->databaseMapPoolMock->expects($this->exactly(2))->method('resetMap')->willReturnSelf(); + + $this->observer->execute($observerMock); + } + + /** + * Test category process rewrite url without changing the parent + * + * @return void + */ + public function testCategoryProcessUrlRewriteAfterMovingWithinNotChangedParent() + { + /** @var Observer|\PHPUnit_Framework_MockObject_MockObject $observerMock */ + $observerMock = $this->createMock(Observer::class); + $eventMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->setMethods(['getCategory']) + ->getMock(); + $categoryMock = $this->createPartialMock(Category::class, ['dataHasChangedFor']); + $observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock); + $eventMock->expects($this->once())->method('getCategory')->willReturn($categoryMock); + $categoryMock->expects($this->once())->method('dataHasChangedFor')->with('parent_id') + ->willReturn(false); + + $this->observer->execute($observerMock); + } +} diff --git a/app/code/Magento/Cms/etc/db_schema.xml b/app/code/Magento/Cms/etc/db_schema.xml index 2b825544f56f1..3f97a94d54943 100644 --- a/app/code/Magento/Cms/etc/db_schema.xml +++ b/app/code/Magento/Cms/etc/db_schema.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> <table name="cms_block" resource="default" engine="innodb" comment="CMS Block Table"> <column xsi:type="smallint" name="block_id" padding="6" unsigned="false" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="title" nullable="false" length="255" comment="Block Title"/> <column xsi:type="varchar" name="identifier" nullable="false" length="255" comment="Block String Identifier"/> <column xsi:type="mediumtext" name="content" nullable="true" comment="Block Content"/> @@ -46,7 +46,7 @@ </table> <table name="cms_page" resource="default" engine="innodb" comment="CMS Page Table"> <column xsi:type="smallint" name="page_id" padding="6" unsigned="false" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="title" nullable="true" length="255" comment="Page Title"/> <column xsi:type="varchar" name="page_layout" nullable="true" length="255" comment="Page Layout"/> <column xsi:type="text" name="meta_keywords" nullable="true" comment="Page Meta Keywords"/> @@ -86,7 +86,8 @@ </index> </table> <table name="cms_page_store" resource="default" engine="innodb" comment="CMS Page To Store Linkage Table"> - <column xsi:type="smallint" name="page_id" padding="6" unsigned="false" nullable="false" identity="false"/> + <column xsi:type="smallint" name="page_id" padding="6" unsigned="false" nullable="false" identity="false" + comment="Entity ID"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" comment="Store ID"/> <constraint xsi:type="primary" name="PRIMARY"> diff --git a/app/code/Magento/Customer/etc/db_schema.xml b/app/code/Magento/Customer/etc/db_schema.xml index 368ca417432fd..657083b58e1b1 100644 --- a/app/code/Magento/Customer/etc/db_schema.xml +++ b/app/code/Magento/Customer/etc/db_schema.xml @@ -9,15 +9,15 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> <table name="customer_entity" resource="default" engine="innodb" comment="Customer Entity"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="true" identity="false" - comment="Website Id"/> + comment="Website ID"/> <column xsi:type="varchar" name="email" nullable="true" length="255" comment="Email"/> <column xsi:type="smallint" name="group_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Group Id"/> + default="0" comment="Group ID"/> <column xsi:type="varchar" name="increment_id" nullable="true" length="50" comment="Increment Id"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false" - default="0" comment="Store Id"/> + default="0" comment="Store ID"/> <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At"/> <column xsi:type="timestamp" name="updated_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP" @@ -77,10 +77,10 @@ </table> <table name="customer_address_entity" resource="default" engine="innodb" comment="Customer Address Entity"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="increment_id" nullable="true" length="50" comment="Increment Id"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="true" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At"/> <column xsi:type="timestamp" name="updated_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP" @@ -128,7 +128,7 @@ <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Attribute Id"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="datetime" name="value" on_update="false" nullable="true" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -159,7 +159,7 @@ <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Attribute Id"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="decimal" name="value" scale="4" precision="12" unsigned="false" nullable="false" default="0" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -186,11 +186,11 @@ </table> <table name="customer_address_entity_int" resource="default" engine="innodb" comment="Customer Address Entity Int"> <column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" - comment="Value Id"/> + comment="Value ID"/> <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Attribute Id"/> + default="0" comment="Attribute ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="int" name="value" padding="11" unsigned="false" nullable="false" identity="false" default="0" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -218,11 +218,11 @@ <table name="customer_address_entity_text" resource="default" engine="innodb" comment="Customer Address Entity Text"> <column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" - comment="Value Id"/> + comment="Value ID"/> <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Attribute Id"/> + default="0" comment="Attribute ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="text" name="value" nullable="false" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -244,11 +244,11 @@ <table name="customer_address_entity_varchar" resource="default" engine="innodb" comment="Customer Address Entity Varchar"> <column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" - comment="Value Id"/> + comment="Value ID"/> <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Attribute Id"/> + default="0" comment="Attribute ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="varchar" name="value" nullable="true" length="255" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -274,11 +274,11 @@ </table> <table name="customer_entity_datetime" resource="default" engine="innodb" comment="Customer Entity Datetime"> <column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" - comment="Value Id"/> + comment="Value ID"/> <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Attribute Id"/> + default="0" comment="Attribute ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="datetime" name="value" on_update="false" nullable="true" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -304,11 +304,11 @@ </table> <table name="customer_entity_decimal" resource="default" engine="innodb" comment="Customer Entity Decimal"> <column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" - comment="Value Id"/> + comment="Value ID"/> <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Attribute Id"/> + default="0" comment="Attribute ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="decimal" name="value" scale="4" precision="12" unsigned="false" nullable="false" default="0" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -335,11 +335,11 @@ </table> <table name="customer_entity_int" resource="default" engine="innodb" comment="Customer Entity Int"> <column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" - comment="Value Id"/> + comment="Value ID"/> <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Attribute Id"/> + default="0" comment="Attribute ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="int" name="value" padding="11" unsigned="false" nullable="false" identity="false" default="0" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -366,11 +366,11 @@ </table> <table name="customer_entity_text" resource="default" engine="innodb" comment="Customer Entity Text"> <column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" - comment="Value Id"/> + comment="Value ID"/> <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Attribute Id"/> + default="0" comment="Attribute ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="text" name="value" nullable="false" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -391,11 +391,11 @@ </table> <table name="customer_entity_varchar" resource="default" engine="innodb" comment="Customer Entity Varchar"> <column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" - comment="Value Id"/> + comment="Value ID"/> <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Attribute Id"/> + default="0" comment="Attribute ID"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="varchar" name="value" nullable="true" length="255" comment="Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php b/app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php index a2c9611d26f5d..4e4e146208a47 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php @@ -10,6 +10,9 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\StateException; +/** + * Eav Option Management + */ class OptionManagement implements \Magento\Eav\Api\AttributeOptionManagementInterface { /** @@ -36,7 +39,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function add($entityType, $attributeCode, $option) { @@ -79,7 +82,7 @@ public function add($entityType, $attributeCode, $option) } /** - * {@inheritdoc} + * @inheritdoc */ public function delete($entityType, $attributeCode, $optionId) { @@ -110,7 +113,7 @@ public function delete($entityType, $attributeCode, $optionId) } /** - * {@inheritdoc} + * @inheritdoc */ public function getItems($entityType, $attributeCode) { @@ -129,6 +132,8 @@ public function getItems($entityType, $attributeCode) } /** + * Validate option + * * @param \Magento\Eav\Api\Data\AttributeInterface $attribute * @param int $optionId * @throws NoSuchEntityException @@ -148,15 +153,19 @@ protected function validateOption($attribute, $optionId) } /** + * Returns option id + * * @param \Magento\Eav\Api\Data\AttributeOptionInterface $option * @return string */ private function getOptionId(\Magento\Eav\Api\Data\AttributeOptionInterface $option) : string { - return $option->getValue() ?: 'new_option'; + return 'id_' . ($option->getValue() ?: 'new_option'); } /** + * Set option value + * * @param \Magento\Eav\Api\Data\AttributeOptionInterface $option * @param \Magento\Eav\Api\Data\AttributeInterface $attribute * @param string $optionLabel diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/OptionManagementTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/OptionManagementTest.php index 2ae31a05d957f..b63a4dd2c9ae6 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/OptionManagementTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/OptionManagementTest.php @@ -59,13 +59,13 @@ public function testAdd() $labelMock = $this->createMock(\Magento\Eav\Api\Data\AttributeOptionLabelInterface::class); $option = ['value' => [ - 'new_option' => [ + 'id_new_option' => [ 0 => 'optionLabel', 42 => 'labelLabel', ], ], 'order' => [ - 'new_option' => 'optionSortOrder', + 'id_new_option' => 'optionSortOrder', ], ]; @@ -78,10 +78,10 @@ public function testAdd() $labelMock->expects($this->once())->method('getStoreId')->willReturn(42); $labelMock->expects($this->once())->method('getLabel')->willReturn('labelLabel'); $optionMock->expects($this->once())->method('getIsDefault')->willReturn(true); - $attributeMock->expects($this->once())->method('setDefault')->with(['new_option']); + $attributeMock->expects($this->once())->method('setDefault')->with(['id_new_option']); $attributeMock->expects($this->once())->method('setOption')->with($option); $this->resourceModelMock->expects($this->once())->method('save')->with($attributeMock); - $this->assertEquals('new_option', $this->model->add($entityType, $attributeCode, $optionMock)); + $this->assertEquals('id_new_option', $this->model->add($entityType, $attributeCode, $optionMock)); } /** @@ -167,13 +167,13 @@ public function testAddWithCannotSaveException() $labelMock = $this->createMock(\Magento\Eav\Api\Data\AttributeOptionLabelInterface::class); $option = ['value' => [ - 'new_option' => [ + 'id_new_option' => [ 0 => 'optionLabel', 42 => 'labelLabel', ], ], 'order' => [ - 'new_option' => 'optionSortOrder', + 'id_new_option' => 'optionSortOrder', ], ]; @@ -186,7 +186,7 @@ public function testAddWithCannotSaveException() $labelMock->expects($this->once())->method('getStoreId')->willReturn(42); $labelMock->expects($this->once())->method('getLabel')->willReturn('labelLabel'); $optionMock->expects($this->once())->method('getIsDefault')->willReturn(true); - $attributeMock->expects($this->once())->method('setDefault')->with(['new_option']); + $attributeMock->expects($this->once())->method('setDefault')->with(['id_new_option']); $attributeMock->expects($this->once())->method('setOption')->with($option); $this->resourceModelMock->expects($this->once())->method('save')->with($attributeMock) ->willThrowException(new \Exception()); diff --git a/app/code/Magento/Eav/etc/db_schema.xml b/app/code/Magento/Eav/etc/db_schema.xml index f930321e5259b..e81fad5ebded8 100644 --- a/app/code/Magento/Eav/etc/db_schema.xml +++ b/app/code/Magento/Eav/etc/db_schema.xml @@ -15,7 +15,7 @@ <column xsi:type="varchar" name="attribute_model" nullable="true" length="255" comment="Attribute Model"/> <column xsi:type="varchar" name="entity_table" nullable="true" length="255" comment="Entity Table"/> <column xsi:type="varchar" name="value_table_prefix" nullable="true" length="255" comment="Value Table Prefix"/> - <column xsi:type="varchar" name="entity_id_field" nullable="true" length="255" comment="Entity Id Field"/> + <column xsi:type="varchar" name="entity_id_field" nullable="true" length="255" comment="Entity ID Field"/> <column xsi:type="smallint" name="is_data_sharing" padding="5" unsigned="true" nullable="false" identity="false" default="1" comment="Defines Is Data Sharing"/> <column xsi:type="varchar" name="data_sharing_key" nullable="true" length="100" default="default" @@ -42,7 +42,7 @@ </table> <table name="eav_entity" resource="default" engine="innodb" comment="Eav Entity"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="smallint" name="entity_type_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Entity Type Id"/> <column xsi:type="smallint" name="attribute_set_id" padding="5" unsigned="true" nullable="false" @@ -83,7 +83,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store Id"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="datetime" name="value" on_update="false" nullable="true" comment="Attribute Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -123,7 +123,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store Id"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="decimal" name="value" scale="4" precision="12" unsigned="false" nullable="false" default="0" comment="Attribute Value"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -164,7 +164,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store Id"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="int" name="value" padding="11" unsigned="false" nullable="false" identity="false" default="0" comment="Attribute Value"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -204,7 +204,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store Id"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="text" name="value" nullable="false" comment="Attribute Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> @@ -241,7 +241,7 @@ <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store Id"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="varchar" name="value" nullable="true" length="255" comment="Attribute Value"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="value_id"/> diff --git a/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml b/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml index 34de1a18cf28a..d9238e9794d7e 100644 --- a/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml +++ b/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml @@ -26,7 +26,7 @@ if ($minProduct) { ); } ?> -<div class="price-box" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> +<div class="price-box"> <?php if ($minProduct && \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW != $block->getZone()): ?> <p class="minimal-price"> <span class="price-label"><?= /* @escapeNotVerified */ __('Starting at') ?></span><?= $amountRender->toHtml() ?> diff --git a/app/code/Magento/Integration/etc/db_schema.xml b/app/code/Magento/Integration/etc/db_schema.xml index 9e81b867d36d5..33173df4f6c0b 100644 --- a/app/code/Magento/Integration/etc/db_schema.xml +++ b/app/code/Magento/Integration/etc/db_schema.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> <table name="oauth_consumer" resource="default" engine="innodb" comment="OAuth Consumers"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At"/> <column xsi:type="timestamp" name="updated_at" on_update="true" nullable="true" default="0" diff --git a/app/code/Magento/NewRelicReporting/etc/db_schema.xml b/app/code/Magento/NewRelicReporting/etc/db_schema.xml index 6f9ce29436f65..f6d463de0ce33 100644 --- a/app/code/Magento/NewRelicReporting/etc/db_schema.xml +++ b/app/code/Magento/NewRelicReporting/etc/db_schema.xml @@ -10,7 +10,7 @@ <table name="reporting_counts" resource="default" engine="innodb" comment="Reporting for all count related events generated via the cron job"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="type" nullable="true" length="255" comment="Item Reported"/> <column xsi:type="int" name="count" padding="10" unsigned="true" nullable="true" identity="false" comment="Count Value"/> @@ -35,9 +35,9 @@ </table> <table name="reporting_orders" resource="default" engine="innodb" comment="Reporting for all orders"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="true" identity="false" - comment="Customer Id"/> + comment="Customer ID"/> <column xsi:type="decimal" name="total" scale="0" precision="10" unsigned="true" nullable="true"/> <column xsi:type="decimal" name="total_base" scale="0" precision="10" unsigned="true" nullable="true"/> <column xsi:type="int" name="item_count" padding="10" unsigned="true" nullable="false" identity="false" @@ -50,7 +50,7 @@ </table> <table name="reporting_users" resource="default" engine="innodb" comment="Reporting for user actions"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="type" nullable="true" length="255" comment="User Type"/> <column xsi:type="varchar" name="action" nullable="true" length="255" comment="Action Performed"/> <column xsi:type="timestamp" name="updated_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" @@ -61,7 +61,7 @@ </table> <table name="reporting_system_updates" resource="default" engine="innodb" comment="Reporting for system updates"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="type" nullable="true" length="255" comment="Update Type"/> <column xsi:type="varchar" name="action" nullable="true" length="255" comment="Action Performed"/> <column xsi:type="timestamp" name="updated_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" diff --git a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/CSV/RowParser.php b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/CSV/RowParser.php index 9431973fdfe91..f7b487d37bfc6 100644 --- a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/CSV/RowParser.php +++ b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/CSV/RowParser.php @@ -9,6 +9,9 @@ use Magento\Framework\Phrase; use Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate\LocationDirectory; +/** + * Row parser. + */ class RowParser { /** @@ -26,6 +29,8 @@ public function __construct(LocationDirectory $locationDirectory) } /** + * Retrieve columns. + * * @return array */ public function getColumns() @@ -42,6 +47,8 @@ public function getColumns() } /** + * Parse provided row data. + * * @param array $rowData * @param int $rowNumber * @param int $websiteId @@ -71,23 +78,30 @@ public function parse( } $countryId = $this->getCountryId($rowData, $rowNumber, $columnResolver); - $regionId = $this->getRegionId($rowData, $rowNumber, $columnResolver, $countryId); + $regionIds = $this->getRegionIds($rowData, $rowNumber, $columnResolver, $countryId); $zipCode = $this->getZipCode($rowData, $columnResolver); $conditionValue = $this->getConditionValue($rowData, $rowNumber, $conditionFullName, $columnResolver); $price = $this->getPrice($rowData, $rowNumber, $columnResolver); - return [ - 'website_id' => $websiteId, - 'dest_country_id' => $countryId, - 'dest_region_id' => $regionId, - 'dest_zip' => $zipCode, - 'condition_name' => $conditionShortName, - 'condition_value' => $conditionValue, - 'price' => $price, - ]; + $rates = []; + foreach ($regionIds as $regionId) { + $rates[] = [ + 'website_id' => $websiteId, + 'dest_country_id' => $countryId, + 'dest_region_id' => $regionId, + 'dest_zip' => $zipCode, + 'condition_name' => $conditionShortName, + 'condition_value' => $conditionValue, + 'price' => $price, + ]; + } + + return $rates; } /** + * Get country id from provided row data. + * * @param array $rowData * @param int $rowNumber * @param ColumnResolver $columnResolver @@ -116,21 +130,23 @@ private function getCountryId(array $rowData, $rowNumber, ColumnResolver $column } /** + * Retrieve region id from provided row data. + * * @param array $rowData * @param int $rowNumber * @param ColumnResolver $columnResolver * @param int $countryId - * @return int|string + * @return array * @throws ColumnNotFoundException * @throws RowException */ - private function getRegionId(array $rowData, $rowNumber, ColumnResolver $columnResolver, $countryId) + private function getRegionIds(array $rowData, $rowNumber, ColumnResolver $columnResolver, $countryId) { $regionCode = $columnResolver->getColumnValue(ColumnResolver::COLUMN_REGION, $rowData); if ($countryId !== '0' && $this->locationDirectory->hasRegionId($countryId, $regionCode)) { - $regionId = $this->locationDirectory->getRegionId($countryId, $regionCode); + $regionIds = $this->locationDirectory->getRegionIds($countryId, $regionCode); } elseif ($regionCode === '*' || $regionCode === '') { - $regionId = 0; + $regionIds = [0]; } else { throw new RowException( __( @@ -141,10 +157,12 @@ private function getRegionId(array $rowData, $rowNumber, ColumnResolver $columnR ) ); } - return $regionId; + return $regionIds; } /** + * Retrieve zip code from provided row data. + * * @param array $rowData * @param ColumnResolver $columnResolver * @return float|int|null|string @@ -160,6 +178,8 @@ private function getZipCode(array $rowData, ColumnResolver $columnResolver) } /** + * Get condition value form provided row data. + * * @param array $rowData * @param int $rowNumber * @param string $conditionFullName @@ -187,6 +207,8 @@ private function getConditionValue(array $rowData, $rowNumber, $conditionFullNam } /** + * Retrieve price from provided row data. + * * @param array $rowData * @param int $rowNumber * @param ColumnResolver $columnResolver @@ -212,6 +234,7 @@ private function getPrice(array $rowData, $rowNumber, ColumnResolver $columnReso /** * Parse and validate positive decimal value + * * Return false if value is not decimal or is not positive * * @param string $value diff --git a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/Import.php b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/Import.php index a5b0d7e87d2e1..7735f8ce8999c 100644 --- a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/Import.php +++ b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/Import.php @@ -17,6 +17,7 @@ use Magento\Store\Model\StoreManagerInterface; /** + * Import offline shipping. * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Import @@ -87,6 +88,8 @@ public function __construct( } /** + * Check if there are errors. + * * @return bool */ public function hasErrors() @@ -95,6 +98,8 @@ public function hasErrors() } /** + * Get errors. + * * @return array */ public function getErrors() @@ -103,6 +108,8 @@ public function getErrors() } /** + * Retrieve columns. + * * @return array */ public function getColumns() @@ -111,6 +118,8 @@ public function getColumns() } /** + * Get data from file. + * * @param ReadInterface $file * @param int $websiteId * @param string $conditionShortName @@ -135,7 +144,7 @@ public function getData(ReadInterface $file, $websiteId, $conditionShortName, $c if (empty($csvLine)) { continue; } - $rowData = $this->rowParser->parse( + $rowsData = $this->rowParser->parse( $csvLine, $rowNumber, $websiteId, @@ -144,20 +153,25 @@ public function getData(ReadInterface $file, $websiteId, $conditionShortName, $c $columnResolver ); - // protect from duplicate - $hash = $this->dataHashGenerator->getHash($rowData); - if (array_key_exists($hash, $this->uniqueHash)) { - throw new RowException( - __( - 'Duplicate Row #%1 (duplicates row #%2)', - $rowNumber, - $this->uniqueHash[$hash] - ) - ); + foreach ($rowsData as $rowData) { + // protect from duplicate + $hash = $this->dataHashGenerator->getHash($rowData); + if (array_key_exists($hash, $this->uniqueHash)) { + throw new RowException( + __( + 'Duplicate Row #%1 (duplicates row #%2)', + $rowNumber, + $this->uniqueHash[$hash] + ) + ); + } + $this->uniqueHash[$hash] = $rowNumber; + + $items[] = $rowData; + } + if (count($rowsData) > 1) { + $bunchSize += count($rowsData) - 1; } - $this->uniqueHash[$hash] = $rowNumber; - - $items[] = $rowData; if (count($items) === $bunchSize) { yield $items; $items = []; @@ -172,6 +186,8 @@ public function getData(ReadInterface $file, $websiteId, $conditionShortName, $c } /** + * Retrieve column headers. + * * @param ReadInterface $file * @return array|bool * @throws LocalizedException diff --git a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/LocationDirectory.php b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/LocationDirectory.php index 1a311f3658a0a..e015f7b54637d 100644 --- a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/LocationDirectory.php +++ b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/LocationDirectory.php @@ -6,6 +6,9 @@ namespace Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate; +/** + * Location directory. + */ class LocationDirectory { /** @@ -13,6 +16,11 @@ class LocationDirectory */ protected $regions; + /** + * @var array + */ + private $regionsByCode; + /** * @var array */ @@ -47,6 +55,8 @@ public function __construct( } /** + * Retrieve country id. + * * @param string $countryCode * @return null|string */ @@ -88,6 +98,8 @@ protected function loadCountries() } /** + * Check if there is country id with provided country code. + * * @param string $countryCode * @return bool */ @@ -98,6 +110,8 @@ public function hasCountryId($countryCode) } /** + * Check if there is region id with provided region code and country id. + * * @param string $countryId * @param string $regionCode * @return bool @@ -115,29 +129,50 @@ public function hasRegionId($countryId, $regionCode) */ protected function loadRegions() { - if ($this->regions !== null) { + if ($this->regions !== null && $this->regionsByCode !== null) { return $this; } $this->regions = []; + $this->regionsByCode = []; /** @var $collection \Magento\Directory\Model\ResourceModel\Region\Collection */ $collection = $this->_regionCollectionFactory->create(); foreach ($collection->getData() as $row) { $this->regions[$row['country_id']][$row['code']] = (int)$row['region_id']; + if (empty($this->regionsByCode[$row['country_id']][$row['code']])) { + $this->regionsByCode[$row['country_id']][$row['code']] = []; + } + $this->regionsByCode[$row['country_id']][$row['code']][] = (int)$row['region_id']; } return $this; } /** + * Retrieve region id. + * * @param int $countryId * @param string $regionCode * @return string + * @deprecated */ public function getRegionId($countryId, $regionCode) { $this->loadRegions(); return $this->regions[$countryId][$regionCode]; } + + /** + * Return region ids for country and region + * + * @param int $countryId + * @param string $regionCode + * @return array + */ + public function getRegionIds($countryId, $regionCode) + { + $this->loadRegions(); + return $this->regionsByCode[$countryId][$regionCode]; + } } diff --git a/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/CSV/RowParserTest.php b/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/CSV/RowParserTest.php index 8c34e9a0d6510..683790c531265 100644 --- a/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/CSV/RowParserTest.php +++ b/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/CSV/RowParserTest.php @@ -37,7 +37,7 @@ class RowParserTest extends \PHPUnit\Framework\TestCase protected function setUp() { $this->locationDirectoryMock = $this->getMockBuilder(LocationDirectory::class) - ->setMethods(['hasCountryId', 'getCountryId', 'hasRegionId', 'getRegionId']) + ->setMethods(['hasCountryId', 'getCountryId', 'hasRegionId', 'getRegionIds']) ->disableOriginalConstructor() ->getMock(); $this->columnResolverMock = $this->getMockBuilder(ColumnResolver::class) @@ -92,7 +92,7 @@ public function testParse() $conditionShortName, $columnValueMap ); - $this->assertEquals($expectedResult, $result); + $this->assertEquals([$expectedResult], $result); } /** diff --git a/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/ImportTest.php b/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/ImportTest.php index 4e433c380f753..722683decb4c2 100644 --- a/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/ImportTest.php +++ b/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/ImportTest.php @@ -77,9 +77,6 @@ protected function setUp() ->getMock(); $this->dataHashGeneratorMock = $this->getMockBuilder(DataHashGenerator::class) ->getMock(); - $this->rowParserMock->expects($this->any()) - ->method('parse') - ->willReturnArgument(0); $this->dataHashGeneratorMock->expects($this->any()) ->method('getHash') ->willReturnCallback( @@ -124,6 +121,15 @@ public function testGetData() ['a4', 'b4', 'c4', 'd4', 'e4'], ['a5', 'b5', 'c5', 'd5', 'e5'], ]; + $this->rowParserMock->expects($this->any()) + ->method('parse') + ->willReturn( + [['a1', 'b1', 'c1', 'd1', 'e1']], + [['a2', 'b2', 'c2', 'd2', 'e2']], + [['a3', 'b3', 'c3', 'd3', 'e3']], + [['a4', 'b4', 'c4', 'd4', 'e4']], + [['a5', 'b5', 'c5', 'd5', 'e5']] + ); $file = $this->createFileMock($lines); $expectedResult = [ [ @@ -167,6 +173,13 @@ public function testGetDataWithDuplicatedLine() [], ['a2', 'b2', 'c2', 'd2', 'e2'], ]; + $this->rowParserMock->expects($this->any()) + ->method('parse') + ->willReturn( + [['a1', 'b1', 'c1', 'd1', 'e1']], + [['a1', 'b1', 'c1', 'd1', 'e1']], + [['a2', 'b2', 'c2', 'd2', 'e2']] + ); $file = $this->createFileMock($lines); $expectedResult = [ [ diff --git a/app/code/Magento/Paypal/Model/AbstractConfig.php b/app/code/Magento/Paypal/Model/AbstractConfig.php index 3b0f7b974829c..e5beddac3b189 100644 --- a/app/code/Magento/Paypal/Model/AbstractConfig.php +++ b/app/code/Magento/Paypal/Model/AbstractConfig.php @@ -134,7 +134,7 @@ public function setStoreId($storeId) * Returns payment configuration value * * @param string $key - * @param null $storeId + * @param null|int $storeId * @return null|string * * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -224,15 +224,26 @@ protected function _prepareValue($key, $value) */ public function shouldUseUnilateralPayments() { - return $this->getValue('business_account') && !$this->isWppApiAvailabe(); + return $this->getValue('business_account') && !$this->isWppApiAvailable(); } /** * Check whether WPP API credentials are available for this method * + * @deprecated * @return bool */ public function isWppApiAvailabe() + { + return $this->isWppApiAvailable(); + } + + /** + * Check whether WPP API credentials are available for this method + * + * @return bool + */ + public function isWppApiAvailable() { return $this->getValue('api_username') && $this->getValue('api_password') @@ -243,7 +254,7 @@ public function isWppApiAvailabe() /** * Check whether method available for checkout or not * - * @param null $methodCode + * @param null|string $methodCode * * @return bool */ diff --git a/app/code/Magento/Paypal/Model/Config.php b/app/code/Magento/Paypal/Model/Config.php index 34e40ac7509d6..b058ba129a33f 100644 --- a/app/code/Magento/Paypal/Model/Config.php +++ b/app/code/Magento/Paypal/Model/Config.php @@ -10,6 +10,7 @@ /** * Config model that is aware of all \Magento\Paypal payment methods + * * Works with PayPal-specific system configuration * @SuppressWarnings(PHPMD.ExcessivePublicCount) @@ -632,6 +633,7 @@ public function __construct( /** * Check whether method available for checkout or not + * * Logic based on merchant country, methods dependence * * @param string|null $methodCode @@ -677,7 +679,7 @@ public function isMethodAvailable($methodCode = null) } break; case self::METHOD_BILLING_AGREEMENT: - $result = $this->isWppApiAvailabe(); + $result = $this->isWppApiAvailable(); break; } return $result; @@ -723,6 +725,7 @@ public function getMerchantCountry() /** * Check whether method supported for specified country or not + * * Use $_methodCode and merchant country by default * * @param string|null $method @@ -896,6 +899,7 @@ public function getExpressCheckoutEditUrl($token) /** * Get url for additional actions that PayPal may require customer to do after placing the order. + * * For instance, redirecting customer to bank for payment confirmation. * * @param string $token @@ -957,6 +961,7 @@ public function areButtonsDynamic() /** * Express checkout shortcut pic URL getter + * * PayPal will ignore "pal", if there is no total amount specified * * @param string $localeCode @@ -996,6 +1001,7 @@ public function getExpressCheckoutInContextImageUrl($localeCode) /** * Get PayPal "mark" image URL + * * Supposed to be used on payment methods selection * $staticSize is applicable for static images only * @@ -1032,6 +1038,7 @@ public function getPaymentMarkImageUrl($localeCode, $orderTotal = null, $pal = n /** * Get "What Is PayPal" localized URL + * * Supposed to be used with "mark" as popup window * * @param \Magento\Framework\Locale\ResolverInterface $localeResolver @@ -1262,6 +1269,7 @@ public function getExpressCheckoutBASignupOptions() /** * Whether to ask customer to create billing agreements + * * Unilateral payments are incompatible with the billing agreements * * @return bool @@ -1376,6 +1384,7 @@ public function exportExpressCheckoutStyleSettings(\Magento\Framework\DataObject /** * Dynamic PayPal image URL getter + * * Also can render dynamic Acceptance Mark * * @param string $type @@ -1725,6 +1734,7 @@ public function getBmlPublisherId() /** * Get Display option from stored config + * * @param string $section * * @return mixed @@ -1752,6 +1762,7 @@ public function getBmlDisplay($section) /** * Get Position option from stored config + * * @param string $section * * @return mixed @@ -1767,6 +1778,7 @@ public function getBmlPosition($section) /** * Get Size option from stored config + * * @param string $section * * @return mixed diff --git a/app/code/Magento/Paypal/Test/Unit/Model/AbstractConfigTest.php b/app/code/Magento/Paypal/Test/Unit/Model/AbstractConfigTest.php index 9ec9318212614..78bd269403b83 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/AbstractConfigTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/AbstractConfigTest.php @@ -189,14 +189,14 @@ public function getValueDataProvider() * * @dataProvider isWppApiAvailabeDataProvider */ - public function testIsWppApiAvailabe($returnMap, $expectedValue) + public function testIsWppApiAvailable($returnMap, $expectedValue) { $this->config->setMethod('paypal_express'); $this->scopeConfigMock->expects($this->any()) ->method('getValue') ->willReturnMap($returnMap); - $this->assertEquals($expectedValue, $this->config->isWppApiAvailabe()); + $this->assertEquals($expectedValue, $this->config->isWppApiAvailable()); } /** diff --git a/app/code/Magento/Paypal/etc/db_schema.xml b/app/code/Magento/Paypal/etc/db_schema.xml index 2703ee4f5be30..0441231e64ac3 100644 --- a/app/code/Magento/Paypal/etc/db_schema.xml +++ b/app/code/Magento/Paypal/etc/db_schema.xml @@ -134,7 +134,7 @@ <table name="paypal_payment_transaction" resource="default" engine="innodb" comment="PayPal Payflow Link Payment Transaction"> <column xsi:type="int" name="transaction_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="txn_id" nullable="true" length="100" comment="Txn Id"/> <column xsi:type="blob" name="additional_information" nullable="true" comment="Additional Information"/> <column xsi:type="timestamp" name="created_at" on_update="false" nullable="true" comment="Created At"/> diff --git a/app/code/Magento/ProductVideo/i18n/de_DE.csv b/app/code/Magento/ProductVideo/i18n/de_DE.csv index 7047317396999..ca24668bb8d16 100644 --- a/app/code/Magento/ProductVideo/i18n/de_DE.csv +++ b/app/code/Magento/ProductVideo/i18n/de_DE.csv @@ -7,3 +7,4 @@ "Preview Image","Preview Image" "Get Video Information","Get Video Information" "Youtube or Vimeo supported","Youtube or Vimeo supported" +"Delete image in all store views","Delete image in all store views" diff --git a/app/code/Magento/ProductVideo/i18n/en_US.csv b/app/code/Magento/ProductVideo/i18n/en_US.csv index 2d226c6daefa3..debcab151cc91 100644 --- a/app/code/Magento/ProductVideo/i18n/en_US.csv +++ b/app/code/Magento/ProductVideo/i18n/en_US.csv @@ -40,3 +40,4 @@ Delete,Delete "Autostart base video","Autostart base video" "Show related video","Show related video" "Auto restart video","Auto restart video" +"Delete image in all store views","Delete image in all store views" diff --git a/app/code/Magento/ProductVideo/i18n/es_ES.csv b/app/code/Magento/ProductVideo/i18n/es_ES.csv index 7047317396999..ca24668bb8d16 100644 --- a/app/code/Magento/ProductVideo/i18n/es_ES.csv +++ b/app/code/Magento/ProductVideo/i18n/es_ES.csv @@ -7,3 +7,4 @@ "Preview Image","Preview Image" "Get Video Information","Get Video Information" "Youtube or Vimeo supported","Youtube or Vimeo supported" +"Delete image in all store views","Delete image in all store views" diff --git a/app/code/Magento/ProductVideo/i18n/fr_FR.csv b/app/code/Magento/ProductVideo/i18n/fr_FR.csv index 7047317396999..ca24668bb8d16 100644 --- a/app/code/Magento/ProductVideo/i18n/fr_FR.csv +++ b/app/code/Magento/ProductVideo/i18n/fr_FR.csv @@ -7,3 +7,4 @@ "Preview Image","Preview Image" "Get Video Information","Get Video Information" "Youtube or Vimeo supported","Youtube or Vimeo supported" +"Delete image in all store views","Delete image in all store views" diff --git a/app/code/Magento/ProductVideo/i18n/nl_NL.csv b/app/code/Magento/ProductVideo/i18n/nl_NL.csv index 7047317396999..5ad8386573040 100644 --- a/app/code/Magento/ProductVideo/i18n/nl_NL.csv +++ b/app/code/Magento/ProductVideo/i18n/nl_NL.csv @@ -7,3 +7,4 @@ "Preview Image","Preview Image" "Get Video Information","Get Video Information" "Youtube or Vimeo supported","Youtube or Vimeo supported" +"Delete image in all store views","Delete image in all store views" \ No newline at end of file diff --git a/app/code/Magento/ProductVideo/i18n/pt_BR.csv b/app/code/Magento/ProductVideo/i18n/pt_BR.csv index 7047317396999..5ad8386573040 100644 --- a/app/code/Magento/ProductVideo/i18n/pt_BR.csv +++ b/app/code/Magento/ProductVideo/i18n/pt_BR.csv @@ -7,3 +7,4 @@ "Preview Image","Preview Image" "Get Video Information","Get Video Information" "Youtube or Vimeo supported","Youtube or Vimeo supported" +"Delete image in all store views","Delete image in all store views" \ No newline at end of file diff --git a/app/code/Magento/ProductVideo/i18n/zh_Hans_CN.csv b/app/code/Magento/ProductVideo/i18n/zh_Hans_CN.csv index 7047317396999..5ad8386573040 100644 --- a/app/code/Magento/ProductVideo/i18n/zh_Hans_CN.csv +++ b/app/code/Magento/ProductVideo/i18n/zh_Hans_CN.csv @@ -7,3 +7,4 @@ "Preview Image","Preview Image" "Get Video Information","Get Video Information" "Youtube or Vimeo supported","Youtube or Vimeo supported" +"Delete image in all store views","Delete image in all store views" \ No newline at end of file diff --git a/app/code/Magento/ProductVideo/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/ProductVideo/view/adminhtml/layout/catalog_product_new.xml index f5a22c50e6d0d..63bd5321ad30b 100644 --- a/app/code/Magento/ProductVideo/view/adminhtml/layout/catalog_product_new.xml +++ b/app/code/Magento/ProductVideo/view/adminhtml/layout/catalog_product_new.xml @@ -6,6 +6,9 @@ */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> + <head> + <css src="Magento_ProductVideo::css/gallery-delete-tooltip.css"/> + </head> <body> <referenceContainer name="content"> diff --git a/app/code/Magento/ProductVideo/view/adminhtml/templates/helper/gallery.phtml b/app/code/Magento/ProductVideo/view/adminhtml/templates/helper/gallery.phtml index 8b0f7d8ed98df..6dff53211892f 100755 --- a/app/code/Magento/ProductVideo/view/adminhtml/templates/helper/gallery.phtml +++ b/app/code/Magento/ProductVideo/view/adminhtml/templates/helper/gallery.phtml @@ -140,30 +140,37 @@ $elementToggleCode = $element->getToggleCode() ? $element->getToggleCode() : 'to alt="<%- data.label %>"/> <div class="actions"> - <button type="button" - class="action-remove" - data-role="delete-button" - title="<% if (data.media_type == 'external-video') {%> + <div class="tooltip"> + <span class="delete-tooltiptext"> + <?= $block->escapeHtml( + __('Delete image in all store views') + ); ?> + </span> + <button type="button" + class="action-remove" + data-role="delete-button" + title="<% if (data.media_type == 'external-video') {%> + <?= $block->escapeHtml( + __('Delete video') + ); ?> + <%} else {%> + <?= $block->escapeHtml( + __('Delete image') + ); ?> + <%}%>"> + <span> + <% if (data.media_type == 'external-video') { %> <?= $block->escapeHtml( __('Delete video') ); ?> - <%} else {%> + <% } else {%> <?= $block->escapeHtml( __('Delete image') ); ?> - <%}%>"> - <span> - <% if (data.media_type == 'external-video') { %> - <?= $block->escapeHtml( - __('Delete video') - ); ?> - <% } else {%> - <?= $block->escapeHtml( - __('Delete image') - ); ?> - <%} %> - </span> - </button> + <%} %> + </span> + </button> + </div> <div class="draggable-handle"></div> </div> <div class="image-fade"><span><?= $block->escapeHtml( @@ -329,4 +336,4 @@ $elementToggleCode = $element->getToggleCode() ? $element->getToggleCode() : 'to </div> <script> jQuery('body').trigger('contentUpdated'); -</script> +</script> \ No newline at end of file diff --git a/app/code/Magento/ProductVideo/view/adminhtml/web/css/gallery-delete-tooltip.css b/app/code/Magento/ProductVideo/view/adminhtml/web/css/gallery-delete-tooltip.css new file mode 100644 index 0000000000000..ad779c3f29bf8 --- /dev/null +++ b/app/code/Magento/ProductVideo/view/adminhtml/web/css/gallery-delete-tooltip.css @@ -0,0 +1,20 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +.gallery .tooltip .delete-tooltiptext { + visibility: hidden; + width: 112px; + background-color: #373330; + color: #F7F3EB; + text-align: center; + padding: 5px 0; + position: absolute; + z-index: 1; + left: 30px; + top: 91px; +} + +.gallery .tooltip:hover .delete-tooltiptext { + visibility: visible; +} \ No newline at end of file diff --git a/app/code/Magento/Quote/etc/db_schema.xml b/app/code/Magento/Quote/etc/db_schema.xml index 3bd7122e65d7f..725825e976ad7 100644 --- a/app/code/Magento/Quote/etc/db_schema.xml +++ b/app/code/Magento/Quote/etc/db_schema.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> <table name="quote" resource="checkout" engine="innodb" comment="Sales Flat Quote"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store Id"/> <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" @@ -488,7 +488,7 @@ </table> <table name="quote_id_mask" resource="checkout" engine="innodb" comment="Quote ID and masked ID mapping"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="quote_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Quote ID"/> <column xsi:type="varchar" name="masked_id" nullable="true" length="32" comment="Masked ID"/> diff --git a/app/code/Magento/Review/etc/db_schema.xml b/app/code/Magento/Review/etc/db_schema.xml index 1a2ff588180ce..2ae43ea608eca 100644 --- a/app/code/Magento/Review/etc/db_schema.xml +++ b/app/code/Magento/Review/etc/db_schema.xml @@ -95,7 +95,7 @@ <column xsi:type="smallint" name="rating_summary" padding="6" unsigned="false" nullable="false" identity="false" default="0" comment="Summarized rating"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Store id"/> + default="0" comment="Store ID"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="primary_id"/> </constraint> @@ -108,9 +108,9 @@ </table> <table name="review_store" resource="default" engine="innodb" comment="Review Store"> <column xsi:type="bigint" name="review_id" padding="20" unsigned="true" nullable="false" identity="false" - comment="Review Id"/> + comment="Review ID"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" - comment="Store Id"/> + comment="Store ID"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="review_id"/> <column name="store_id"/> @@ -125,7 +125,7 @@ </table> <table name="rating_entity" resource="default" engine="innodb" comment="Rating entities"> <column xsi:type="smallint" name="entity_id" padding="5" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="entity_code" nullable="false" length="64" comment="Entity Code"/> <constraint xsi:type="primary" name="PRIMARY"> <column name="entity_id"/> @@ -136,9 +136,9 @@ </table> <table name="rating" resource="default" engine="innodb" comment="Ratings"> <column xsi:type="smallint" name="rating_id" padding="5" unsigned="true" nullable="false" identity="true" - comment="Rating Id"/> + comment="Rating ID"/> <column xsi:type="smallint" name="entity_id" padding="5" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="varchar" name="rating_code" nullable="false" length="64" comment="Rating Code"/> <column xsi:type="smallint" name="position" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Rating Position On Storefront"/> diff --git a/app/code/Magento/Sales/Model/Service/CreditmemoService.php b/app/code/Magento/Sales/Model/Service/CreditmemoService.php index e8f2e6e5305f7..bac72e0b5228c 100644 --- a/app/code/Magento/Sales/Model/Service/CreditmemoService.php +++ b/app/code/Magento/Sales/Model/Service/CreditmemoService.php @@ -166,8 +166,8 @@ public function refund( $creditmemo->getOrder(), !$offlineRequested ); - $this->getOrderRepository()->save($order); $this->creditmemoRepository->save($creditmemo); + $this->getOrderRepository()->save($order); $connection->commit(); } catch (\Exception $e) { $connection->rollBack(); @@ -178,6 +178,8 @@ public function refund( } /** + * Validates if credit memo is available for refund. + * * @param \Magento\Sales\Api\Data\CreditmemoInterface $creditmemo * @return bool * @throws \Magento\Framework\Exception\LocalizedException @@ -208,8 +210,9 @@ protected function validateForRefund(\Magento\Sales\Api\Data\CreditmemoInterface } /** - * @return \Magento\Sales\Model\Order\RefundAdapterInterface + * Gets the instance of RefundAdapterInterface * + * @return \Magento\Sales\Model\Order\RefundAdapterInterface * @deprecated 100.1.3 */ private function getRefundAdapter() @@ -222,8 +225,9 @@ private function getRefundAdapter() } /** - * @return \Magento\Framework\App\ResourceConnection|mixed + * Gets instance of ResourceConnection. * + * @return \Magento\Framework\App\ResourceConnection|mixed * @deprecated 100.1.3 */ private function getResource() @@ -236,8 +240,9 @@ private function getResource() } /** - * @return \Magento\Sales\Api\OrderRepositoryInterface + * Gets instance of OrderRepositoryInterface. * + * @return \Magento\Sales\Api\OrderRepositoryInterface * @deprecated 100.1.3 */ private function getOrderRepository() @@ -250,8 +255,9 @@ private function getOrderRepository() } /** - * @return \Magento\Sales\Api\InvoiceRepositoryInterface + * Gets instance of InvoiceRepositoryInterface * + * @return \Magento\Sales\Api\InvoiceRepositoryInterface * @deprecated 100.1.3 */ private function getInvoiceRepository() diff --git a/app/code/Magento/Sales/etc/db_schema.xml b/app/code/Magento/Sales/etc/db_schema.xml index 4b716e761094c..fda6e75cf00c6 100644 --- a/app/code/Magento/Sales/etc/db_schema.xml +++ b/app/code/Magento/Sales/etc/db_schema.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> <table name="sales_order" resource="sales" engine="innodb" comment="Sales Flat Order"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="state" nullable="true" length="32" comment="State"/> <column xsi:type="varchar" name="status" nullable="true" length="32" comment="Status"/> <column xsi:type="varchar" name="coupon_code" nullable="true" length="255" comment="Coupon Code"/> @@ -297,13 +297,13 @@ </table> <table name="sales_order_grid" resource="sales" engine="innodb" comment="Sales Flat Order Grid"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="status" nullable="true" length="32" comment="Status"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false" - comment="Store Id"/> + comment="Store ID"/> <column xsi:type="varchar" name="store_name" nullable="true" length="255" comment="Store Name"/> <column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="true" identity="false" - comment="Customer Id"/> + comment="Customer ID"/> <column xsi:type="decimal" name="base_grand_total" scale="4" precision="12" unsigned="false" nullable="true" comment="Base Grand Total"/> <column xsi:type="decimal" name="base_total_paid" scale="4" precision="12" unsigned="false" nullable="true" @@ -386,17 +386,17 @@ </table> <table name="sales_order_address" resource="sales" engine="innodb" comment="Sales Flat Order Address"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="true" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="int" name="customer_address_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Customer Address Id"/> + comment="Customer Address ID"/> <column xsi:type="int" name="quote_address_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Quote Address Id"/> + comment="Quote Address ID"/> <column xsi:type="int" name="region_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Region Id"/> + comment="Region ID"/> <column xsi:type="int" name="customer_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Customer Id"/> + comment="Customer ID"/> <column xsi:type="varchar" name="fax" nullable="true" length="255" comment="Fax"/> <column xsi:type="varchar" name="region" nullable="true" length="255" comment="Region"/> <column xsi:type="varchar" name="postcode" nullable="true" length="255" comment="Postcode"/> @@ -431,9 +431,9 @@ </table> <table name="sales_order_status_history" resource="sales" engine="innodb" comment="Sales Flat Order Status History"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="int" name="is_customer_notified" padding="11" unsigned="false" nullable="true" identity="false" comment="Is Customer Notified"/> <column xsi:type="smallint" name="is_visible_on_front" padding="5" unsigned="true" nullable="false" @@ -602,9 +602,9 @@ </table> <table name="sales_order_payment" resource="sales" engine="innodb" comment="Sales Flat Order Payment"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="decimal" name="base_shipping_captured" scale="4" precision="12" unsigned="false" nullable="true" comment="Base Shipping Captured"/> <column xsi:type="decimal" name="shipping_captured" scale="4" precision="12" unsigned="false" nullable="true" @@ -696,9 +696,9 @@ </table> <table name="sales_shipment" resource="sales" engine="innodb" comment="Sales Flat Shipment"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false" - comment="Store Id"/> + comment="Store ID"/> <column xsi:type="decimal" name="total_weight" scale="4" precision="12" unsigned="false" nullable="true" comment="Total Weight"/> <column xsi:type="decimal" name="total_qty" scale="4" precision="12" unsigned="false" nullable="true" @@ -708,13 +708,13 @@ <column xsi:type="smallint" name="send_email" padding="5" unsigned="true" nullable="true" identity="false" comment="Send Email"/> <column xsi:type="int" name="order_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Order Id"/> + comment="Order ID"/> <column xsi:type="int" name="customer_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Customer Id"/> + comment="Customer ID"/> <column xsi:type="int" name="shipping_address_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Shipping Address Id"/> + comment="Shipping Address ID"/> <column xsi:type="int" name="billing_address_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Billing Address Id"/> + comment="Billing Address ID"/> <column xsi:type="int" name="shipment_status" padding="11" unsigned="false" nullable="true" identity="false" comment="Shipment Status"/> <column xsi:type="varchar" name="increment_id" nullable="true" length="50" comment="Increment Id"/> @@ -762,13 +762,13 @@ </table> <table name="sales_shipment_grid" resource="sales" engine="innodb" comment="Sales Flat Shipment Grid"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="increment_id" nullable="true" length="50" comment="Increment Id"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false" - comment="Store Id"/> + comment="Store ID"/> <column xsi:type="varchar" name="order_increment_id" nullable="false" length="32" comment="Order Increment Id"/> <column xsi:type="int" name="order_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Order Id"/> + comment="Order ID"/> <column xsi:type="timestamp" name="order_created_at" on_update="true" nullable="true" default="CURRENT_TIMESTAMP" comment="Order Increment Id"/> <column xsi:type="varchar" name="customer_name" nullable="false" length="128" comment="Customer Name"/> @@ -837,9 +837,9 @@ </table> <table name="sales_shipment_item" resource="sales" engine="innodb" comment="Sales Flat Shipment Item"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="decimal" name="row_total" scale="4" precision="12" unsigned="false" nullable="true" comment="Row Total"/> <column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="true" @@ -848,9 +848,9 @@ comment="Weight"/> <column xsi:type="decimal" name="qty" scale="4" precision="12" unsigned="false" nullable="true" comment="Qty"/> <column xsi:type="int" name="product_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Product Id"/> + comment="Product ID"/> <column xsi:type="int" name="order_item_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Order Item Id"/> + comment="Order Item ID"/> <column xsi:type="text" name="additional_data" nullable="true" comment="Additional Data"/> <column xsi:type="text" name="description" nullable="true" comment="Description"/> <column xsi:type="varchar" name="name" nullable="true" length="255" comment="Name"/> @@ -867,14 +867,14 @@ </table> <table name="sales_shipment_track" resource="sales" engine="innodb" comment="Sales Flat Shipment Track"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="decimal" name="weight" scale="4" precision="12" unsigned="false" nullable="true" comment="Weight"/> <column xsi:type="decimal" name="qty" scale="4" precision="12" unsigned="false" nullable="true" comment="Qty"/> <column xsi:type="int" name="order_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Order Id"/> + comment="Order ID"/> <column xsi:type="text" name="track_number" nullable="true" comment="Number"/> <column xsi:type="text" name="description" nullable="true" comment="Description"/> <column xsi:type="varchar" name="title" nullable="true" length="255" comment="Title"/> @@ -901,9 +901,9 @@ </table> <table name="sales_shipment_comment" resource="sales" engine="innodb" comment="Sales Flat Shipment Comment"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="int" name="is_customer_notified" padding="11" unsigned="false" nullable="true" identity="false" comment="Is Customer Notified"/> <column xsi:type="smallint" name="is_visible_on_front" padding="5" unsigned="true" nullable="false" @@ -926,9 +926,9 @@ </table> <table name="sales_invoice" resource="sales" engine="innodb" comment="Sales Flat Invoice"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false" - comment="Store Id"/> + comment="Store ID"/> <column xsi:type="decimal" name="base_grand_total" scale="4" precision="12" unsigned="false" nullable="true" comment="Base Grand Total"/> <column xsi:type="decimal" name="shipping_tax_amount" scale="4" precision="12" unsigned="false" nullable="true" @@ -1051,15 +1051,15 @@ </table> <table name="sales_invoice_grid" resource="sales" engine="innodb" comment="Sales Flat Invoice Grid"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="increment_id" nullable="true" length="50" comment="Increment Id"/> <column xsi:type="int" name="state" padding="11" unsigned="false" nullable="true" identity="false" comment="State"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false" - comment="Store Id"/> + comment="Store ID"/> <column xsi:type="varchar" name="store_name" nullable="true" length="255" comment="Store Name"/> <column xsi:type="int" name="order_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Order Id"/> + comment="Order ID"/> <column xsi:type="varchar" name="order_increment_id" nullable="true" length="50" comment="Order Increment Id"/> <column xsi:type="timestamp" name="order_created_at" on_update="false" nullable="true" comment="Order Created At"/> @@ -1136,9 +1136,9 @@ </table> <table name="sales_invoice_item" resource="sales" engine="innodb" comment="Sales Flat Invoice Item"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="decimal" name="base_price" scale="4" precision="12" unsigned="false" nullable="true" comment="Base Price"/> <column xsi:type="decimal" name="tax_amount" scale="4" precision="12" unsigned="false" nullable="true" @@ -1192,9 +1192,9 @@ </table> <table name="sales_invoice_comment" resource="sales" engine="innodb" comment="Sales Flat Invoice Comment"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="smallint" name="is_customer_notified" padding="5" unsigned="true" nullable="true" identity="false" comment="Is Customer Notified"/> <column xsi:type="smallint" name="is_visible_on_front" padding="5" unsigned="true" nullable="false" @@ -1217,9 +1217,9 @@ </table> <table name="sales_creditmemo" resource="sales" engine="innodb" comment="Sales Flat Creditmemo"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false" - comment="Store Id"/> + comment="Store ID"/> <column xsi:type="decimal" name="adjustment_positive" scale="4" precision="12" unsigned="false" nullable="true" comment="Adjustment Positive"/> <column xsi:type="decimal" name="base_shipping_tax_amount" scale="4" precision="12" unsigned="false" @@ -1350,12 +1350,12 @@ </table> <table name="sales_creditmemo_grid" resource="sales" engine="innodb" comment="Sales Flat Creditmemo Grid"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="increment_id" nullable="true" length="50" comment="Increment Id"/> <column xsi:type="timestamp" name="created_at" on_update="false" nullable="true" comment="Created At"/> <column xsi:type="timestamp" name="updated_at" on_update="false" nullable="true" comment="Updated At"/> <column xsi:type="int" name="order_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Order Id"/> + comment="Order ID"/> <column xsi:type="varchar" name="order_increment_id" nullable="true" length="50" comment="Order Increment Id"/> <column xsi:type="timestamp" name="order_created_at" on_update="false" nullable="true" comment="Order Created At"/> @@ -1366,7 +1366,7 @@ comment="Base Grand Total"/> <column xsi:type="varchar" name="order_status" nullable="true" length="32" comment="Order Status"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false" - comment="Store Id"/> + comment="Store ID"/> <column xsi:type="varchar" name="billing_address" nullable="true" length="255" comment="Billing Address"/> <column xsi:type="varchar" name="shipping_address" nullable="true" length="255" comment="Shipping Address"/> <column xsi:type="varchar" name="customer_name" nullable="false" length="128" comment="Customer Name"/> @@ -1438,9 +1438,9 @@ </table> <table name="sales_creditmemo_item" resource="sales" engine="innodb" comment="Sales Flat Creditmemo Item"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="decimal" name="base_price" scale="4" precision="12" unsigned="false" nullable="true" comment="Base Price"/> <column xsi:type="decimal" name="tax_amount" scale="4" precision="12" unsigned="false" nullable="true" @@ -1469,9 +1469,9 @@ <column xsi:type="decimal" name="row_total_incl_tax" scale="4" precision="12" unsigned="false" nullable="true" comment="Row Total Incl Tax"/> <column xsi:type="int" name="product_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Product Id"/> + comment="Product ID"/> <column xsi:type="int" name="order_item_id" padding="11" unsigned="false" nullable="true" identity="false" - comment="Order Item Id"/> + comment="Order Item ID"/> <column xsi:type="text" name="additional_data" nullable="true" comment="Additional Data"/> <column xsi:type="text" name="description" nullable="true" comment="Description"/> <column xsi:type="varchar" name="sku" nullable="true" length="255" comment="Sku"/> @@ -1494,9 +1494,9 @@ </table> <table name="sales_creditmemo_comment" resource="sales" engine="innodb" comment="Sales Flat Creditmemo Comment"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Parent Id"/> + comment="Parent ID"/> <column xsi:type="int" name="is_customer_notified" padding="11" unsigned="false" nullable="true" identity="false" comment="Is Customer Notified"/> <column xsi:type="smallint" name="is_visible_on_front" padding="5" unsigned="true" nullable="false" diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index b61f4617e1be0..e653ed2a955ec 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -48,7 +48,7 @@ define([ if (typeof controlButtonArea != 'undefined') { var buttons = controlButtonArea.childElements(); for (var i = 0; i < buttons.length; i++) { - if (buttons[i].innerHTML.include(button.label)) { + if (buttons[i].innerHTML.include(button.getLabel())) { return; } } @@ -1432,6 +1432,10 @@ define([ node.update('<span>' + this._label + '</span>'); content[position] = node; Element.insert(element, content); + }, + + getLabel: function(){ + return this._label; } }; diff --git a/app/code/Magento/SalesRule/etc/db_schema.xml b/app/code/Magento/SalesRule/etc/db_schema.xml index 3d882ee2eae67..145ed0c96d95f 100644 --- a/app/code/Magento/SalesRule/etc/db_schema.xml +++ b/app/code/Magento/SalesRule/etc/db_schema.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> <table name="salesrule" resource="default" engine="innodb" comment="Salesrule"> <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="varchar" name="name" nullable="true" length="255" comment="Name"/> <column xsi:type="text" name="description" nullable="true" comment="Description"/> <column xsi:type="date" name="from_date" comment="From"/> @@ -60,7 +60,7 @@ <column xsi:type="int" name="coupon_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Coupon Id"/> <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Rule Id"/> + comment="Rule ID"/> <column xsi:type="varchar" name="code" nullable="true" length="255" comment="Code"/> <column xsi:type="int" name="usage_limit" padding="10" unsigned="true" nullable="true" identity="false" comment="Usage Limit"/> @@ -117,7 +117,7 @@ <column xsi:type="int" name="rule_customer_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Rule Customer Id"/> <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" default="0" - comment="Rule Id"/> + comment="Rule ID"/> <column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="false" identity="false" default="0" comment="Customer Id"/> <column xsi:type="smallint" name="times_used" padding="5" unsigned="true" nullable="false" identity="false" @@ -143,7 +143,7 @@ <column xsi:type="int" name="label_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Label Id"/> <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" - comment="Rule Id"/> + comment="Rule ID"/> <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" comment="Store Id"/> <column xsi:type="varchar" name="label" nullable="true" length="255" comment="Label"/> @@ -163,7 +163,8 @@ </index> </table> <table name="salesrule_product_attribute" resource="default" engine="innodb" comment="Salesrule Product Attribute"> - <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"/> + <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" + comment="Rule ID"/> <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false" comment="Website Id"/> <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false" @@ -318,7 +319,8 @@ </index> </table> <table name="salesrule_website" resource="default" engine="innodb" comment="Sales Rules To Websites Relations"> - <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"/> + <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" + comment="Rule ID"/> <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false" comment="Website Id"/> <constraint xsi:type="primary" name="PRIMARY"> @@ -336,7 +338,8 @@ </table> <table name="salesrule_customer_group" resource="default" engine="innodb" comment="Sales Rules To Customer Groups Relations"> - <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"/> + <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" + comment="Rule ID"/> <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Customer Group Id"/> <constraint xsi:type="primary" name="PRIMARY"> diff --git a/app/code/Magento/Signifyd/etc/db_schema.xml b/app/code/Magento/Signifyd/etc/db_schema.xml index 6a31eacbb45f5..6f41b883c71e1 100644 --- a/app/code/Magento/Signifyd/etc/db_schema.xml +++ b/app/code/Magento/Signifyd/etc/db_schema.xml @@ -37,6 +37,7 @@ </constraint> </table> <table name="sales_order_grid" resource="sales" comment="Sales Flat Order Grid"> - <column xsi:type="varchar" name="signifyd_guarantee_status" nullable="true" length="32"/> + <column xsi:type="varchar" name="signifyd_guarantee_status" nullable="true" length="32" + comment="Signifyd Guarantee Disposition Status"/> </table> </schema> diff --git a/app/code/Magento/Store/Test/Mftf/Data/StoreData.xml b/app/code/Magento/Store/Test/Mftf/Data/StoreData.xml index 2bff20e05435a..8f859ff3cd6bc 100644 --- a/app/code/Magento/Store/Test/Mftf/Data/StoreData.xml +++ b/app/code/Magento/Store/Test/Mftf/Data/StoreData.xml @@ -41,12 +41,16 @@ </entity> <entity name="staticStore" type="store"> <!--data key="group_id">customStoreGroup.id</data--> - <data key="name" >Second Store View</data> - <data key="code" >store123</data> + <data key="name">Second Store View</data> + <data key="code">store123</data> <data key="is_active">1</data> <data key="store_id">null</data> <data key="store_action">add</data> <data key="store_type">store</data> <requiredEntity type="storeGroup">customStoreGroup</requiredEntity> </entity> + <entity name="staticSecondStore" extends="staticStore"> + <data key="name">Store View</data> + <data key="code">store2</data> + </entity> </entities> diff --git a/app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml b/app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml index 83ca12875d099..7b31623f237e9 100644 --- a/app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml +++ b/app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml @@ -27,4 +27,8 @@ <data key="root_category_id">2</data> <data key="website_id">1</data> </entity> + <entity name="staticFirstStoreGroup" extends="staticStoreGroup"> + <data key="name">NewStore</data> + <data key="code">Base1</data> + </entity> </entities> diff --git a/app/code/Magento/Vault/etc/db_schema.xml b/app/code/Magento/Vault/etc/db_schema.xml index ed1f2adba2142..e9645e211ae9b 100644 --- a/app/code/Magento/Vault/etc/db_schema.xml +++ b/app/code/Magento/Vault/etc/db_schema.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> <table name="vault_payment_token" resource="default" engine="innodb" comment="Vault tokens of payment"> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" - comment="Entity Id"/> + comment="Entity ID"/> <column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="true" identity="false" comment="Customer Id"/> <column xsi:type="varchar" name="public_hash" nullable="false" length="128" diff --git a/app/code/Magento/Weee/etc/db_schema.xml b/app/code/Magento/Weee/etc/db_schema.xml index 96c3be9740e56..49b201acb3375 100644 --- a/app/code/Magento/Weee/etc/db_schema.xml +++ b/app/code/Magento/Weee/etc/db_schema.xml @@ -13,7 +13,7 @@ <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Website Id"/> <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" - default="0" comment="Entity Id"/> + default="0" comment="Entity ID"/> <column xsi:type="varchar" name="country" nullable="true" length="2" comment="Country"/> <column xsi:type="decimal" name="value" scale="4" precision="12" unsigned="false" nullable="false" default="0" comment="Value"/> diff --git a/app/code/Magento/Wishlist/Block/AbstractBlock.php b/app/code/Magento/Wishlist/Block/AbstractBlock.php index 8b4a8df1bf99f..bb8138fb87a3e 100644 --- a/app/code/Magento/Wishlist/Block/AbstractBlock.php +++ b/app/code/Magento/Wishlist/Block/AbstractBlock.php @@ -231,9 +231,21 @@ public function hasDescription($item) * Retrieve formated Date * * @param string $date + * @deprecated * @return string */ public function getFormatedDate($date) + { + return $this->getFormattedDate($date); + } + + /** + * Retrieve formatted Date + * + * @param string $date + * @return string + */ + public function getFormattedDate($date) { return $this->formatDate($date, \IntlDateFormatter::MEDIUM); } diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeOptionManagementInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeOptionManagementInterfaceTest.php index f9442d8b6499a..1d37ea9a2fc6d 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeOptionManagementInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeOptionManagementInterfaceTest.php @@ -111,6 +111,9 @@ public function addDataProvider() 'option_with_value_node_that_starts_with_a_number' => [ array_merge($optionPayload, [AttributeOptionInterface::VALUE => '123_some_text']) ], + 'option_with_value_node_that_is_a_number' => [ + array_merge($optionPayload, [AttributeOptionInterface::VALUE => '123']) + ], ]; } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/RemoveTest.php b/dev/tests/integration/testsuite/Magento/Framework/Composer/RemoveTest.php index bfe8264d7cce6..211b28617cbe2 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Composer/RemoveTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/RemoveTest.php @@ -24,7 +24,7 @@ public function testRemove() [ 'command' => 'remove', 'packages' => ['magento/package-a', 'magento/package-b'], - '--no-update' => true, + '--no-update-with-dependencies' => true, ] ); $composerAppFactory->expects($this->once()) diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_list.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_list.php index 43e98419798a8..7f14d8cf26056 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_list.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_list.php @@ -5,13 +5,14 @@ */ use Magento\Sales\Model\Order; +use Magento\Sales\Api\OrderRepositoryInterface; +use Magento\Sales\Model\Order\Address as OrderAddress; require 'order.php'; /** @var Order $order */ -/** @var Order\Payment $payment */ -/** @var Order\Item $orderItem */ -/** @var Order\Address $billingAddress */ -/** @var Order\Address $shippingAddress */ +/** @var Order\Payment $payment */ +/** @var Order\Item $orderItem */ +/** @var array $addressData Data for creating addresses for the orders. */ $orders = [ [ 'increment_id' => '100000002', @@ -48,16 +49,30 @@ ], ]; +/** @var OrderRepositoryInterface $orderRepository */ +$orderRepository = $objectManager->create(OrderRepositoryInterface::class); /** @var array $orderData */ foreach ($orders as $orderData) { /** @var $order \Magento\Sales\Model\Order */ $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Sales\Model\Order::class ); + + // Reset addresses + /** @var Order\Address $billingAddress */ + $billingAddress = $objectManager->create(OrderAddress::class, ['data' => $addressData]); + $billingAddress->setAddressType('billing'); + + $shippingAddress = clone $billingAddress; + $shippingAddress->setId(null)->setAddressType('shipping'); + $order ->setData($orderData) ->addItem($orderItem) + ->setCustomerIsGuest(true) + ->setCustomerEmail('customer@null.com') ->setBillingAddress($billingAddress) - ->setBillingAddress($shippingAddress) - ->save(); + ->setShippingAddress($shippingAddress); + + $orderRepository->save($order); } diff --git a/lib/internal/Magento/Framework/Composer/Remove.php b/lib/internal/Magento/Framework/Composer/Remove.php index b7a9a20333d86..b7cea7769a176 100644 --- a/lib/internal/Magento/Framework/Composer/Remove.php +++ b/lib/internal/Magento/Framework/Composer/Remove.php @@ -46,7 +46,7 @@ public function remove(array $packages) [ 'command' => 'remove', 'packages' => $packages, - '--no-update' => true, + '--no-update-with-dependencies' => true, ] ); } diff --git a/lib/web/fotorama/fotorama.js b/lib/web/fotorama/fotorama.js index 89cb315b0d2c4..0d12a4a7fdb69 100644 --- a/lib/web/fotorama/fotorama.js +++ b/lib/web/fotorama/fotorama.js @@ -2568,7 +2568,7 @@ fotoramaVersion = '4.6.4'; thisData.t > rightLimit : thisData.l > rightLimit; specialMeasures.w = thisData.w; - if (thisData.l + thisData.w < leftLimit + if ((opts.navdir !== 'vertical' && thisData.l + thisData.w < leftLimit) || exceedLimit || callFit(thisData.$img, specialMeasures)) return; diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js index 86d98181724cd..b8000640506f1 100644 --- a/lib/web/mage/menu.js +++ b/lib/web/mage/menu.js @@ -85,12 +85,10 @@ define([ var controls = this.controls, toggle = this.toggle; - this._on(controls.toggleBtn, { - 'click': toggle - }); - this._on(controls.swipeArea, { - 'swipeleft': toggle - }); + controls.toggleBtn.off('click'); + controls.toggleBtn.on('click', toggle.bind(this)); + controls.swipeArea.off('swipeleft'); + controls.swipeArea.on('swipeleft', toggle.bind(this)); }, /** diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index 86dd5a3b03681..a577208894944 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -364,7 +364,7 @@ ], 'time12h': [ function (value, element) { - return this.optional(element) || /^((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))$/i.test(value); + return this.optional(element) || /^((0?[1-9]|1[012])(:[0-5]\d){0,2}(\s[AP]M))$/i.test(value); }, $.mage.__('Please enter a valid time, between 00:00 am and 12:00 pm') ],