Skip to content

Commit fe44f8f

Browse files
committed
Merge branch '2.2-develop' of github.com:magento/magento2 into MAGETWO-70954
2 parents c5b2a0f + 73c7ac2 commit fe44f8f

File tree

62 files changed

+694
-222
lines changed

Some content is hidden

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

62 files changed

+694
-222
lines changed

.htaccess

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
############################################
3737
## adjust memory limit
3838

39-
php_value memory_limit 768M
39+
php_value memory_limit 756M
4040
php_value max_execution_time 18000
4141

4242
############################################
@@ -59,7 +59,7 @@
5959
############################################
6060
## adjust memory limit
6161

62-
php_value memory_limit 768M
62+
php_value memory_limit 756M
6363
php_value max_execution_time 18000
6464

6565
############################################

.htaccess.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
############################################
3636
## adjust memory limit
3737

38-
php_value memory_limit 768M
38+
php_value memory_limit 756M
3939
php_value max_execution_time 18000
4040

4141
############################################

.user.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
memory_limit = 768M
1+
memory_limit = 756M
22
max_execution_time = 18000
33
session.auto_start = off
44
suhosin.session.cryptua = off

app/code/Magento/Backend/Block/Dashboard/Graph.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ public function getChartUrl($directUrl = true)
421421
$tmpstring = implode('|', $this->_axisLabels[$idx]);
422422

423423
$valueBuffer[] = $indexid . ":|" . $tmpstring;
424+
} elseif ($idx == 'y') {
425+
$valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
424426
}
425427
$indexid++;
426428
}

app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function save(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet)
6262
*/
6363
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
6464
{
65+
$this->searchCriteriaBuilder->setFilterGroups((array)$searchCriteria->getFilterGroups());
6566
$this->searchCriteriaBuilder->addFilters(
6667
[
6768
$this->filterBuilder
@@ -71,9 +72,15 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
7172
->create(),
7273
]
7374
);
75+
76+
$this->searchCriteriaBuilder->setSortOrders((array)$searchCriteria->getSortOrders());
7477
$this->searchCriteriaBuilder->setCurrentPage($searchCriteria->getCurrentPage());
7578
$this->searchCriteriaBuilder->setPageSize($searchCriteria->getPageSize());
76-
return $this->attributeSetRepository->getList($this->searchCriteriaBuilder->create());
79+
80+
$searchResult = $this->attributeSetRepository->getList($this->searchCriteriaBuilder->create());
81+
$searchResult->setSearchCriteria($searchCriteria);
82+
83+
return $searchResult;
7784
}
7885

7986
/**

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ private function cacheProduct($cacheKey, \Magento\Catalog\Api\Data\ProductInterf
312312
if ($this->cacheLimit && count($this->instances) > $this->cacheLimit) {
313313
$offset = round($this->cacheLimit / -2);
314314
$this->instancesById = array_slice($this->instancesById, $offset, null, true);
315-
$this->instances = array_slice($this->instances, $offset);
315+
$this->instances = array_slice($this->instances, $offset, null, true);
316316
}
317317
}
318318

app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ switch ($type = $block->getType()) {
203203
<?= $block->getReviewsSummaryHtml($_item, $templateType) ?>
204204
<?php endif; ?>
205205

206-
<?php if (!$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?>
206+
<?php if ($canItemsAddToCart && !$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?>
207207
<?php if (!$_item->getRequiredOptions()): ?>
208208
<div class="field choice related">
209209
<input type="checkbox" class="checkbox related" id="related-checkbox<?= /* @escapeNotVerified */ $_item->getId() ?>" name="related_products[]" value="<?= /* @escapeNotVerified */ $_item->getId() ?>" />

app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,19 @@ protected function getFieldConfig(
168168

169169
$element = [
170170
'component' => isset($additionalConfig['component']) ? $additionalConfig['component'] : $uiComponent,
171-
'config' => [
172-
// customScope is used to group elements within a single form (e.g. they can be validated separately)
173-
'customScope' => $dataScopePrefix,
174-
'customEntry' => isset($additionalConfig['config']['customEntry'])
175-
? $additionalConfig['config']['customEntry']
176-
: null,
177-
'template' => 'ui/form/field',
178-
'elementTmpl' => isset($additionalConfig['config']['elementTmpl'])
179-
? $additionalConfig['config']['elementTmpl']
180-
: $elementTemplate,
181-
'tooltip' => isset($additionalConfig['config']['tooltip'])
182-
? $additionalConfig['config']['tooltip']
183-
: null
184-
],
171+
'config' => $this->mergeConfigurationNode(
172+
'config',
173+
$additionalConfig,
174+
[
175+
'config' => [
176+
// customScope is used to group elements within a single
177+
// form (e.g. they can be validated separately)
178+
'customScope' => $dataScopePrefix,
179+
'template' => 'ui/form/field',
180+
'elementTmpl' => $elementTemplate,
181+
],
182+
]
183+
),
185184
'dataScope' => $dataScopePrefix . '.' . $attributeCode,
186185
'label' => $attributeConfig['label'],
187186
'provider' => $providerName,

app/code/Magento/Checkout/view/frontend/web/js/model/resource-url-manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ define([
7575
quoteId: quoteId
7676
} : {},
7777
urls = {
78-
'guest': '/guest-carts/' + quoteId + '/coupons/' + couponCode,
79-
'customer': '/carts/mine/coupons/' + couponCode
78+
'guest': '/guest-carts/' + quoteId + '/coupons/' + encodeURIComponent(couponCode),
79+
'customer': '/carts/mine/coupons/' + encodeURIComponent(couponCode)
8080
};
8181

8282
return this.getUrl(urls, params);

app/code/Magento/Customer/Block/Widget/Dob.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ public function getFieldHtml()
186186
'max_date' => '-1d',
187187
'change_month' => 'true',
188188
'change_year' => 'true',
189-
'show_on' => 'both'
189+
'show_on' => 'both',
190+
'first_day' => $this->getFirstDay()
190191
]);
191192
return $this->dateElement->getHtml();
192193
}
@@ -307,4 +308,17 @@ public function getMaxDateRange()
307308
}
308309
return null;
309310
}
311+
312+
/**
313+
* Return first day of the week
314+
*
315+
* @return int
316+
*/
317+
public function getFirstDay()
318+
{
319+
return (int)$this->_scopeConfig->getValue(
320+
'general/locale/firstday',
321+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
322+
);
323+
}
310324
}

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

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@
1212
use Magento\Customer\Api\Data\AddressInterface;
1313
use Magento\Customer\Api\Data\CustomerInterface;
1414
use Magento\Customer\Api\Data\ValidationResultsInterfaceFactory;
15-
use Magento\Customer\Model\EmailNotificationInterface;
1615
use Magento\Customer\Helper\View as CustomerViewHelper;
1716
use Magento\Customer\Model\Config\Share as ConfigShare;
1817
use Magento\Customer\Model\Customer as CustomerModel;
18+
use Magento\Customer\Model\Customer\CredentialsValidator;
1919
use Magento\Customer\Model\Metadata\Validator;
2020
use Magento\Eav\Model\Validator\Attribute\Backend;
2121
use Magento\Framework\Api\ExtensibleDataObjectConverter;
2222
use Magento\Framework\App\Area;
2323
use Magento\Framework\App\Config\ScopeConfigInterface;
2424
use Magento\Framework\App\ObjectManager;
25+
use Magento\Framework\DataObjectFactory as ObjectFactory;
2526
use Magento\Framework\Encryption\EncryptorInterface as Encryptor;
2627
use Magento\Framework\Encryption\Helper\Security;
2728
use Magento\Framework\Event\ManagerInterface;
@@ -30,23 +31,22 @@
3031
use Magento\Framework\Exception\InputException;
3132
use Magento\Framework\Exception\InvalidEmailOrPasswordException;
3233
use Magento\Framework\Exception\LocalizedException;
34+
use Magento\Framework\Exception\MailException;
3335
use Magento\Framework\Exception\NoSuchEntityException;
3436
use Magento\Framework\Exception\State\ExpiredException;
3537
use Magento\Framework\Exception\State\InputMismatchException;
3638
use Magento\Framework\Exception\State\InvalidTransitionException;
37-
use Magento\Framework\DataObjectFactory as ObjectFactory;
3839
use Magento\Framework\Exception\State\UserLockedException;
39-
use Magento\Framework\Registry;
40-
use Magento\Store\Model\ScopeInterface;
41-
use Psr\Log\LoggerInterface as PsrLogger;
42-
use Magento\Framework\Exception\MailException;
40+
use Magento\Framework\Intl\DateTimeFactory;
4341
use Magento\Framework\Mail\Template\TransportBuilder;
4442
use Magento\Framework\Math\Random;
4543
use Magento\Framework\Reflection\DataObjectProcessor;
44+
use Magento\Framework\Registry;
4645
use Magento\Framework\Stdlib\DateTime;
4746
use Magento\Framework\Stdlib\StringUtils as StringHelper;
47+
use Magento\Store\Model\ScopeInterface;
4848
use Magento\Store\Model\StoreManagerInterface;
49-
use Magento\Customer\Model\Customer\CredentialsValidator;
49+
use Psr\Log\LoggerInterface as PsrLogger;
5050

5151
/**
5252
* Handle various customer account actions
@@ -293,6 +293,11 @@ class AccountManagement implements AccountManagementInterface
293293
*/
294294
private $credentialsValidator;
295295

296+
/**
297+
* @var DateTimeFactory
298+
*/
299+
private $dateTimeFactory;
300+
296301
/**
297302
* @param CustomerFactory $customerFactory
298303
* @param ManagerInterface $eventManager
@@ -318,6 +323,7 @@ class AccountManagement implements AccountManagementInterface
318323
* @param ObjectFactory $objectFactory
319324
* @param ExtensibleDataObjectConverter $extensibleDataObjectConverter
320325
* @param CredentialsValidator|null $credentialsValidator
326+
* @param DateTimeFactory $dateTimeFactory
321327
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
322328
*/
323329
public function __construct(
@@ -344,7 +350,8 @@ public function __construct(
344350
CustomerModel $customerModel,
345351
ObjectFactory $objectFactory,
346352
ExtensibleDataObjectConverter $extensibleDataObjectConverter,
347-
CredentialsValidator $credentialsValidator = null
353+
CredentialsValidator $credentialsValidator = null,
354+
DateTimeFactory $dateTimeFactory = null
348355
) {
349356
$this->customerFactory = $customerFactory;
350357
$this->eventManager = $eventManager;
@@ -369,8 +376,9 @@ public function __construct(
369376
$this->customerModel = $customerModel;
370377
$this->objectFactory = $objectFactory;
371378
$this->extensibleDataObjectConverter = $extensibleDataObjectConverter;
372-
$this->credentialsValidator = $credentialsValidator ?: ObjectManager::getInstance()
373-
->get(CredentialsValidator::class);
379+
$this->credentialsValidator =
380+
$credentialsValidator ?: ObjectManager::getInstance()->get(CredentialsValidator::class);
381+
$this->dateTimeFactory = $dateTimeFactory ?: ObjectManager::getInstance()->get(DateTimeFactory::class);
374382
}
375383

376384
/**
@@ -380,7 +388,6 @@ public function __construct(
380388
*/
381389
private function getAuthentication()
382390
{
383-
384391
if (!($this->authentication instanceof AuthenticationInterface)) {
385392
return \Magento\Framework\App\ObjectManager::getInstance()->get(
386393
\Magento\Customer\Model\AuthenticationInterface::class
@@ -613,16 +620,16 @@ protected function makeRequiredCharactersCheck($password)
613620
$return = 0;
614621

615622
if (preg_match('/[0-9]+/', $password)) {
616-
$counter ++;
623+
$counter++;
617624
}
618625
if (preg_match('/[A-Z]+/', $password)) {
619-
$counter ++;
626+
$counter++;
620627
}
621628
if (preg_match('/[a-z]+/', $password)) {
622-
$counter ++;
629+
$counter++;
623630
}
624631
if (preg_match('/[^a-zA-Z0-9]+/', $password)) {
625-
$counter ++;
632+
$counter++;
626633
}
627634

628635
if ($counter < $requiredNumber) {
@@ -890,16 +897,14 @@ public function validate(CustomerInterface $customer)
890897

891898
$result = $this->getEavValidator()->isValid($customerModel);
892899
if ($result === false && is_array($this->getEavValidator()->getMessages())) {
893-
return $validationResults->setIsValid(false)
894-
->setMessages(
895-
call_user_func_array(
896-
'array_merge',
897-
$this->getEavValidator()->getMessages()
898-
)
899-
);
900+
return $validationResults->setIsValid(false)->setMessages(
901+
call_user_func_array(
902+
'array_merge',
903+
$this->getEavValidator()->getMessages()
904+
)
905+
);
900906
}
901-
return $validationResults->setIsValid(true)
902-
->setMessages([]);
907+
return $validationResults->setIsValid(true)->setMessages([]);
903908
}
904909

905910
/**
@@ -949,10 +954,12 @@ public function isCustomerInStore($customerWebsiteId, $storeId)
949954
private function validateResetPasswordToken($customerId, $resetPasswordLinkToken)
950955
{
951956
if (empty($customerId) || $customerId < 0) {
952-
throw new InputException(__(
953-
'Invalid value of "%value" provided for the %fieldName field.',
954-
['value' => $customerId, 'fieldName' => 'customerId']
955-
));
957+
throw new InputException(
958+
__(
959+
'Invalid value of "%value" provided for the %fieldName field.',
960+
['value' => $customerId, 'fieldName' => 'customerId']
961+
)
962+
);
956963
}
957964
if (!is_string($resetPasswordLinkToken) || empty($resetPasswordLinkToken)) {
958965
$params = ['fieldName' => 'resetPasswordLinkToken'];
@@ -1076,10 +1083,10 @@ protected function getTemplateTypes()
10761083
* self::NEW_ACCOUNT_EMAIL_CONFIRMATION email with confirmation link
10771084
*/
10781085
$types = [
1079-
self::NEW_ACCOUNT_EMAIL_REGISTERED => self::XML_PATH_REGISTER_EMAIL_TEMPLATE,
1086+
self::NEW_ACCOUNT_EMAIL_REGISTERED => self::XML_PATH_REGISTER_EMAIL_TEMPLATE,
10801087
self::NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD => self::XML_PATH_REGISTER_NO_PASSWORD_EMAIL_TEMPLATE,
1081-
self::NEW_ACCOUNT_EMAIL_CONFIRMED => self::XML_PATH_CONFIRMED_EMAIL_TEMPLATE,
1082-
self::NEW_ACCOUNT_EMAIL_CONFIRMATION => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE,
1088+
self::NEW_ACCOUNT_EMAIL_CONFIRMED => self::XML_PATH_CONFIRMED_EMAIL_TEMPLATE,
1089+
self::NEW_ACCOUNT_EMAIL_CONFIRMATION => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE,
10831090
];
10841091
return $types;
10851092
}
@@ -1109,12 +1116,11 @@ protected function sendEmailTemplate(
11091116
$email = $customer->getEmail();
11101117
}
11111118

1112-
$transport = $this->transportBuilder->setTemplateIdentifier($templateId)
1113-
->setTemplateOptions(['area' => Area::AREA_FRONTEND, 'store' => $storeId])
1114-
->setTemplateVars($templateParams)
1115-
->setFrom($this->scopeConfig->getValue($sender, ScopeInterface::SCOPE_STORE, $storeId))
1116-
->addTo($email, $this->customerViewHelper->getCustomerName($customer))
1117-
->getTransport();
1119+
$transport = $this->transportBuilder->setTemplateIdentifier($templateId)->setTemplateOptions(
1120+
['area' => Area::AREA_FRONTEND, 'store' => $storeId]
1121+
)->setTemplateVars($templateParams)->setFrom(
1122+
$this->scopeConfig->getValue($sender, ScopeInterface::SCOPE_STORE, $storeId)
1123+
)->addTo($email, $this->customerViewHelper->getCustomerName($customer))->getTransport();
11181124

11191125
$transport->sendMessage();
11201126

@@ -1178,8 +1184,8 @@ public function isResetPasswordLinkTokenExpired($rpToken, $rpTokenCreatedAt)
11781184

11791185
$expirationPeriod = $this->customerModel->getResetPasswordLinkExpirationPeriod();
11801186

1181-
$currentTimestamp = (new \DateTime())->getTimestamp();
1182-
$tokenTimestamp = (new \DateTime($rpTokenCreatedAt))->getTimestamp();
1187+
$currentTimestamp = $this->dateTimeFactory->create()->getTimestamp();
1188+
$tokenTimestamp = $this->dateTimeFactory->create($rpTokenCreatedAt)->getTimestamp();
11831189
if ($tokenTimestamp > $currentTimestamp) {
11841190
return true;
11851191
}
@@ -1215,7 +1221,9 @@ public function changeResetPasswordLinkToken($customer, $passwordLinkToken)
12151221
if (is_string($passwordLinkToken) && !empty($passwordLinkToken)) {
12161222
$customerSecure = $this->customerRegistry->retrieveSecureData($customer->getId());
12171223
$customerSecure->setRpToken($passwordLinkToken);
1218-
$customerSecure->setRpTokenCreatedAt((new \DateTime())->format(DateTime::DATETIME_PHP_FORMAT));
1224+
$customerSecure->setRpTokenCreatedAt(
1225+
$this->dateTimeFactory->create()->format(DateTime::DATETIME_PHP_FORMAT)
1226+
);
12191227
$this->customerRepository->save($customer);
12201228
}
12211229
return true;
@@ -1304,8 +1312,8 @@ protected function getFullCustomerObject($customer)
13041312
// No need to flatten the custom attributes or nested objects since the only usage is for email templates and
13051313
// object passed for events
13061314
$mergedCustomerData = $this->customerRegistry->retrieveSecureData($customer->getId());
1307-
$customerData = $this->dataProcessor
1308-
->buildOutputDataArray($customer, \Magento\Customer\Api\Data\CustomerInterface::class);
1315+
$customerData =
1316+
$this->dataProcessor->buildOutputDataArray($customer, \Magento\Customer\Api\Data\CustomerInterface::class);
13091317
$mergedCustomerData->addData($customerData);
13101318
$mergedCustomerData->setData('name', $this->customerViewHelper->getCustomerName($customer));
13111319
return $mergedCustomerData;

app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa
246246
$savedCustomer = $this->get($customer->getEmail(), $customer->getWebsiteId());
247247
$this->eventManager->dispatch(
248248
'customer_save_after_data_object',
249-
['customer_data_object' => $savedCustomer, 'orig_customer_data_object' => $customer]
249+
['customer_data_object' => $savedCustomer, 'orig_customer_data_object' => $prevCustomerData]
250250
);
251251
return $savedCustomer;
252252
}

0 commit comments

Comments
 (0)