Skip to content

Commit 5ab5d6e

Browse files
author
Yu Tang
committed
Merge remote-tracking branch 'mainline/develop' into FearlessKiwis-develop-no-refactoring
2 parents b3695fb + abb8d3b commit 5ab5d6e

File tree

19 files changed

+298
-56
lines changed

19 files changed

+298
-56
lines changed

app/code/Magento/Braintree/Model/PaymentMethod.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,8 +920,8 @@ protected function processSuccessResult(
920920
*/
921921
public function canVoid()
922922
{
923-
if (($order = $this->_registry->registry('current_order'))
924-
&& $order->getId() && $order->hasInvoices() ) {
923+
if ((($order = $this->_registry->registry('current_order'))
924+
&& $order->getId() && $order->hasInvoices()) || $this->_registry->registry('current_invoice')) {
925925
return false;
926926
}
927927
return $this->_canVoid;

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,9 +2223,14 @@ private function _parseAdditionalAttributes($rowData)
22232223

22242224
$attributeNameValuePairs = explode($this->getMultipleValueSeparator(), $rowData['additional_attributes']);
22252225
foreach ($attributeNameValuePairs as $attributeNameValuePair) {
2226-
$nameAndValue = explode(self::PAIR_NAME_VALUE_SEPARATOR, $attributeNameValuePair);
2227-
if (!empty($nameAndValue)) {
2228-
$rowData[$nameAndValue[0]] = isset($nameAndValue[1]) ? $nameAndValue[1] : '';
2226+
$separatorPosition = strpos($attributeNameValuePair, self::PAIR_NAME_VALUE_SEPARATOR);
2227+
if ($separatorPosition !== false) {
2228+
$key = substr($attributeNameValuePair, 0, $separatorPosition);
2229+
$value = substr(
2230+
$attributeNameValuePair,
2231+
$separatorPosition + strlen(self::PAIR_NAME_VALUE_SEPARATOR)
2232+
);
2233+
$rowData[$key] = $value === false ? '' : $value;
22292234
}
22302235
}
22312236
return $rowData;

app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandler.php

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ class ConfigurableProductHandler
2020
/** @var ConfigurableProductsProvider */
2121
private $configurableProductsProvider;
2222

23-
/** @var array */
24-
private $subProductsValidationResults = [];
25-
2623
/**
2724
* @param \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable $configurable
2825
* @param ConfigurableProductsProvider $configurableProductsProvider
@@ -39,45 +36,24 @@ public function __construct(
3936
* @param \Magento\CatalogRule\Model\Rule $rule
4037
* @param array $productIds
4138
* @return array
39+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4240
*/
4341
public function afterGetMatchingProductIds(\Magento\CatalogRule\Model\Rule $rule, array $productIds)
4442
{
4543
$configurableProductIds = $this->configurableProductsProvider->getIds(array_keys($productIds));
4644
foreach ($configurableProductIds as $productId) {
47-
$subProductsIds = $this->configurable->getChildrenIds($productId)[0];
48-
$parentValidationResult = $productIds[$productId];
49-
foreach ($subProductsIds as $subProductsId) {
50-
$productIds[$subProductsId] = $this->getSubProductValidationResult(
51-
$rule->getId(),
52-
$subProductsId,
53-
$parentValidationResult
54-
);
45+
$subProductIds = $this->configurable->getChildrenIds($productId)[0];
46+
$parentValidationResult = isset($productIds[$productId])
47+
? array_filter($productIds[$productId])
48+
: [];
49+
foreach ($subProductIds as $subProductId) {
50+
$childValidationResult = isset($productIds[$subProductId])
51+
? array_filter($productIds[$subProductId])
52+
: [];
53+
$productIds[$subProductId] = $parentValidationResult + $childValidationResult;
5554
}
5655
unset($productIds[$productId]);
5756
}
5857
return $productIds;
5958
}
60-
61-
/**
62-
* Return validation result for sub-product.
63-
* If any of configurable product is valid for current rule, then their sub-product must be valid too
64-
*
65-
* @param int $urlId
66-
* @param int $subProductsId
67-
* @param array $parentValidationResult
68-
* @return array
69-
*/
70-
private function getSubProductValidationResult($urlId, $subProductsId, $parentValidationResult)
71-
{
72-
if (!isset($this->subProductsValidationResults[$urlId][$subProductsId])) {
73-
$this->subProductsValidationResults[$urlId][$subProductsId] = array_filter($parentValidationResult);
74-
} else {
75-
$parentValidationResult = array_intersect_key(
76-
$this->subProductsValidationResults[$urlId][$subProductsId] + $parentValidationResult,
77-
$parentValidationResult
78-
);
79-
$this->subProductsValidationResults[$urlId][$subProductsId] = $parentValidationResult;
80-
}
81-
return $parentValidationResult;
82-
}
8359
}

app/code/Magento/CatalogRuleConfigurable/Test/Unit/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandlerTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,9 @@ public function testAfterGetMatchingProductIdsWithConfigurableProduct()
9393
0 => true,
9494
1 => true,
9595
3 => true,
96-
4 => false,
9796
],
9897
'simple2' => [
99-
0 => false,
100-
1 => false,
10198
3 => true,
102-
4 => false,
10399
]
104100
],
105101
$this->configurableProductHandler->afterGetMatchingProductIds(

app/code/Magento/CustomerImportExport/etc/import.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@
99
<entity name="customer_composite" label="Customers and Addresses (single file)" model="Magento\CustomerImportExport\Model\Import\CustomerComposite" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" />
1010
<entity name="customer" label="Customers Main File" model="Magento\CustomerImportExport\Model\Import\Customer" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Custom" />
1111
<entity name="customer_address" label="Customer Addresses" model="Magento\CustomerImportExport\Model\Import\Address" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Custom" />
12+
<relatedIndexer entity="customer" name="customer_grid" />
13+
<relatedIndexer entity="customer_address" name="customer_grid" />
14+
<relatedIndexer entity="customer_composite" name="customer_grid" />
1215
</config>

app/code/Magento/Eav/Model/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ protected function _initAttributes($entityType)
418418
*
419419
* @param mixed $entityType
420420
* @param mixed $code
421-
* @return \Magento\Eav\Model\Entity\Attribute\AbstractAttribute|false
421+
* @return \Magento\Eav\Model\Entity\Attribute\AbstractAttribute
422422
* @throws \Magento\Framework\Exception\LocalizedException
423423
*/
424424
public function getAttribute($entityType, $code)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
email,_website,_store,confirmation,created_at,created_in,disable_auto_group_change,dob,firstname,gender,group_id,lastname,middlename,password_hash,prefix,reward_update_notification,reward_warning_notification,rp_token,rp_token_created_at,store_id,suffix,taxvat,updated_at,website_id,password
2+
jondoe@example.com,base,default,,"2015-10-30 12:49:47","Default Store View",0,,Jon,,1,Doe,,d708be3fe0fe0120840e8b13c8faae97424252c6374227ff59c05814f1aecd79:mgLqkqgTwLPLlCljzvF8hp67fNOOvOZb:1,,,,07e71459c137f4da15292134ff459cba,"2015-10-30 12:49:48",1,,,"2015-10-30 12:49:48",1,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_website,_email,_entity_id,city,company,country_id,fax,firstname,lastname,middlename,postcode,prefix,region,region_id,street,suffix,telephone,vat_id,vat_is_valid,vat_request_date,vat_request_id,vat_request_success,_address_default_billing_,_address_default_shipping_
2+
base,jondoe@example.com,1,"New York",,US,,Jon,Doe,,10044,,"New York",43,"Main Street 1",,123456789,,,,,,1,1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_email,_website,_finance_website,store_credit,reward_points
2+
jondoe@example.com,base,base,10.0000,100

app/code/Magento/ImportExport/Model/Import/Config/Reader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Reader extends \Magento\Framework\Config\Reader\Filesystem
1515
protected $_idAttributes = [
1616
'/config/entity' => 'name',
1717
'/config/entityType' => ['entity', 'name'],
18-
'/config/relatedIndexers' => ['entity', 'name'],
18+
'/config/relatedIndexer' => ['entity', 'name'],
1919
];
2020

2121
/**

0 commit comments

Comments
 (0)