Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit aee7458

Browse files
Merge branch '2.3-develop' into forwardport-2.3-develop-magento-magento2-12133
2 parents 7f2dc29 + 221e2a4 commit aee7458

File tree

91 files changed

+1604
-378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1604
-378
lines changed

app/code/Magento/AdminNotification/Model/Feed.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,6 @@ public function getFeedData()
214214
);
215215
$curl->write(\Zend_Http_Client::GET, $this->getFeedUrl(), '1.0');
216216
$data = $curl->read();
217-
if ($data === false) {
218-
return false;
219-
}
220217
$data = preg_split('/^\r?$/m', $data, 2);
221218
$data = trim($data[1]);
222219
$curl->close();

app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function _prepareCollection()
9292
protected function _afterLoadCollection()
9393
{
9494
foreach ($this->getCollection() as $item) {
95-
$item->getCustomer() ?: $item->setCustomer('Guest');
95+
$item->getCustomer() ?: $item->setCustomer($item->getBillingAddress()->getName());
9696
}
9797
return $this;
9898
}

app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,7 @@ public function getAttributeRawValue($entityId, $attribute, $store)
571571
}
572572

573573
if (is_array($attributesData) && sizeof($attributesData) == 1) {
574-
$_data = each($attributesData);
575-
$attributesData = $_data[1];
574+
$attributesData = array_shift($attributesData);
576575
}
577576

578577
return $attributesData === false ? false : $attributesData;

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ define([
9797
success: function (res) {
9898
var eventData, parameters;
9999

100-
$(document).trigger('ajax:addToCart', form.data().productSku);
100+
$(document).trigger('ajax:addToCart', form.data().productSku, form, res);
101101

102102
if (self.isLoaderEnabled()) {
103103
$('body').trigger(self.options.processStop);

app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ public function prepareAttributesWithDefaultValueForSave(array $rowData, $withDe
534534
public function clearEmptyData(array $rowData)
535535
{
536536
foreach ($this->_getProductAttributes($rowData) as $attrCode => $attrParams) {
537-
if (!$attrParams['is_static'] && empty($rowData[$attrCode])) {
537+
if (!$attrParams['is_static'] && !isset($rowData[$attrCode])) {
538538
unset($rowData[$attrCode]);
539539
}
540540
}

app/code/Magento/Checkout/view/frontend/templates/cart/coupon.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<div class="field">
2525
<label for="coupon_code" class="label"><span><?= /* @escapeNotVerified */ __('Enter discount code') ?></span></label>
2626
<div class="control">
27-
<input type="text" class="input-text" id="coupon_code" name="coupon_code" value="<?= $block->escapeHtml($block->getCouponCode()) ?>" placeholder="<?= $block->escapeHtml(__('Enter discount code')) ?>" />
27+
<input type="text" class="input-text" id="coupon_code" name="coupon_code" value="<?= $block->escapeHtml($block->getCouponCode()) ?>" placeholder="<?= $block->escapeHtml(__('Enter discount code')) ?>" <?php if (strlen($block->getCouponCode())): ?> disabled="disabled" <?php endif; ?> />
2828
</div>
2929
</div>
3030
<div class="actions-toolbar">

app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier;
77

8+
use Magento\Catalog\Model\Product\Attribute\Backend\Sku;
89
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
910
use Magento\Ui\Component\Container;
1011
use Magento\Ui\Component\Form;
@@ -466,7 +467,17 @@ protected function getRows()
466467
[],
467468
['dataScope' => 'product_link']
468469
),
469-
'sku_container' => $this->getColumn('sku', __('SKU')),
470+
'sku_container' => $this->getColumn(
471+
'sku',
472+
__('SKU'),
473+
[
474+
'validation' =>
475+
[
476+
'required-entry' => true,
477+
'max_text_length' => Sku::SKU_MAX_LENGTH,
478+
]
479+
]
480+
),
470481
'price_container' => $this->getColumn(
471482
'price',
472483
__('Price'),

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
*/
77
namespace Magento\Customer\Controller\Account;
88

9+
use Magento\Customer\Model\Url;
910
use Magento\Framework\App\Action\Context;
1011
use Magento\Customer\Model\Session;
12+
use Magento\Framework\App\ObjectManager;
1113
use Magento\Framework\View\Result\PageFactory;
1214
use Magento\Store\Model\StoreManagerInterface;
1315
use Magento\Customer\Api\AccountManagementInterface;
@@ -35,24 +37,32 @@ class Confirmation extends \Magento\Customer\Controller\AbstractAccount
3537
*/
3638
protected $resultPageFactory;
3739

40+
/**
41+
* @var Url
42+
*/
43+
private $customerUrl;
44+
3845
/**
3946
* @param Context $context
4047
* @param Session $customerSession
4148
* @param PageFactory $resultPageFactory
4249
* @param StoreManagerInterface $storeManager
4350
* @param AccountManagementInterface $customerAccountManagement
51+
* @param Url $customerUrl
4452
*/
4553
public function __construct(
4654
Context $context,
4755
Session $customerSession,
4856
PageFactory $resultPageFactory,
4957
StoreManagerInterface $storeManager,
50-
AccountManagementInterface $customerAccountManagement
58+
AccountManagementInterface $customerAccountManagement,
59+
Url $customerUrl = null
5160
) {
5261
$this->session = $customerSession;
5362
$this->resultPageFactory = $resultPageFactory;
5463
$this->storeManager = $storeManager;
5564
$this->customerAccountManagement = $customerAccountManagement;
65+
$this->customerUrl = $customerUrl ?: ObjectManager::getInstance()->get(Url::class);
5666
parent::__construct($context);
5767
}
5868

@@ -98,6 +108,8 @@ public function execute()
98108
$resultPage = $this->resultPageFactory->create();
99109
$resultPage->getLayout()->getBlock('accountConfirmation')->setEmail(
100110
$this->getRequest()->getParam('email', $email)
111+
)->setLoginUrl(
112+
$this->customerUrl->getLoginUrl()
101113
);
102114
return $resultPage;
103115
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Customer\Model;
7+
8+
use Magento\Store\Model\ScopeInterface;
9+
use Magento\Framework\App\Config\ScopeConfigInterface;
10+
use Magento\Framework\Registry;
11+
12+
/**
13+
* Class AccountConfirmation.
14+
* Checks if email confirmation required for customer.
15+
*/
16+
class AccountConfirmation
17+
{
18+
/**
19+
* Configuration path for email confirmation.
20+
*/
21+
const XML_PATH_IS_CONFIRM = 'customer/create_account/confirm';
22+
23+
/**
24+
* @var ScopeConfigInterface
25+
*/
26+
private $scopeConfig;
27+
28+
/**
29+
* @var Registry
30+
*/
31+
private $registry;
32+
33+
/**
34+
* @param ScopeConfigInterface $scopeConfig
35+
* @param Registry $registry
36+
*/
37+
public function __construct(
38+
ScopeConfigInterface $scopeConfig,
39+
Registry $registry
40+
) {
41+
$this->scopeConfig = $scopeConfig;
42+
$this->registry = $registry;
43+
}
44+
45+
/**
46+
* Check if accounts confirmation is required.
47+
*
48+
* @param int|null $websiteId
49+
* @param int|null $customerId
50+
* @param string $customerEmail
51+
* @return bool
52+
*/
53+
public function isConfirmationRequired($websiteId, $customerId, $customerEmail): bool
54+
{
55+
if ($this->canSkipConfirmation($customerId, $customerEmail)) {
56+
return false;
57+
}
58+
59+
return (bool)$this->scopeConfig->getValue(
60+
self::XML_PATH_IS_CONFIRM,
61+
ScopeInterface::SCOPE_WEBSITES,
62+
$websiteId
63+
);
64+
}
65+
66+
/**
67+
* Check whether confirmation may be skipped when registering using certain email address.
68+
*
69+
* @param int|null $customerId
70+
* @param string $customerEmail
71+
* @return bool
72+
*/
73+
private function canSkipConfirmation($customerId, $customerEmail): bool
74+
{
75+
if (!$customerId) {
76+
return false;
77+
}
78+
79+
/* If an email was used to start the registration process and it is the same email as the one
80+
used to register, then this can skip confirmation.
81+
*/
82+
$skipConfirmationIfEmail = $this->registry->registry("skip_confirmation_if_email");
83+
if (!$skipConfirmationIfEmail) {
84+
return false;
85+
}
86+
87+
return strtolower($skipConfirmationIfEmail) === strtolower($customerEmail);
88+
}
89+
}

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ class AccountManagement implements AccountManagementInterface
8989
*/
9090
const XML_PATH_FORGOT_EMAIL_IDENTITY = 'customer/password/forgot_email_identity';
9191

92+
/**
93+
* @deprecated
94+
* @see AccountConfirmation::XML_PATH_IS_CONFIRM
95+
*/
9296
const XML_PATH_IS_CONFIRM = 'customer/create_account/confirm';
9397

9498
/**
@@ -298,6 +302,11 @@ class AccountManagement implements AccountManagementInterface
298302
*/
299303
private $dateTimeFactory;
300304

305+
/**
306+
* @var AccountConfirmation
307+
*/
308+
private $accountConfirmation;
309+
301310
/**
302311
* @param CustomerFactory $customerFactory
303312
* @param ManagerInterface $eventManager
@@ -323,7 +332,8 @@ class AccountManagement implements AccountManagementInterface
323332
* @param ObjectFactory $objectFactory
324333
* @param ExtensibleDataObjectConverter $extensibleDataObjectConverter
325334
* @param CredentialsValidator|null $credentialsValidator
326-
* @param DateTimeFactory $dateTimeFactory
335+
* @param DateTimeFactory|null $dateTimeFactory
336+
* @param AccountConfirmation|null $accountConfirmation
327337
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
328338
*/
329339
public function __construct(
@@ -351,7 +361,8 @@ public function __construct(
351361
ObjectFactory $objectFactory,
352362
ExtensibleDataObjectConverter $extensibleDataObjectConverter,
353363
CredentialsValidator $credentialsValidator = null,
354-
DateTimeFactory $dateTimeFactory = null
364+
DateTimeFactory $dateTimeFactory = null,
365+
AccountConfirmation $accountConfirmation = null
355366
) {
356367
$this->customerFactory = $customerFactory;
357368
$this->eventManager = $eventManager;
@@ -379,6 +390,8 @@ public function __construct(
379390
$this->credentialsValidator =
380391
$credentialsValidator ?: ObjectManager::getInstance()->get(CredentialsValidator::class);
381392
$this->dateTimeFactory = $dateTimeFactory ?: ObjectManager::getInstance()->get(DateTimeFactory::class);
393+
$this->accountConfirmation = $accountConfirmation ?: ObjectManager::getInstance()
394+
->get(AccountConfirmation::class);
382395
}
383396

384397
/**
@@ -1161,17 +1174,15 @@ protected function sendEmailTemplate(
11611174
*
11621175
* @param CustomerInterface $customer
11631176
* @return bool
1177+
* @deprecated
1178+
* @see AccountConfirmation::isConfirmationRequired
11641179
*/
11651180
protected function isConfirmationRequired($customer)
11661181
{
1167-
if ($this->canSkipConfirmation($customer)) {
1168-
return false;
1169-
}
1170-
1171-
return (bool)$this->scopeConfig->getValue(
1172-
self::XML_PATH_IS_CONFIRM,
1173-
ScopeInterface::SCOPE_WEBSITES,
1174-
$customer->getWebsiteId()
1182+
return $this->accountConfirmation->isConfirmationRequired(
1183+
$customer->getWebsiteId(),
1184+
$customer->getId(),
1185+
$customer->getEmail()
11751186
);
11761187
}
11771188

@@ -1180,6 +1191,8 @@ protected function isConfirmationRequired($customer)
11801191
*
11811192
* @param CustomerInterface $customer
11821193
* @return bool
1194+
* @deprecated
1195+
* @see AccountConfirmation::isConfirmationRequired
11831196
*/
11841197
protected function canSkipConfirmation($customer)
11851198
{

0 commit comments

Comments
 (0)