From e97e0e08bff18bc84f01ce0e9ad6aee7ef70860a Mon Sep 17 00:00:00 2001 From: Sergey Shvets Date: Mon, 22 Oct 2018 17:46:44 +0300 Subject: [PATCH 1/6] MAGETWO-95739: Zip code is not validated during checkout when "My billing and shipping address are the same" is unchecked --- .../web/js/model/shipping-rates-validator.js | 16 +++++++++------- .../view/frontend/web/js/view/billing-address.js | 9 +++++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js b/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js index d31c0dca3811..ca11fec7cd5a 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js @@ -35,7 +35,6 @@ define([ var checkoutConfig = window.checkoutConfig, validators = [], observedElements = [], - postcodeElement = null, postcodeElementName = 'postcode'; validators.push(defaultValidator); @@ -79,7 +78,11 @@ define([ } $.each(elements, function (index, field) { - uiRegistry.async(formPath + '.' + field)(self.doElementBinding.bind(self)); + var elementBinding = self.doElementBinding.bind(self), + fullPath = formPath + '.' + field, + func = uiRegistry.async(fullPath); + + func(elementBinding); }); }, @@ -101,7 +104,6 @@ define([ if (element.index === postcodeElementName) { this.bindHandler(element, delay); - postcodeElement = element; } }, @@ -136,7 +138,7 @@ define([ if (!formPopUpState.isVisible()) { clearTimeout(self.validateAddressTimeout); self.validateAddressTimeout = setTimeout(function () { - self.postcodeValidation(); + self.postcodeValidation(element); self.validateFields(); }, delay); } @@ -148,7 +150,7 @@ define([ /** * @return {*} */ - postcodeValidation: function () { + postcodeValidation: function (postcodeElement) { var countryId = $('select[name="country_id"]').val(), validationResult, warnMessage; @@ -178,8 +180,8 @@ define([ */ validateFields: function () { var addressFlat = addressConverter.formDataProviderToFlatData( - this.collectObservedData(), - 'shippingAddress' + this.collectObservedData(), + 'shippingAddress' ), address; diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js index 6b5d08c2641c..6a2f329d095d 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js @@ -17,7 +17,8 @@ define([ 'Magento_Customer/js/customer-data', 'Magento_Checkout/js/action/set-billing-address', 'Magento_Ui/js/model/messageList', - 'mage/translate' + 'mage/translate', + 'Magento_Checkout/js/model/shipping-rates-validator' ], function ( ko, @@ -33,7 +34,8 @@ function ( customerData, setBillingAddressAction, globalMessageList, - $t + $t, + shippingRatesValidator ) { 'use strict'; @@ -71,6 +73,9 @@ function ( quote.paymentMethod.subscribe(function () { checkoutDataResolver.resolveBillingAddress(); }, this); + shippingRatesValidator.initFields( + 'checkout.steps.billing-step.payment.payments-list.checkmo-form.form-fields' + ); }, /** From e7d5aa8c8bb959b3d03c5d8f75ce3eee4727df00 Mon Sep 17 00:00:00 2001 From: Sergey Shvets Date: Tue, 23 Oct 2018 17:04:32 +0300 Subject: [PATCH 2/6] MAGETWO-95848: Customer Cart Checkout error --- .../Item/ItemProductResolver.php | 56 ++++--- .../Item/ItemProductResolverTest.php | 143 ++++++++++++++++++ 2 files changed, 176 insertions(+), 23 deletions(-) create mode 100644 app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Configuration/Item/ItemProductResolverTest.php diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php b/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php index 6c33ecc138ae..7de78b6612a1 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php @@ -13,16 +13,17 @@ use Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Catalog\Model\Product; +use Magento\Store\Model\ScopeInterface; /** - * {@inheritdoc} + * Resolves the product from a configured item. */ class ItemProductResolver implements ItemResolverInterface { /** * Path in config to the setting which defines if parent or child product should be used to generate a thumbnail. */ - const CONFIG_THUMBNAIL_SOURCE = 'checkout/cart/configurable_product_image'; + public const CONFIG_THUMBNAIL_SOURCE = 'checkout/cart/configurable_product_image'; /** * @var ScopeConfigInterface @@ -38,27 +39,21 @@ public function __construct(ScopeConfigInterface $scopeConfig) } /** - * {@inheritdoc} + * Get the final product from a configured item by product type and selection. + * + * @param ItemInterface $item + * @return ProductInterface */ - public function getFinalProduct(ItemInterface $item) : ProductInterface + public function getFinalProduct(ItemInterface $item): ProductInterface { /** * Show parent product thumbnail if it must be always shown according to the related setting in system config * or if child thumbnail is not available. */ - $parentProduct = $item->getProduct(); - $finalProduct = $parentProduct; + $finalProduct = $item->getProduct(); $childProduct = $this->getChildProduct($item); - if ($childProduct !== $parentProduct) { - $configValue = $this->scopeConfig->getValue( - self::CONFIG_THUMBNAIL_SOURCE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); - $childThumb = $childProduct->getData('thumbnail'); - $finalProduct = - ($configValue == Thumbnail::OPTION_USE_PARENT_IMAGE) || (!$childThumb || $childThumb == 'no_selection') - ? $parentProduct - : $childProduct; + if ($childProduct !== null && $this->isUseChildProduct($childProduct)) { + $finalProduct = $childProduct; } return $finalProduct; } @@ -67,15 +62,30 @@ public function getFinalProduct(ItemInterface $item) : ProductInterface * Get item configurable child product. * * @param ItemInterface $item - * @return Product + * @return Product | null */ - private function getChildProduct(ItemInterface $item) : Product + private function getChildProduct(ItemInterface $item): ?Product { + /** @var \Magento\Quote\Model\Quote\Item\Option $option */ $option = $item->getOptionByCode('simple_product'); - $product = $item->getProduct(); - if ($option) { - $product = $option->getProduct(); - } - return $product; + return $option ? $option->getProduct() : null; + } + + /** + * Is need to use child product + * + * @param Product $childProduct + * @return bool + */ + private function isUseChildProduct(Product $childProduct): bool + { + $configValue = $this->scopeConfig->getValue( + self::CONFIG_THUMBNAIL_SOURCE, + ScopeInterface::SCOPE_STORE + ); + $childThumb = $childProduct->getData('thumbnail'); + return $configValue !== Thumbnail::OPTION_USE_PARENT_IMAGE + && $childThumb !== null + && $childThumb !== 'no_selection'; } } diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Configuration/Item/ItemProductResolverTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Configuration/Item/ItemProductResolverTest.php new file mode 100644 index 000000000000..8dac2dee10d3 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Configuration/Item/ItemProductResolverTest.php @@ -0,0 +1,143 @@ +scopeConfig = $this->getMockBuilder(ScopeConfigInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->parentProduct = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->getMock(); + $this->parentProduct + ->method('getSku') + ->willReturn('parent_product'); + + $this->childProduct = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->getMock(); + $this->childProduct + ->method('getSku') + ->willReturn('child_product'); + + $this->option = $this->getMockBuilder(Option::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->option + ->method('getProduct') + ->willReturn($this->childProduct); + + $this->item = $this->getMockBuilder(ItemInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->item + ->expects($this->once()) + ->method('getProduct') + ->willReturn($this->parentProduct); + + $this->model = new ItemProductResolver($this->scopeConfig); + } + + /** + * Test for deleted child product from configurable product + */ + public function testGetFinalProductChildIsNull(): void + { + $this->scopeConfig->expects($this->never())->method('getValue'); + $this->childProduct->expects($this->never())->method('getData'); + + $this->item->expects($this->once()) + ->method('getOptionByCode') + ->willReturn(null); + + $finalProduct = $this->model->getFinalProduct($this->item); + $this->assertEquals( + $this->parentProduct->getSku(), + $finalProduct->getSku() + ); + } + + /** + * Tests child product from configurable product + * + * @dataProvider provideScopeConfig + * @param string $expectedSku + * @param string $scopeValue + * @param string | null $thumbnail + */ + public function testGetFinalProductChild($expectedSku, $scopeValue, $thumbnail): void + { + $this->item->expects($this->once()) + ->method('getOptionByCode') + ->willReturn($this->option); + + $this->childProduct + ->expects($this->once()) + ->method('getData') + ->willReturn($thumbnail); + + $this->scopeConfig->expects($this->once()) + ->method('getValue') + ->willReturn($scopeValue); + + $finalProduct = $this->model->getFinalProduct($this->item); + $this->assertEquals($expectedSku, $finalProduct->getSku()); + } + + /** + * Dataprovider for scope test + * @return array + */ + public function provideScopeConfig(): array + { + return [ + ['child_product', Thumbnail::OPTION_USE_OWN_IMAGE, 'thumbnail'], + ['parent_product', Thumbnail::OPTION_USE_PARENT_IMAGE, 'thumbnail'], + + ['parent_product', Thumbnail::OPTION_USE_OWN_IMAGE, null], + ['parent_product', Thumbnail::OPTION_USE_OWN_IMAGE, 'no_selection'], + + ['parent_product', Thumbnail::OPTION_USE_PARENT_IMAGE, null], + ['parent_product', Thumbnail::OPTION_USE_PARENT_IMAGE, 'no_selection'], + ]; + } +} From 8a64a2991dc979ade0ec0907a9de29a022f0e857 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk Date: Mon, 29 Oct 2018 14:43:57 +0200 Subject: [PATCH 3/6] MAGETWO-95536: [2.3] Admin users are deleted from role upon Role save - fixed - added test --- .../Integration/Plugin/Model/AdminUser.php | 8 +- .../Adminhtml/User/Role/SaveRole.php | 65 +++++++++++----- .../Adminhtml/User/Role/SaveRoleTest.php | 77 +++++++++++++++++++ .../User/_files/two_users_with_role.php | 52 +++++++++++++ .../_files/two_users_with_role_rollback.php | 21 +++++ 5 files changed, 201 insertions(+), 22 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/Role/SaveRoleTest.php create mode 100644 dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role.php create mode 100644 dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role_rollback.php diff --git a/app/code/Magento/Integration/Plugin/Model/AdminUser.php b/app/code/Magento/Integration/Plugin/Model/AdminUser.php index df3766250caa..7b2fa1981bce 100644 --- a/app/code/Magento/Integration/Plugin/Model/AdminUser.php +++ b/app/code/Magento/Integration/Plugin/Model/AdminUser.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Integration\Plugin\Model; use Magento\Integration\Model\AdminTokenService; @@ -31,14 +32,15 @@ public function __construct( * * @param \Magento\User\Model\User $subject * @param \Magento\Framework\DataObject $object - * @return $this + * @return \Magento\User\Model\User + * @throws \Magento\Framework\Exception\LocalizedException */ public function afterSave( \Magento\User\Model\User $subject, \Magento\Framework\DataObject $object - ) { + ): \Magento\User\Model\User { $isActive = $object->getIsActive(); - if (isset($isActive) && $isActive == 0) { + if ($isActive !== null && $isActive == 0) { $this->adminTokenService->revokeAdminAccessToken($object->getId()); } return $subject; diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php b/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php index acd3430f5c25..97ecb778b8cb 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php +++ b/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php @@ -11,6 +11,7 @@ use Magento\Authorization\Model\Acl\Role\Group as RoleGroup; use Magento\Authorization\Model\UserContextInterface; use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\State\UserLockedException; use Magento\Security\Model\SecurityCookie; @@ -77,10 +78,8 @@ public function execute() $rid = $this->getRequest()->getParam('role_id', false); $resource = $this->getRequest()->getParam('resource', false); - $roleUsers = $this->getRequest()->getParam('in_role_user', null); - parse_str($roleUsers, $roleUsers); - $roleUsers = array_keys($roleUsers); - + $oldRoleUsers = $this->parseRequestVariable('in_role_user_old'); + $roleUsers = $this->parseRequestVariable('in_role_user'); $isAll = $this->getRequest()->getParam('all'); if ($isAll) { $resource = [$this->_objectManager->get(\Magento\Framework\Acl\RootResource::class)->getId()]; @@ -106,13 +105,9 @@ public function execute() $role->save(); $this->_rulesFactory->create()->setRoleId($role->getId())->setResources($resource)->saveRel(); - - $this->processPreviousUsers($role); - - foreach ($roleUsers as $nRuid) { - $this->_addUserToRole($nRuid, $role->getId()); - } - $this->messageManager->addSuccess(__('You saved the role.')); + $this->processPreviousUsers($role, $oldRoleUsers); + $this->processCurrentUsers($role, $roleUsers); + $this->messageManager->addSuccessMessage(__('You saved the role.')); } catch (UserLockedException $e) { $this->_auth->logout(); $this->getSecurityCookie()->setLogoutReasonCookie( @@ -120,14 +115,14 @@ public function execute() ); return $resultRedirect->setPath('*'); } catch (\Magento\Framework\Exception\AuthenticationException $e) { - $this->messageManager->addError( + $this->messageManager->addErrorMessage( __('The password entered for the current user is invalid. Verify the password and try again.') ); return $this->saveDataToSessionAndRedirect($role, $this->getRequest()->getPostValue(), $resultRedirect); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addError(__('An error occurred while saving this role.')); + $this->messageManager->addErrorMessage(__('An error occurred while saving this role.')); } return $resultRedirect->setPath('*/*/'); @@ -151,19 +146,30 @@ protected function validateUser() return $this; } + /** + * Parse request value from string + * + * @param string $paramName + * @return array + */ + private function parseRequestVariable($paramName): array + { + $value = $this->getRequest()->getParam($paramName, null); + parse_str($value, $value); + $value = array_keys($value); + return $value; + } + /** * Process previous users * * @param \Magento\Authorization\Model\Role $role + * @param array $oldRoleUsers * @return $this * @throws \Exception */ - protected function processPreviousUsers(\Magento\Authorization\Model\Role $role) + protected function processPreviousUsers(\Magento\Authorization\Model\Role $role, array $oldRoleUsers): self { - $oldRoleUsers = $this->getRequest()->getParam('in_role_user_old'); - parse_str($oldRoleUsers, $oldRoleUsers); - $oldRoleUsers = array_keys($oldRoleUsers); - foreach ($oldRoleUsers as $oUid) { $this->_deleteUserFromRole($oUid, $role->getId()); } @@ -171,12 +177,33 @@ protected function processPreviousUsers(\Magento\Authorization\Model\Role $role) return $this; } + /** + * Processes users to be assigned to roles + * + * @param \Magento\Authorization\Model\Role $role + * @param array $roleUsers + * @return $this + */ + private function processCurrentUsers(\Magento\Authorization\Model\Role $role, array $roleUsers): self + { + foreach ($roleUsers as $nRuid) { + try { + $this->_addUserToRole($nRuid, $role->getId()); + } catch (LocalizedException $e) { + $this->messageManager->addErrorMessage($e->getMessage()); + } + } + + return $this; + } + /** * Assign user to role * * @param int $userId * @param int $roleId * @return bool + * @throws LocalizedException */ protected function _addUserToRole($userId, $roleId) { diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/Role/SaveRoleTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/Role/SaveRoleTest.php new file mode 100644 index 000000000000..50b28e2bac0a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/Role/SaveRoleTest.php @@ -0,0 +1,77 @@ +create(User::class) + ->loadByUsername('user'); + /** @var \Magento\Backend\Model\Auth\Session $authSession */ + $authSession = $objectManager->create(Session::class); + $authSession->setUser($currentAdmin); + $user1Id = $objectManager->create(User::class) + ->loadByUsername('johnAdmin')->getId(); + $user2Id = $objectManager->create(User::class) + ->loadByUsername('annAdmin')->getId(); + + /** @var \Magento\Authorization\Model\RoleFactory $roleFactory */ + $roleFactory = $objectManager->create(\Magento\Authorization\Model\RoleFactory::class); + $role = $roleFactory->create()->load(1); + + /** @var \Magento\AdminGws\Model\Role $gwsRole */ + $gwsRole = $objectManager->get(\Magento\AdminGws\Model\Role::class); + $gwsRole->setAdminRole($role); + $gwsRole->setStoreGroupIds([1]); + + $params = [ + 'role_id' => 1, + 'in_role_user_old'=> $user1Id . '=true&' . $user2Id . '=true', + 'in_role_user'=> $user1Id . '=true&' . $user2Id . '=true', + 'all' => 1, + 'current_password' => 'password1', + 'rolename' => 'Administrators', + ]; + + $post = [ + 'gws_is_all' => 1, + 'gws_store_groups' => ['1'], + ]; + + $this->getRequest()->setParams($params); + $this->getRequest()->setPostValue($post); + + $model = $objectManager->create(SaveRole::class); + $model->execute(); + $this->assertSessionMessages( + $this->equalTo(['You saved the role.']), + MessageInterface::TYPE_SUCCESS + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role.php b/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role.php new file mode 100644 index 000000000000..3b9e9b66427e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role.php @@ -0,0 +1,52 @@ +create(\Magento\User\Model\ResourceModel\User::class); + +/** @var $user User */ +$user = $objectManager->create(User::class); +$user->setFirstname("John") + ->setIsActive(true) + ->setLastname("Doe") + ->setUsername('johnAdmin') + ->setPassword(\Magento\TestFramework\Bootstrap::ADMIN_PASSWORD) + ->setEmail('JohnadminUser@example.com') + ->setRoleType('G') + ->setResourceId('Magento_Backend::all') + ->setPrivileges("") + ->setAssertId(0) + ->setRoleId(1) + ->setPermission('allow'); + +$userResource->save($user); + +/** @var $user User */ +$user = $objectManager->create(User::class); +$user->setFirstname("Ann") + ->setIsActive(true) + ->setLastname("Doe") + ->setUsername('annAdmin') + ->setPassword(\Magento\TestFramework\Bootstrap::ADMIN_PASSWORD) + ->setEmail('JaneadminUser@example.com') + ->setRoleType('G') + ->setResourceId('Magento_Backend::all') + ->setPrivileges("") + ->setAssertId(0) + ->setRoleId(1) + ->setPermission('allow'); + +$userResource->save($user); diff --git a/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role_rollback.php b/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role_rollback.php new file mode 100644 index 000000000000..7d7d85c71a99 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role_rollback.php @@ -0,0 +1,21 @@ +create(User::class); +$user->loadByUsername('johnAdmin')->delete(); + +/** @var $user User */ +$user = Bootstrap::getObjectManager()->create(User::class); +$user->loadByUsername('annAdmin')->delete(); From 34163dca8d82ee4adbc4387c169215ef8d62d9c2 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk Date: Tue, 30 Oct 2018 11:49:19 +0200 Subject: [PATCH 4/6] MAGETWO-95536: [2.3] Admin users are deleted from role upon Role save - moved test --- .../Adminhtml/User/Role/SaveRoleTest.php | 77 ------------------- 1 file changed, 77 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/Role/SaveRoleTest.php diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/Role/SaveRoleTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/Role/SaveRoleTest.php deleted file mode 100644 index 50b28e2bac0a..000000000000 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/Role/SaveRoleTest.php +++ /dev/null @@ -1,77 +0,0 @@ -create(User::class) - ->loadByUsername('user'); - /** @var \Magento\Backend\Model\Auth\Session $authSession */ - $authSession = $objectManager->create(Session::class); - $authSession->setUser($currentAdmin); - $user1Id = $objectManager->create(User::class) - ->loadByUsername('johnAdmin')->getId(); - $user2Id = $objectManager->create(User::class) - ->loadByUsername('annAdmin')->getId(); - - /** @var \Magento\Authorization\Model\RoleFactory $roleFactory */ - $roleFactory = $objectManager->create(\Magento\Authorization\Model\RoleFactory::class); - $role = $roleFactory->create()->load(1); - - /** @var \Magento\AdminGws\Model\Role $gwsRole */ - $gwsRole = $objectManager->get(\Magento\AdminGws\Model\Role::class); - $gwsRole->setAdminRole($role); - $gwsRole->setStoreGroupIds([1]); - - $params = [ - 'role_id' => 1, - 'in_role_user_old'=> $user1Id . '=true&' . $user2Id . '=true', - 'in_role_user'=> $user1Id . '=true&' . $user2Id . '=true', - 'all' => 1, - 'current_password' => 'password1', - 'rolename' => 'Administrators', - ]; - - $post = [ - 'gws_is_all' => 1, - 'gws_store_groups' => ['1'], - ]; - - $this->getRequest()->setParams($params); - $this->getRequest()->setPostValue($post); - - $model = $objectManager->create(SaveRole::class); - $model->execute(); - $this->assertSessionMessages( - $this->equalTo(['You saved the role.']), - MessageInterface::TYPE_SUCCESS - ); - } -} From 7e42eba3b9a2003e227404b33a29b728ae48a62a Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk Date: Tue, 30 Oct 2018 12:57:31 +0200 Subject: [PATCH 5/6] MAGETWO-95536: [2.3] Admin users are deleted from role upon Role save - moved files --- .../User/_files/two_users_with_role.php | 52 ------------------- .../_files/two_users_with_role_rollback.php | 21 -------- 2 files changed, 73 deletions(-) delete mode 100644 dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role.php delete mode 100644 dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role.php b/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role.php deleted file mode 100644 index 3b9e9b66427e..000000000000 --- a/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role.php +++ /dev/null @@ -1,52 +0,0 @@ -create(\Magento\User\Model\ResourceModel\User::class); - -/** @var $user User */ -$user = $objectManager->create(User::class); -$user->setFirstname("John") - ->setIsActive(true) - ->setLastname("Doe") - ->setUsername('johnAdmin') - ->setPassword(\Magento\TestFramework\Bootstrap::ADMIN_PASSWORD) - ->setEmail('JohnadminUser@example.com') - ->setRoleType('G') - ->setResourceId('Magento_Backend::all') - ->setPrivileges("") - ->setAssertId(0) - ->setRoleId(1) - ->setPermission('allow'); - -$userResource->save($user); - -/** @var $user User */ -$user = $objectManager->create(User::class); -$user->setFirstname("Ann") - ->setIsActive(true) - ->setLastname("Doe") - ->setUsername('annAdmin') - ->setPassword(\Magento\TestFramework\Bootstrap::ADMIN_PASSWORD) - ->setEmail('JaneadminUser@example.com') - ->setRoleType('G') - ->setResourceId('Magento_Backend::all') - ->setPrivileges("") - ->setAssertId(0) - ->setRoleId(1) - ->setPermission('allow'); - -$userResource->save($user); diff --git a/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role_rollback.php b/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role_rollback.php deleted file mode 100644 index 7d7d85c71a99..000000000000 --- a/dev/tests/integration/testsuite/Magento/User/_files/two_users_with_role_rollback.php +++ /dev/null @@ -1,21 +0,0 @@ -create(User::class); -$user->loadByUsername('johnAdmin')->delete(); - -/** @var $user User */ -$user = Bootstrap::getObjectManager()->create(User::class); -$user->loadByUsername('annAdmin')->delete(); From 64606aaa1d5ee4b57605b8572f641dbf471aec0d Mon Sep 17 00:00:00 2001 From: Sergey Shvets Date: Wed, 31 Oct 2018 12:21:47 +0200 Subject: [PATCH 6/6] MAGETWO-95739: Zip code is not validated during checkout when "My billing and shipping address are the same" is unchecked --- .../Checkout/view/frontend/web/js/view/billing-address.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js index 6a2f329d095d..6f9a1a46826d 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js @@ -73,9 +73,7 @@ function ( quote.paymentMethod.subscribe(function () { checkoutDataResolver.resolveBillingAddress(); }, this); - shippingRatesValidator.initFields( - 'checkout.steps.billing-step.payment.payments-list.checkmo-form.form-fields' - ); + shippingRatesValidator.initFields(this.get('name') + '.form-fields'); }, /**