Skip to content

Commit 9e5f7c4

Browse files
author
Oleksii Korshenko
authored
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #12105: #11936:required attribute set id filter on attribute group repository getList (by @tzyganu) - #12751: #12439 Newsletter subscription success email not sent… (by @Styopchik) - #12737: #11953: Product configuration creator does not warn about invalid SKUs (by @zamoroka) - magento-engcom/magento2ce#1016: #11743: [GitHub] AbstractPdf - ZendException font is not set (by @serhii-balko) - #12636: #12625: Add Current Date to update_time Field for Block and Pages (by @osrecio) - #11686: Fix error when generating urn catalog for empty misc.xml (by @tdgroot) - #11878: [BUGFIX] Made method public so a plugin is possible. (by @dheesbeen) - #11462: #7241: Always add empty option for prefix and/or suffix if optional (by @avstudnitz) Fixed GitHub Issues: - #11936: required attribute set id filter on attribute group repository getList (reported by @tzyganu) has been fixed in #12105 by @tzyganu in 2.2-develop branch Related commits: 1. 433c3cd 2. 7be92a8 - #12439: Newsletter subscription success email not sent after confirmation (reported by @nfourteen) has been fixed in #12751 by @Styopchik in 2.2-develop branch Related commits: 1. c4e4168 - #11953: Product configuration creator does not warn about invalid SKUs (reported by @JanisE) has been fixed in #12737 by @zamoroka in 2.2-develop branch Related commits: 1. 5cf0d34 2. 7418f1a - #11743: AbstractPdf - ZendException font is not set (reported by @jchenevey) has been fixed in magento-engcom/magento2ce#1016 by @serhii-balko in 2.2-develop branch Related commits: 1. 2629726 2. b326714 3. 5f4363b 4. 9ce4730 - #12625: when saving a page in magento 2.2.1, 'Modified' date field is not getting updated (reported by @mahmood537) has been fixed in #12636 by @osrecio in 2.2-develop branch Related commits: 1. 22f454d - #5188: Error generating URN-catalog when blank one exists (reported by @JamesonNetworks) has been fixed in #11686 by @tdgroot in 2.2-develop branch Related commits: 1. 177e540 2. 0d65213 3. a781bf6 4. dcc480d 5. 5d4e1c2 6. b552dd1 7. b85b91e - #7241: No option to start with blank option for prefix and suffix in checkout. (reported by @spyrule) has been fixed in #11462 by @avstudnitz in 2.2-develop branch Related commits: 1. 11e38f6 2. 7800e5d 3. 252529f 4. 519b805 5. eb79b38 6. fce3afe 7. 3e38118
2 parents 55a912a + fd567bc commit 9e5f7c4

File tree

29 files changed

+687
-221
lines changed

29 files changed

+687
-221
lines changed

app/code/Magento/Cms/Model/Block.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace Magento\Cms\Model;
77

88
use Magento\Cms\Api\Data\BlockInterface;
9-
use Magento\Cms\Model\ResourceModel\Block as ResourceCmsBlock;
109
use Magento\Framework\DataObject\IdentityInterface;
1110
use Magento\Framework\Model\AbstractModel;
1211

@@ -58,6 +57,11 @@ protected function _construct()
5857
public function beforeSave()
5958
{
6059
$needle = 'block_id="' . $this->getId() . '"';
60+
61+
if ($this->hasDataChanges()) {
62+
$this->setUpdateTime(null);
63+
}
64+
6165
if (false == strstr($this->getContent(), $needle)) {
6266
return parent::beforeSave();
6367
}

app/code/Magento/Cms/Model/Page.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
namespace Magento\Cms\Model;
77

88
use Magento\Cms\Api\Data\PageInterface;
9-
use Magento\Cms\Model\ResourceModel\Page as ResourceCmsPage;
9+
use Magento\Cms\Helper\Page as PageHelper;
1010
use Magento\Framework\App\Config\ScopeConfigInterface;
1111
use Magento\Framework\DataObject\IdentityInterface;
1212
use Magento\Framework\Exception\LocalizedException;
1313
use Magento\Framework\Model\AbstractModel;
14-
use Magento\Cms\Helper\Page as PageHelper;
1514

1615
/**
1716
* Cms Page Model
@@ -547,6 +546,10 @@ public function beforeSave()
547546
$originalIdentifier = $this->getOrigData('identifier');
548547
$currentIdentifier = $this->getIdentifier();
549548

549+
if ($this->hasDataChanges()) {
550+
$this->setUpdateTime(null);
551+
}
552+
550553
if (!$this->getId() || $originalIdentifier === $currentIdentifier) {
551554
return parent::beforeSave();
552555
}

app/code/Magento/Cms/Model/ResourceModel/Block.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
use Magento\Cms\Api\Data\BlockInterface;
99
use Magento\Framework\DB\Select;
10+
use Magento\Framework\EntityManager\EntityManager;
11+
use Magento\Framework\EntityManager\MetadataPool;
1012
use Magento\Framework\Exception\LocalizedException;
1113
use Magento\Framework\Model\AbstractModel;
12-
use Magento\Framework\EntityManager\MetadataPool;
13-
use Magento\Framework\EntityManager\EntityManager;
1414
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
1515
use Magento\Framework\Model\ResourceModel\Db\Context;
1616
use Magento\Store\Model\Store;

app/code/Magento/Cms/Model/ResourceModel/Page.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77
namespace Magento\Cms\Model\ResourceModel;
88

9+
use Magento\Cms\Api\Data\PageInterface;
910
use Magento\Cms\Model\Page as CmsPage;
1011
use Magento\Framework\DB\Select;
12+
use Magento\Framework\EntityManager\EntityManager;
13+
use Magento\Framework\EntityManager\MetadataPool;
1114
use Magento\Framework\Exception\LocalizedException;
1215
use Magento\Framework\Model\AbstractModel;
13-
use Magento\Framework\EntityManager\MetadataPool;
1416
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
1517
use Magento\Framework\Model\ResourceModel\Db\Context;
1618
use Magento\Framework\Stdlib\DateTime;
1719
use Magento\Store\Model\Store;
1820
use Magento\Store\Model\StoreManagerInterface;
19-
use Magento\Framework\EntityManager\EntityManager;
20-
use Magento\Cms\Api\Data\PageInterface;
2121

2222
/**
2323
* Cms page mysql resource

app/code/Magento/Config/Model/Config/Source/Nooptreq.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@
1111
*/
1212
class Nooptreq implements \Magento\Framework\Option\ArrayInterface
1313
{
14+
const VALUE_NO = '';
15+
const VALUE_OPTIONAL = 'opt';
16+
const VALUE_REQUIRED = 'req';
17+
1418
/**
1519
* @return array
1620
*/
1721
public function toOptionArray()
1822
{
1923
return [
20-
['value' => '', 'label' => __('No')],
21-
['value' => 'opt', 'label' => __('Optional')],
22-
['value' => 'req', 'label' => __('Required')]
24+
['value' => self::VALUE_NO, 'label' => __('No')],
25+
['value' => self::VALUE_OPTIONAL, 'label' => __('Optional')],
26+
['value' => self::VALUE_REQUIRED, 'label' => __('Required')]
2327
];
2428
}
2529
}

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/Block/Widget/Name.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,11 @@ public function getPrefixOptions()
106106
$prefixOptions = $this->options->getNamePrefixOptions();
107107

108108
if ($this->getObject() && !empty($prefixOptions)) {
109-
$oldPrefix = $this->escapeHtml(trim($this->getObject()->getPrefix()));
110-
$prefixOptions[$oldPrefix] = $oldPrefix;
109+
$prefixOption = $this->getObject()->getPrefix();
110+
$oldPrefix = $this->escapeHtml(trim($prefixOption));
111+
if ($prefixOption !== null && !isset($prefixOptions[$oldPrefix]) && !isset($prefixOptions[$prefixOption])) {
112+
$prefixOptions[$oldPrefix] = $oldPrefix;
113+
}
111114
}
112115
return $prefixOptions;
113116
}
@@ -161,8 +164,11 @@ public function getSuffixOptions()
161164
{
162165
$suffixOptions = $this->options->getNameSuffixOptions();
163166
if ($this->getObject() && !empty($suffixOptions)) {
164-
$oldSuffix = $this->escapeHtml(trim($this->getObject()->getSuffix()));
165-
$suffixOptions[$oldSuffix] = $oldSuffix;
167+
$suffixOption = $this->getObject()->getSuffix();
168+
$oldSuffix = $this->escapeHtml(trim($suffixOption));
169+
if ($suffixOption !== null && !isset($suffixOptions[$oldSuffix]) && !isset($suffixOptions[$suffixOption])) {
170+
$suffixOptions[$oldSuffix] = $oldSuffix;
171+
}
166172
}
167173
return $suffixOptions;
168174
}
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
/**
@@ -1149,17 +1162,15 @@ protected function sendEmailTemplate(
11491162
*
11501163
* @param CustomerInterface $customer
11511164
* @return bool
1165+
* @deprecated
1166+
* @see AccountConfirmation::isConfirmationRequired
11521167
*/
11531168
protected function isConfirmationRequired($customer)
11541169
{
1155-
if ($this->canSkipConfirmation($customer)) {
1156-
return false;
1157-
}
1158-
1159-
return (bool)$this->scopeConfig->getValue(
1160-
self::XML_PATH_IS_CONFIRM,
1161-
ScopeInterface::SCOPE_WEBSITES,
1162-
$customer->getWebsiteId()
1170+
return $this->accountConfirmation->isConfirmationRequired(
1171+
$customer->getWebsiteId(),
1172+
$customer->getId(),
1173+
$customer->getEmail()
11631174
);
11641175
}
11651176

@@ -1168,6 +1179,8 @@ protected function isConfirmationRequired($customer)
11681179
*
11691180
* @param CustomerInterface $customer
11701181
* @return bool
1182+
* @deprecated
1183+
* @see AccountConfirmation::isConfirmationRequired
11711184
*/
11721185
protected function canSkipConfirmation($customer)
11731186
{

0 commit comments

Comments
 (0)