From c105a16e6e3e678720917406f778aba755e1a597 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Mon, 6 Jun 2016 13:42:42 +0300 Subject: [PATCH 01/11] MAGETWO-53134: Impossible resave customer on backend if he has address with optional state for country --- .../Magento/Customer/view/base/ui_component/customer_form.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml index 6ede18b0edf35..a3af626a0a46b 100644 --- a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml +++ b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml @@ -391,6 +391,7 @@ text select + Magento_Ui/js/form/element/region address region From 23103c03c527fe1ed3e1a3be691436818b7963fe Mon Sep 17 00:00:00 2001 From: Oleksandr Karpenko Date: Tue, 7 Jun 2016 18:15:25 +0300 Subject: [PATCH 02/11] MAGETWO-53010: [Email Logo] Saving a custom transactional email logo, failed. --- .../Model/Config/Backend/Email/Logo.php | 3 ++ .../Magento/Email/Model/AbstractTemplate.php | 2 +- .../Email/Model/Design/Backend/Logo.php | 33 +++++++++++++++++++ app/code/Magento/Email/etc/di.xml | 2 +- .../Theme/Model/Design/Backend/Logo.php | 2 +- 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/Email/Model/Design/Backend/Logo.php diff --git a/app/code/Magento/Config/Model/Config/Backend/Email/Logo.php b/app/code/Magento/Config/Model/Config/Backend/Email/Logo.php index 701439ff2dbef..b88923a61730a 100644 --- a/app/code/Magento/Config/Model/Config/Backend/Email/Logo.php +++ b/app/code/Magento/Config/Model/Config/Backend/Email/Logo.php @@ -11,6 +11,9 @@ */ namespace Magento\Config\Model\Config\Backend\Email; +/** + * @deprecated + */ class Logo extends \Magento\Config\Model\Config\Backend\Image { /** diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index eb9ed2ead8f50..4ce6f0d90a6cc 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -389,7 +389,7 @@ protected function getLogoUrl($store) $store ); if ($fileName) { - $uploadDir = \Magento\Config\Model\Config\Backend\Email\Logo::UPLOAD_DIR; + $uploadDir = \Magento\Email\Model\Design\Backend\Logo::UPLOAD_DIR; $mediaDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA); if ($mediaDirectory->isFile($uploadDir . '/' . $fileName)) { return $this->storeManager->getStore()->getBaseUrl( diff --git a/app/code/Magento/Email/Model/Design/Backend/Logo.php b/app/code/Magento/Email/Model/Design/Backend/Logo.php new file mode 100644 index 0000000000000..f315af490d241 --- /dev/null +++ b/app/code/Magento/Email/Model/Design/Backend/Logo.php @@ -0,0 +1,33 @@ + design/email/logo other_settings/email - Magento\Theme\Model\Design\Backend\Logo + Magento\Email\Model\Design\Backend\Logo media 1 diff --git a/app/code/Magento/Theme/Model/Design/Backend/Logo.php b/app/code/Magento/Theme/Model/Design/Backend/Logo.php index 78bc7603492ab..05b4bb9e2726f 100644 --- a/app/code/Magento/Theme/Model/Design/Backend/Logo.php +++ b/app/code/Magento/Theme/Model/Design/Backend/Logo.php @@ -21,7 +21,7 @@ class Logo extends Image */ protected function _getUploadDir() { - return $this->_mediaDirectory->getRelativePath($this->_appendScopeInfo(self::UPLOAD_DIR)); + return $this->_mediaDirectory->getRelativePath($this->_appendScopeInfo(static::UPLOAD_DIR)); } /** From fe12b4dcf967f2c81b618489ce750ce0c8f02b81 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi Date: Wed, 8 Jun 2016 12:37:44 +0300 Subject: [PATCH 03/11] MAGETWO-51887: [GITHUB] Fatal error when page.messages block removed from xml #4127 --- app/code/Magento/Customer/Controller/Account/Edit.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Customer/Controller/Account/Edit.php b/app/code/Magento/Customer/Controller/Account/Edit.php index db54956742ffb..e6b7667574d41 100644 --- a/app/code/Magento/Customer/Controller/Account/Edit.php +++ b/app/code/Magento/Customer/Controller/Account/Edit.php @@ -80,7 +80,6 @@ public function execute() $this->session->setChangePassword($this->getRequest()->getParam('changepass') == 1); $resultPage->getConfig()->getTitle()->set(__('Account Information')); - $resultPage->getLayout()->getBlock('messages')->setEscapeMessageFlag(true); return $resultPage; } } From 2f32aed829a55cf7d5b42b7cc7b8cd43356bf16a Mon Sep 17 00:00:00 2001 From: Oleksandr Karpenko Date: Wed, 8 Jun 2016 12:53:43 +0300 Subject: [PATCH 04/11] MAGETWO-53010: [Email Logo] Saving a custom transactional email logo, failed. --- app/code/Magento/Email/composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 5ef136daf489b..4d19d7abcbe72 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -3,6 +3,7 @@ "description": "N/A", "require": { "php": "~5.5.22|~5.6.0|~7.0.0", + "magento/module-theme": "100.1.*", "magento/module-config": "100.1.*", "magento/module-store": "100.1.*", "magento/module-cms": "101.0.*", From 362f62f3c9b6c2994070615d82efbdf19f15fe50 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi Date: Wed, 8 Jun 2016 18:08:11 +0300 Subject: [PATCH 05/11] MAGETWO-53628: JS error in the authentication-popup --- .../Block/Account/AuthenticationPopup.php | 17 ++ app/code/Magento/Customer/Model/Customer.php | 2 +- .../Block/Account/AuthenticationPopupTest.php | 157 ++++++++++++++++++ .../account/authentication-popup.phtml | 1 + .../web/js/view/authentication-popup.js | 2 +- 5 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Customer/Test/Unit/Block/Account/AuthenticationPopupTest.php diff --git a/app/code/Magento/Customer/Block/Account/AuthenticationPopup.php b/app/code/Magento/Customer/Block/Account/AuthenticationPopup.php index 102e8bc5eebe8..5eb4f7fe055e0 100644 --- a/app/code/Magento/Customer/Block/Account/AuthenticationPopup.php +++ b/app/code/Magento/Customer/Block/Account/AuthenticationPopup.php @@ -5,6 +5,9 @@ */ namespace Magento\Customer\Block\Account; +use Magento\Customer\Model\Form; +use Magento\Store\Model\ScopeInterface; + class AuthenticationPopup extends \Magento\Framework\View\Element\Template { /** @@ -40,12 +43,26 @@ public function getJsLayout() public function getConfig() { return [ + 'autocomplete' => $this->isAutocompleteEnabled(), 'customerRegisterUrl' => $this->getCustomerRegisterUrlUrl(), 'customerForgotPasswordUrl' => $this->getCustomerForgotPasswordUrl(), 'baseUrl' => $this->getBaseUrl() ]; } + /** + * Is autocomplete enabled for storefront + * + * @return string + */ + private function isAutocompleteEnabled() + { + return $this->_scopeConfig->getValue( + Form::XML_PATH_ENABLE_AUTOCOMPLETE, + ScopeInterface::SCOPE_STORE + ) ? 'on' : 'off'; + } + /** * Return base url. * diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index add7c10414667..84546eb31fc2c 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -1340,7 +1340,7 @@ public function getPasswordConfirm() } /** - * Return Password Confirmation + * Return Password * * @return string */ diff --git a/app/code/Magento/Customer/Test/Unit/Block/Account/AuthenticationPopupTest.php b/app/code/Magento/Customer/Test/Unit/Block/Account/AuthenticationPopupTest.php new file mode 100644 index 0000000000000..05f56d2570273 --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/Block/Account/AuthenticationPopupTest.php @@ -0,0 +1,157 @@ +contextMock = $this->getMockBuilder(Context::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class) + ->getMock(); + $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->getMock(); + $this->urlBuilderMock = $this->getMockBuilder(UrlInterface::class) + ->getMock(); + + $this->contextMock->expects($this->once()) + ->method('getStoreManager') + ->willReturn($this->storeManagerMock); + $this->contextMock->expects($this->once()) + ->method('getScopeConfig') + ->willReturn($this->scopeConfigMock); + $this->contextMock->expects($this->once()) + ->method('getUrlBuilder') + ->willReturn($this->urlBuilderMock); + + $this->model = new AuthenticationPopup( + $this->contextMock + ); + } + + /** + * @param mixed $isAutocomplete + * @param string $baseUrl + * @param string $registerUrl + * @param string $forgotUrl + * @param array $result + * + * @dataProvider dataProviderGetConfig + */ + public function testGetConfig($isAutocomplete, $baseUrl, $registerUrl, $forgotUrl, array $result) + { + $this->scopeConfigMock->expects($this->any()) + ->method('getValue') + ->with(Form::XML_PATH_ENABLE_AUTOCOMPLETE, ScopeInterface::SCOPE_STORE, null) + ->willReturn($isAutocomplete); + + /** @var StoreInterface||\PHPUnit_Framework_MockObject_MockObject $storeMock */ + $storeMock = $this->getMockBuilder(StoreInterface::class) + ->setMethods(['getBaseUrl']) + ->getMockForAbstractClass(); + + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->with(null) + ->willReturn($storeMock); + + $storeMock->expects($this->any()) + ->method('getBaseUrl') + ->willReturn($baseUrl); + + $this->urlBuilderMock->expects($this->any()) + ->method('getUrl') + ->willReturnMap( + [ + ['customer/account/create', [], $registerUrl], + ['customer/account/forgotpassword', [], $forgotUrl], + ] + ); + + $this->assertEquals($result, $this->model->getConfig()); + } + + public function dataProviderGetConfig() + { + return [ + [ + 0, + 'base', + 'reg', + 'forgot', + [ + 'autocomplete' => 'off', + 'customerRegisterUrl' => 'reg', + 'customerForgotPasswordUrl' => 'forgot', + 'baseUrl' => 'base', + ], + ], + [ + 1, + '', + 'reg', + 'forgot', + [ + 'autocomplete' => 'on', + 'customerRegisterUrl' => 'reg', + 'customerForgotPasswordUrl' => 'forgot', + 'baseUrl' => '', + ], + ], + [ + '', + 'base', + '', + 'forgot', + [ + 'autocomplete' => 'off', + 'customerRegisterUrl' => '', + 'customerForgotPasswordUrl' => 'forgot', + 'baseUrl' => 'base', + ], + ], + [ + true, + 'base', + 'reg', + '', + [ + 'autocomplete' => 'on', + 'customerRegisterUrl' => 'reg', + 'customerForgotPasswordUrl' => '', + 'baseUrl' => 'base', + ], + ], + ]; + } +} diff --git a/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml b/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml index 83d4bad447268..f7330686c54c1 100644 --- a/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml @@ -5,6 +5,7 @@ */ // @codingStandardsIgnoreFile +/** @var $block \Magento\Customer\Block\Account\AuthenticationPopup */ ?>