Skip to content

Commit 44e90c4

Browse files
committed
Merge pull request #137 from magento-south/BUGS
[South] Sprint 32: Bug fixes
2 parents a72c664 + a484482 commit 44e90c4

File tree

38 files changed

+1302
-220
lines changed

38 files changed

+1302
-220
lines changed

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@
179179
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
180180
<comment>Warning! Enabling this feature is not recommended on production environments because it represents a potential security risk.</comment>
181181
</field>
182+
<field id="minify_html" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1">
183+
<label>Minify Html</label>
184+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
185+
</field>
182186
</group>
183187
<group id="translate_inline" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
184188
<label>Translate Inline</label>

app/code/Magento/Backend/etc/config.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd">
99
<default>
10+
<dev>
11+
<template>
12+
<minify_html>1</minify_html>
13+
</template>
14+
</dev>
1015
<system>
1116
<media_storage_configuration>
1217
<allowed_resources>

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
echo 'validate-one-required-by-name' ?>"
3131
id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"
3232
type="checkbox"
33-
name="bundle_option[<?php echo $_option->getId() ?>][]"<?php if ($block->isSelected($_selection)) {
33+
name="bundle_option[<?php echo $_option->getId() ?>][<?php echo $_selection ?>]"<?php if ($block->isSelected($_selection)) {
3434
echo ' checked="checked"' ?><?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) {
3535
echo ' disabled="disabled"' ?>
3636
value="<?php echo $_selection->getSelectionId() ?>"

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
price="<?php echo $block->getSelectionPrice($_selections[0]) ?>" />
2222
<?php else: ?>
2323
<select multiple="multiple" size="5" id="bundle-option-<?php echo $_option->getId() ?>"
24-
name="bundle_option[<?php echo $_option->getId() ?>][]"
24+
name="bundle_option[<?php echo $_option->getId() ?>]"
2525
class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> multiselect change-container-classname"
2626
onchange="ProductConfigure.bundleControl.changeSelection(this)">
2727
<?php if(!$_option->getRequired()): ?>

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"
3131
type="checkbox"
3232
<?php if ($_option->getRequired()) echo 'data-validate="{\'validate-one-required-by-name\':true}"'?>
33-
name="bundle_option[<?php echo $_option->getId() ?>][]"
33+
name="bundle_option[<?php echo $_option->getId() ?>][<?php echo $_selection->getId() ?>]"
3434
<?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?>
3535
<?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>
3636
value="<?php echo $_selection->getSelectionId() ?>"/>

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/multi.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<select multiple="multiple"
2525
size="5"
2626
id="bundle-option-<?php echo $_option->getId() ?>"
27-
name="bundle_option[<?php echo $_option->getId() ?>][]"
27+
name="bundle_option[<?php echo $_option->getId() ?>]"
2828
class="bundle-option-<?php echo $_option->getId() ?> multiselect product bundle option change-container-classname"
2929
<?php if ($_option->getRequired()) echo 'data-validate={required:true}' ?>>
3030
<?php if(!$_option->getRequired()): ?>

app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<?php if ($block->getDisplayLabel()): ?>
1616
<span class="price-label"><?php echo $block->getDisplayLabel(); ?></span>
1717
<?php endif; ?>
18-
<span<?php if ($block->getPriceId()): ?> id="<?php echo $block->getPriceId() ?>"<?php endif;?>
18+
<span <?php if ($block->getPriceId()): ?> id="<?php echo $block->getPriceId() ?>"<?php endif;?>
1919
<?php echo($block->getPriceDisplayLabel()) ? 'data-label="' . $block->getPriceDisplayLabel() . $block->getPriceDisplayInclExclTaxes() . '"' : '' ?>
2020
data-price-amount="<?php echo $block->getDisplayValue(); ?>"
2121
data-price-type="<?php echo $block->getPriceType(); ?>"

app/code/Magento/Checkout/Helper/Data.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,11 @@ public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'one
278278
[
279279
'reason' => $message,
280280
'checkoutType' => $checkoutType,
281-
'dateAndTime' => $this->_localeDate->date(),
281+
'dateAndTime' => $this->_localeDate->formatDateTime(
282+
new \DateTime(),
283+
\IntlDateFormatter::MEDIUM,
284+
\IntlDateFormatter::MEDIUM
285+
),
282286
'customer' => $checkout->getCustomerFirstname() . ' ' . $checkout->getCustomerLastname(),
283287
'customerEmail' => $checkout->getCustomerEmail(),
284288
'billingAddress' => $checkout->getBillingAddress(),

app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ protected function setUp()
123123
);
124124

125125
$this->_checkoutSession = $arguments['checkoutSession'];
126-
$localeDate = $arguments['localeDate'];
127-
$localeDate->expects($this->any())->method('date')->will($this->returnValue('Oct 02, 2013'));
126+
$arguments['localeDate']->expects($this->any())
127+
->method('formatDateTime')
128+
->willReturn('Oct 02, 2013');
128129

129130
$this->_transportBuilder = $arguments['transportBuilder'];
130131

app/code/Magento/Customer/Controller/Account/CreatePost.php

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?php
22
/**
3-
*
43
* Copyright © 2015 Magento. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Customer\Controller\Account;
87

8+
use Magento\Customer\Model\Account\Redirect as AccountRedirect;
99
use Magento\Customer\Api\Data\AddressInterface;
1010
use Magento\Customer\Model\Url;
11+
use Magento\Framework\Api\DataObjectHelper;
1112
use Magento\Framework\App\Action\Context;
1213
use Magento\Customer\Model\Session;
1314
use Magento\Framework\Controller\Result\RedirectFactory;
@@ -28,19 +29,12 @@
2829
use Magento\Customer\Model\CustomerExtractor;
2930
use Magento\Framework\Exception\StateException;
3031
use Magento\Framework\Exception\InputException;
31-
use Magento\Store\Model\ScopeInterface;
3232

3333
/**
3434
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3535
*/
3636
class CreatePost extends \Magento\Customer\Controller\Account
3737
{
38-
/** @var ScopeConfigInterface */
39-
protected $scopeConfig;
40-
41-
/** @var StoreManagerInterface */
42-
protected $storeManager;
43-
4438
/** @var AccountManagementInterface */
4539
protected $accountManagement;
4640

@@ -77,10 +71,13 @@ class CreatePost extends \Magento\Customer\Controller\Account
7771
/** @var \Magento\Framework\UrlInterface */
7872
protected $urlModel;
7973

74+
/** @var DataObjectHelper */
75+
protected $dataObjectHelper;
76+
8077
/**
81-
* @var \Magento\Framework\Api\DataObjectHelper
78+
* @var AccountRedirect
8279
*/
83-
protected $dataObjectHelper;
80+
private $accountRedirect;
8481

8582
/**
8683
* @param Context $context
@@ -101,7 +98,8 @@ class CreatePost extends \Magento\Customer\Controller\Account
10198
* @param Registration $registration
10299
* @param Escaper $escaper
103100
* @param CustomerExtractor $customerExtractor
104-
* @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
101+
* @param DataObjectHelper $dataObjectHelper
102+
* @param AccountRedirect $accountRedirect
105103
*
106104
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
107105
*/
@@ -124,7 +122,8 @@ public function __construct(
124122
Registration $registration,
125123
Escaper $escaper,
126124
CustomerExtractor $customerExtractor,
127-
\Magento\Framework\Api\DataObjectHelper $dataObjectHelper
125+
DataObjectHelper $dataObjectHelper,
126+
AccountRedirect $accountRedirect
128127
) {
129128
$this->scopeConfig = $scopeConfig;
130129
$this->storeManager = $storeManager;
@@ -141,7 +140,13 @@ public function __construct(
141140
$this->customerExtractor = $customerExtractor;
142141
$this->urlModel = $urlFactory->create();
143142
$this->dataObjectHelper = $dataObjectHelper;
144-
parent::__construct($context, $customerSession, $resultRedirectFactory, $resultPageFactory);
143+
$this->accountRedirect = $accountRedirect;
144+
parent::__construct(
145+
$context,
146+
$customerSession,
147+
$resultRedirectFactory,
148+
$resultPageFactory
149+
);
145150
}
146151

147152
/**
@@ -257,9 +262,8 @@ public function execute()
257262
$resultRedirect->setUrl($this->_redirect->success($url));
258263
} else {
259264
$this->_getSession()->setCustomerDataAsLoggedIn($customer);
260-
261265
$this->messageManager->addSuccess($this->getSuccessMessage());
262-
$resultRedirect->setUrl($this->getSuccessRedirect());
266+
$resultRedirect = $this->accountRedirect->getRedirect();
263267
}
264268
return $resultRedirect;
265269
} catch (StateException $e) {
@@ -329,23 +333,4 @@ protected function getSuccessMessage()
329333
}
330334
return $message;
331335
}
332-
333-
/**
334-
* Retrieve success redirect URL
335-
*
336-
* @return string
337-
*/
338-
protected function getSuccessRedirect()
339-
{
340-
$redirectToDashboard = $this->scopeConfig->isSetFlag(
341-
Url::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD,
342-
ScopeInterface::SCOPE_STORE
343-
);
344-
if (!$redirectToDashboard && $this->_getSession()->getBeforeAuthUrl()) {
345-
$successUrl = $this->_getSession()->getBeforeAuthUrl(true);
346-
} else {
347-
$successUrl = $this->urlModel->getUrl('*/*/index', ['_secure' => true]);
348-
}
349-
return $this->_redirect->success($successUrl);
350-
}
351336
}

app/code/Magento/Customer/Controller/Account/EditPost.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public function execute()
8181
$customerId = $this->_getSession()->getCustomerId();
8282
$customer = $this->customerExtractor->extract('customer_account_edit', $this->_request);
8383
$customer->setId($customerId);
84+
if ($customer->getAddresses() == null) {
85+
$customer->setAddresses($this->customerRepository->getById($customerId)->getAddresses());
86+
}
8487

8588
if ($this->getRequest()->getParam('change_password')) {
8689
$currPass = $this->getRequest()->getPost('current_password');
Lines changed: 18 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
<?php
22
/**
3-
*
43
* Copyright © 2015 Magento. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Customer\Controller\Account;
87

8+
use Magento\Customer\Model\Account\Redirect as AccountRedirect;
99
use Magento\Framework\App\Action\Context;
1010
use Magento\Customer\Model\Session;
1111
use Magento\Framework\Controller\Result\RedirectFactory;
1212
use Magento\Framework\View\Result\PageFactory;
13-
use Magento\Framework\App\Config\ScopeConfigInterface;
14-
use Magento\Store\Model\StoreManagerInterface;
1513
use Magento\Customer\Api\AccountManagementInterface;
16-
use Magento\Framework\Url\DecoderInterface;
1714
use Magento\Customer\Model\Url as CustomerUrl;
1815
use Magento\Framework\Exception\EmailNotConfirmedException;
1916
use Magento\Framework\Exception\AuthenticationException;
@@ -24,35 +21,26 @@
2421
*/
2522
class LoginPost extends \Magento\Customer\Controller\Account
2623
{
27-
/** @var ScopeConfigInterface */
28-
protected $scopeConfig;
29-
30-
/** @var StoreManagerInterface */
31-
protected $storeManager;
32-
3324
/** @var AccountManagementInterface */
3425
protected $customerAccountManagement;
3526

36-
/** @var DecoderInterface */
37-
protected $urlDecoder;
38-
39-
/** @var CustomerUrl */
40-
protected $customerUrl;
41-
4227
/** @var Validator */
4328
protected $formKeyValidator;
4429

30+
/**
31+
* @var AccountRedirect
32+
*/
33+
private $accountRedirect;
34+
4535
/**
4636
* @param Context $context
4737
* @param Session $customerSession
4838
* @param RedirectFactory $resultRedirectFactory
4939
* @param PageFactory $resultPageFactory
50-
* @param ScopeConfigInterface $scopeConfig
51-
* @param StoreManagerInterface $storeManager
5240
* @param AccountManagementInterface $customerAccountManagement
53-
* @param DecoderInterface $urlDecoder
5441
* @param CustomerUrl $customerHelperData
55-
* @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator
42+
* @param Validator $formKeyValidator
43+
* @param AccountRedirect $accountRedirect
5644
*
5745
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
5846
*/
@@ -61,76 +49,21 @@ public function __construct(
6149
Session $customerSession,
6250
RedirectFactory $resultRedirectFactory,
6351
PageFactory $resultPageFactory,
64-
ScopeConfigInterface $scopeConfig,
65-
StoreManagerInterface $storeManager,
6652
AccountManagementInterface $customerAccountManagement,
67-
DecoderInterface $urlDecoder,
6853
CustomerUrl $customerHelperData,
69-
Validator $formKeyValidator
54+
Validator $formKeyValidator,
55+
AccountRedirect $accountRedirect
7056
) {
71-
$this->scopeConfig = $scopeConfig;
72-
$this->storeManager = $storeManager;
7357
$this->customerAccountManagement = $customerAccountManagement;
74-
$this->urlDecoder = $urlDecoder;
7558
$this->customerUrl = $customerHelperData;
7659
$this->formKeyValidator = $formKeyValidator;
77-
parent::__construct($context, $customerSession, $resultRedirectFactory, $resultPageFactory);
78-
}
79-
80-
/**
81-
* Define target URL and redirect customer after logging in
82-
*
83-
* @return \Magento\Framework\Controller\Result\Redirect
84-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
85-
*/
86-
protected function loginPostRedirect()
87-
{
88-
$lastCustomerId = $this->_getSession()->getLastCustomerId();
89-
if (isset(
90-
$lastCustomerId
91-
) && $this->_getSession()->isLoggedIn() && $lastCustomerId != $this->_getSession()->getId()
92-
) {
93-
$this->_getSession()->unsBeforeAuthUrl()->setLastCustomerId($this->_getSession()->getId());
94-
}
95-
if (!$this->_getSession()->getBeforeAuthUrl() ||
96-
$this->_getSession()->getBeforeAuthUrl() == $this->storeManager->getStore()->getBaseUrl()
97-
) {
98-
// Set default URL to redirect customer to
99-
$this->_getSession()->setBeforeAuthUrl($this->customerUrl->getAccountUrl());
100-
// Redirect customer to the last page visited after logging in
101-
if ($this->_getSession()->isLoggedIn()) {
102-
if (!$this->scopeConfig->isSetFlag(
103-
CustomerUrl::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD,
104-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
105-
)
106-
) {
107-
$referer = $this->getRequest()->getParam(CustomerUrl::REFERER_QUERY_PARAM_NAME);
108-
if ($referer) {
109-
$referer = $this->urlDecoder->decode($referer);
110-
if ($this->_url->isOwnOriginUrl()) {
111-
$this->_getSession()->setBeforeAuthUrl($referer);
112-
}
113-
}
114-
} elseif ($this->_getSession()->getAfterAuthUrl()) {
115-
$this->_getSession()->setBeforeAuthUrl($this->_getSession()->getAfterAuthUrl(true));
116-
}
117-
} else {
118-
$this->_getSession()->setBeforeAuthUrl($this->customerUrl->getLoginUrl());
119-
}
120-
} elseif ($this->_getSession()->getBeforeAuthUrl() == $this->customerUrl->getLogoutUrl()) {
121-
$this->_getSession()->setBeforeAuthUrl($this->customerUrl->getDashboardUrl());
122-
} else {
123-
if (!$this->_getSession()->getAfterAuthUrl()) {
124-
$this->_getSession()->setAfterAuthUrl($this->_getSession()->getBeforeAuthUrl());
125-
}
126-
if ($this->_getSession()->isLoggedIn()) {
127-
$this->_getSession()->setBeforeAuthUrl($this->_getSession()->getAfterAuthUrl(true));
128-
}
129-
}
130-
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
131-
$resultRedirect = $this->resultRedirectFactory->create();
132-
$resultRedirect->setUrl($this->_getSession()->getBeforeAuthUrl(true));
133-
return $resultRedirect;
60+
$this->accountRedirect = $accountRedirect;
61+
parent::__construct(
62+
$context,
63+
$customerSession,
64+
$resultRedirectFactory,
65+
$resultPageFactory
66+
);
13467
}
13568

13669
/**
@@ -177,6 +110,6 @@ public function execute()
177110
}
178111
}
179112

180-
return $this->loginPostRedirect();
113+
return $this->accountRedirect->getRedirect();
181114
}
182115
}

0 commit comments

Comments
 (0)