Skip to content

Commit 52e58fc

Browse files
author
Oleksandr Karpenko
committed
Merge branch 'develop' of https://github.corp.magento.com/magento2/magento2ce into BUGS
2 parents e4381d8 + 777f782 commit 52e58fc

File tree

98 files changed

+2037
-832
lines changed

Some content is hidden

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

98 files changed

+2037
-832
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ protected function populateAuthorizeRequest(InfoInterface $payment, $token)
409409
if ($token) {
410410
$transactionParams['paymentMethodToken'] = $token;
411411
$transactionParams['customerId'] = $customerId;
412+
$transactionParams['billing'] = $this->toBraintreeAddress($billing);
413+
$transactionParams['shipping'] = $this->toBraintreeAddress($shipping);
412414
} elseif ($this->getInfoInstance()->getAdditionalInformation('payment_method_nonce')) {
413415
$transactionParams['paymentMethodNonce'] =
414416
$this->getInfoInstance()->getAdditionalInformation('payment_method_nonce');

app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,8 +1361,6 @@ public function authorizeDataProvider()
13611361
'merchantAccountId' => self::MERCHANT_ACCOUNT_ID,
13621362
'paymentMethodToken' => self::CC_TOKEN,
13631363
'customerId' => self::CUSTOMER_ID,
1364-
'billing' => null,
1365-
'shipping' => null,
13661364
'deviceData' => 'fraud_detection_data',
13671365
],
13681366
'braintree_response' => [
@@ -1429,8 +1427,6 @@ public function authorizeDataProvider()
14291427
'merchantAccountId' => self::MERCHANT_ACCOUNT_ID,
14301428
'paymentMethodNonce' => self::PAYMENT_METHOD_NONCE,
14311429
'customerId' => self::CUSTOMER_ID,
1432-
'billing' => null,
1433-
'shipping' => null,
14341430
'deviceData' => 'fraud_detection_data',
14351431
'options' => [
14361432
'three_d_secure' => [
@@ -1502,8 +1498,6 @@ public function authorizeDataProvider()
15021498
'merchantAccountId' => self::MERCHANT_ACCOUNT_ID,
15031499
'paymentMethodToken' => self::CC_TOKEN,
15041500
'customerId' => self::CUSTOMER_ID,
1505-
'billing' => null,
1506-
'shipping' => null,
15071501
'deviceData' => 'fraud_detection_data',
15081502
],
15091503
'braintree_response' => [

app/code/Magento/Bundle/Pricing/Adjustment/BundleCalculatorInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ interface BundleCalculatorInterface extends CalculatorInterface
1717
/**
1818
* @param float|string $amount
1919
* @param Product $saleableItem
20-
* @param null|bool $exclude
20+
* @param null|bool|string|array $exclude
2121
* @return \Magento\Framework\Pricing\Amount\AmountInterface
2222
*/
2323
public function getMaxAmount($amount, Product $saleableItem, $exclude = null);
2424

2525
/**
2626
* @param float|string $amount
2727
* @param Product $saleableItem
28-
* @param null|bool $exclude
28+
* @param null|bool|string|array $exclude
2929
* @return \Magento\Framework\Pricing\Amount\AmountInterface
3030
*/
3131
public function getMaxRegularAmount($amount, Product $saleableItem, $exclude = null);
3232

3333
/**
3434
* @param float|string $amount
3535
* @param Product $saleableItem
36-
* @param null|bool $exclude
36+
* @param null|bool|string|array $exclude
3737
* @return \Magento\Framework\Pricing\Amount\AmountInterface
3838
*/
3939
public function getMinRegularAmount($amount, Product $saleableItem, $exclude = null);
@@ -42,7 +42,7 @@ public function getMinRegularAmount($amount, Product $saleableItem, $exclude = n
4242
* Option amount calculation for saleable item
4343
*
4444
* @param Product $saleableItem
45-
* @param null|string $exclude
45+
* @param null|bool|string|array $exclude
4646
* @param bool $searchMin
4747
* @param \Magento\Framework\Pricing\Amount\AmountInterface|null $bundleProductAmount
4848
* @return \Magento\Framework\Pricing\Amount\AmountInterface
@@ -60,7 +60,7 @@ public function getOptionsAmount(
6060
* @param float $basePriceValue
6161
* @param Product $bundleProduct
6262
* @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList
63-
* @param null|string $exclude code of adjustment that has to be excluded
63+
* @param null|bool|string|array $exclude code of adjustment that has to be excluded
6464
* @return \Magento\Framework\Pricing\Amount\AmountInterface
6565
*/
6666
public function calculateBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude = null);

app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function __construct(
7777
*
7878
* @param float|string $amount
7979
* @param SaleableInterface $saleableItem
80-
* @param null|string $exclude
80+
* @param null|bool|string|array $exclude
8181
* @param null|array $context
8282
* @return \Magento\Framework\Pricing\Amount\AmountInterface
8383
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
@@ -92,7 +92,7 @@ public function getAmount($amount, SaleableInterface $saleableItem, $exclude = n
9292
*
9393
* @param float $amount
9494
* @param Product $saleableItem
95-
* @param null|string $exclude
95+
* @param null|bool|string|array $exclude
9696
* @return \Magento\Framework\Pricing\Amount\AmountInterface
9797
*/
9898
public function getMinRegularAmount($amount, Product $saleableItem, $exclude = null)
@@ -105,7 +105,7 @@ public function getMinRegularAmount($amount, Product $saleableItem, $exclude = n
105105
*
106106
* @param float $amount
107107
* @param Product $saleableItem
108-
* @param null|string $exclude
108+
* @param null|bool|string|array $exclude
109109
* @return \Magento\Framework\Pricing\Amount\AmountInterface
110110
*/
111111
public function getMaxAmount($amount, Product $saleableItem, $exclude = null)
@@ -118,7 +118,7 @@ public function getMaxAmount($amount, Product $saleableItem, $exclude = null)
118118
*
119119
* @param float $amount
120120
* @param Product $saleableItem
121-
* @param null|string $exclude
121+
* @param null|bool|string|array $exclude
122122
* @return \Magento\Framework\Pricing\Amount\AmountInterface
123123
*/
124124
public function getMaxRegularAmount($amount, Product $saleableItem, $exclude = null)
@@ -130,7 +130,7 @@ public function getMaxRegularAmount($amount, Product $saleableItem, $exclude = n
130130
* Option amount calculation for bundle product
131131
*
132132
* @param Product $saleableItem
133-
* @param null|string $exclude
133+
* @param null|bool|string|array $exclude
134134
* @param bool $searchMin
135135
* @param float $baseAmount
136136
* @param bool $useRegularPrice
@@ -260,7 +260,7 @@ protected function getBundleOptions(Product $saleableItem)
260260
* @param float $basePriceValue
261261
* @param Product $bundleProduct
262262
* @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList
263-
* @param null|string $exclude
263+
* @param null|bool|string|array $exclude
264264
* @return \Magento\Framework\Pricing\Amount\AmountInterface
265265
*/
266266
public function calculateBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude = null)
@@ -278,7 +278,7 @@ public function calculateBundleAmount($basePriceValue, $bundleProduct, $selectio
278278
* @param float $basePriceValue
279279
* @param Product $bundleProduct
280280
* @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList
281-
* @param null|string $exclude
281+
* @param null|bool|string|arrayy $exclude
282282
* @return \Magento\Framework\Pricing\Amount\AmountInterface
283283
*/
284284
protected function calculateFixedBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude)
@@ -297,7 +297,7 @@ protected function calculateFixedBundleAmount($basePriceValue, $bundleProduct, $
297297
* @param float $basePriceValue
298298
* @param Product $bundleProduct
299299
* @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList
300-
* @param null|string $exclude
300+
* @param null|bool|string|array $exclude
301301
* @return \Magento\Framework\Pricing\Amount\AmountInterface
302302
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
303303
*/
@@ -340,9 +340,18 @@ protected function calculateDynamicBundleAmount($basePriceValue, $bundleProduct,
340340
}
341341
}
342342
}
343-
if ($exclude && isset($adjustments[$exclude])) {
344-
$fullAmount -= $adjustments[$exclude];
345-
unset($adjustments[$exclude]);
343+
if (is_array($exclude) == false) {
344+
if ($exclude && isset($adjustments[$exclude])) {
345+
$fullAmount -= $adjustments[$exclude];
346+
unset($adjustments[$exclude]);
347+
}
348+
} else {
349+
foreach ($exclude as $oneExclusion) {
350+
if ($oneExclusion && isset($adjustments[$oneExclusion])) {
351+
$fullAmount -= $adjustments[$oneExclusion];
352+
unset($adjustments[$oneExclusion]);
353+
}
354+
}
346355
}
347356
return $this->amountFactory->create($fullAmount, $adjustments);
348357
}

app/code/Magento/Bundle/Pricing/Price/BundleSelectionPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class BundleSelectionPrice extends AbstractPrice
6868
* @param ManagerInterface $eventManager
6969
* @param DiscountCalculator $discountCalculator
7070
* @param bool $useRegularPrice
71-
* @param string $excludeAdjustment
71+
* @param array $excludeAdjustment
7272
*/
7373
public function __construct(
7474
Product $saleableItem,

app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,21 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje
119119
$optionId = $connection->fetchOne($statement);
120120

121121
if ($optionId) {
122-
if ($object->getStoreId() == '0') {
123-
$data = $this->_prepareDataForTable(
124-
new \Magento\Framework\DataObject(
125-
['price' => $object->getPrice(), 'price_type' => $object->getPriceType()]
126-
),
127-
$priceTable
128-
);
122+
$data = $this->_prepareDataForTable(
123+
new \Magento\Framework\DataObject(
124+
['price' => $object->getPrice(), 'price_type' => $object->getPriceType()]
125+
),
126+
$priceTable
127+
);
129128

130-
$connection->update(
131-
$priceTable,
132-
$data,
133-
[
134-
'option_id = ?' => $object->getId(),
135-
'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID
136-
]
137-
);
138-
}
129+
$connection->update(
130+
$priceTable,
131+
$data,
132+
[
133+
'option_id = ?' => $object->getId(),
134+
'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID
135+
]
136+
);
139137
} else {
140138
$data = $this->_prepareDataForTable(
141139
new \Magento\Framework\DataObject(

app/code/Magento/Catalog/Pricing/Price/CustomOptionPrice.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class CustomOptionPrice extends AbstractPrice implements CustomOptionPriceInterf
4141
* @param float $quantity
4242
* @param CalculatorInterface $calculator
4343
* @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency
44-
* @param string $excludeAdjustment
44+
* @param array $excludeAdjustment
4545
*/
4646
public function __construct(
4747
SaleableInterface $saleableItem,
@@ -113,7 +113,7 @@ public function getValue()
113113

114114
/**
115115
* @param float $amount
116-
* @param null|bool|string $exclude
116+
* @param null|bool|string|array $exclude
117117
* @param null|array $context
118118
* @return AmountInterface|bool|float
119119
*/

app/code/Magento/CatalogInventory/Model/StockRegistryProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ public function getStockItem($productId, $websiteId)
148148
if (!isset($this->stockItems[$key])) {
149149
$criteria = $this->stockItemCriteriaFactory->create();
150150
$criteria->setProductsFilter($productId);
151-
$criteria->setWebsiteFilter($websiteId);
152151
$collection = $this->stockItemRepository->getList($criteria);
153152
$stockItem = current($collection->getItems());
154153
if ($stockItem && $stockItem->getItemId()) {

app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockRegistryProviderTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ public function testGetStock()
253253
public function testGetStockItem()
254254
{
255255
$this->stockItemCriteriaFactory->expects($this->once())->method('create')->willReturn($this->stockItemCriteria);
256-
$this->stockItemCriteria->expects($this->once())->method('setWebsiteFilter')->willReturn(null);
257256
$this->stockItemCriteria->expects($this->once())->method('setProductsFilter')->willReturn(null);
258257
$stockItemCollection = $this->getMock(
259258
'\Magento\CatalogInventory\Model\ResourceModel\Stock\Item\Collection',

app/code/Magento/CatalogUrlRewrite/Observer/ProductProcessUrlRewriteSavingObserver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\CatalogUrlRewrite\Observer;
77

8+
use Magento\Catalog\Model\Product\Visibility;
89
use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator;
910
use Magento\UrlRewrite\Model\UrlPersistInterface;
1011
use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;
@@ -53,7 +54,9 @@ public function execute(\Magento\Framework\Event\Observer $observer)
5354
UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE,
5455
]);
5556
}
56-
$this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
57+
if ($product->getVisibility() != Visibility::VISIBILITY_NOT_VISIBLE) {
58+
$this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
59+
}
5760
}
5861
}
5962
}

app/code/Magento/CatalogUrlRewrite/Observer/ProductToWebsiteChangeObserver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ public function execute(\Magento\Framework\Event\Observer $observer)
7272
UrlRewrite::ENTITY_ID => $product->getId(),
7373
UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE,
7474
]);
75-
$this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
75+
if ($product->getVisibility() != Visibility::VISIBILITY_NOT_VISIBLE) {
76+
$this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
77+
}
7678
}
7779
}
7880
}

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ public function getConfig()
278278
);
279279
$output['postCodes'] = $this->postCodesConfig->getPostCodes();
280280
$output['imageData'] = $this->imageProvider->getImages($quoteId);
281-
$output['defaultCountryId'] = $this->directoryHelper->getDefaultCountry();
282281
$output['totalsData'] = $this->getTotalsData();
283282
$output['shippingPolicy'] = [
284283
'isEnabled' => $this->scopeConfig->isSetFlag(

app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ define([], function() {
1414
return {
1515
email: addressData.email,
1616
countryId: (addressData.country_id) ? addressData.country_id : window.checkoutConfig.defaultCountryId,
17-
regionId: (addressData.region) ? addressData.region.region_id : null,
17+
regionId: (addressData.region && addressData.region.region_id)
18+
? addressData.region.region_id
19+
: window.checkoutConfig.defaultRegionId,
1820
regionCode: (addressData.region) ? addressData.region.region_code : null,
1921
region: (addressData.region) ? addressData.region.region : null,
2022
customerId: addressData.customer_id,
2123
street: addressData.street,
2224
company: addressData.company,
2325
telephone: addressData.telephone,
2426
fax: addressData.fax,
25-
postcode: addressData.postcode,
27+
postcode: addressData.postcode ? addressData.postcode : window.checkoutConfig.defaultPostcode,
2628
city: addressData.city,
2729
firstname: addressData.firstname,
2830
lastname: addressData.lastname,

app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Steps/Bulk.php

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,24 @@ class Bulk extends \Magento\Ui\Block\Component\StepsWizard\StepAbstract
1212
/** @var \Magento\Catalog\Helper\Image */
1313
protected $image;
1414

15+
/**
16+
* @var \Magento\ConfigurableProduct\Model\Product\VariationMediaAttributes
17+
*/
18+
protected $variationMediaAttributes;
19+
1520
/**
1621
* @param \Magento\Framework\View\Element\Template\Context $context
1722
* @param \Magento\Catalog\Helper\Image $image
23+
* @param \Magento\ConfigurableProduct\Model\Product\VariationMediaAttributes $variationMediaAttributes
1824
*/
1925
public function __construct(
2026
\Magento\Framework\View\Element\Template\Context $context,
21-
\Magento\Catalog\Helper\Image $image
27+
\Magento\Catalog\Helper\Image $image,
28+
\Magento\ConfigurableProduct\Model\Product\VariationMediaAttributes $variationMediaAttributes
2229
) {
2330
parent::__construct($context);
2431
$this->image = $image;
32+
$this->variationMediaAttributes = $variationMediaAttributes;
2533
}
2634

2735
/**
@@ -39,4 +47,31 @@ public function getNoImageUrl()
3947
{
4048
return $this->image->getDefaultPlaceholderUrl('thumbnail');
4149
}
50+
51+
/**
52+
* Get image types data
53+
*
54+
* @return array
55+
*/
56+
public function getImageTypes()
57+
{
58+
$imageTypes = [];
59+
foreach ($this->variationMediaAttributes->getMediaAttributes() as $attribute) {
60+
/* @var $attribute \Magento\Eav\Model\Entity\Attribute */
61+
$imageTypes[$attribute->getAttributeCode()] = [
62+
'code' => $attribute->getAttributeCode(),
63+
'value' => '',
64+
'name' => '',
65+
];
66+
}
67+
return $imageTypes;
68+
}
69+
70+
/**
71+
* @return array
72+
*/
73+
public function getMediaAttributes()
74+
{
75+
return $this->variationMediaAttributes->getMediaAttributes();
76+
}
4277
}

0 commit comments

Comments
 (0)