Skip to content

Commit 0b467de

Browse files
committed
Merge remote-tracking branch 'origin/2.2-develop' into 2.2-develop-pr27
2 parents 6eccc7f + 81f65c1 commit 0b467de

File tree

8 files changed

+92
-26
lines changed

8 files changed

+92
-26
lines changed

app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ public function collectRates(RateRequest $request)
128128
$freeQty += $item->getQty() * ($child->getQty() - $freeShipping);
129129
}
130130
}
131-
} elseif ($item->getFreeShipping()) {
132-
$freeShipping = is_numeric($item->getFreeShipping()) ? $item->getFreeShipping() : 0;
131+
} elseif ($item->getFreeShipping() || $item->getAddress()->getFreeShipping()) {
132+
$freeShipping = $item->getFreeShipping() ?
133+
$item->getFreeShipping() : $item->getAddress()->getFreeShipping();
134+
$freeShipping = is_numeric($freeShipping) ? $freeShipping : 0;
133135
$freeQty += $item->getQty() - $freeShipping;
134136
$freePackageValue += $item->getBaseRowTotal();
135137
}

app/code/Magento/Sales/Setup/UpgradeData.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,27 +177,27 @@ private function convertSerializedDataToJson($setupVersion, SalesSetup $salesSet
177177
public function fillQuoteAddressIdInSalesOrderAddress()
178178
{
179179
$addressCollection = $this->addressCollectionFactory->create();
180+
$addressCollection->addFieldToFilter('quote_address_id', ['null' => true]);
181+
180182
/** @var \Magento\Sales\Model\Order\Address $orderAddress */
181183
foreach ($addressCollection as $orderAddress) {
182-
if (!$orderAddress->getData('quote_address_id')) {
183-
$orderId = $orderAddress->getParentId();
184-
$addressType = $orderAddress->getAddressType();
185-
186-
/** @var \Magento\Sales\Model\Order $order */
187-
$order = $this->orderFactory->create()->load($orderId);
188-
$quoteId = $order->getQuoteId();
189-
$quote = $this->quoteFactory->create()->load($quoteId);
190-
191-
if ($addressType == \Magento\Sales\Model\Order\Address::TYPE_SHIPPING) {
192-
$quoteAddressId = $quote->getShippingAddress()->getId();
193-
$orderAddress->setData('quote_address_id', $quoteAddressId);
194-
} elseif ($addressType == \Magento\Sales\Model\Order\Address::TYPE_BILLING) {
195-
$quoteAddressId = $quote->getBillingAddress()->getId();
196-
$orderAddress->setData('quote_address_id', $quoteAddressId);
197-
}
198-
199-
$orderAddress->save();
184+
$orderId = $orderAddress->getParentId();
185+
$addressType = $orderAddress->getAddressType();
186+
187+
/** @var \Magento\Sales\Model\Order $order */
188+
$order = $this->orderFactory->create()->load($orderId);
189+
$quoteId = $order->getQuoteId();
190+
$quote = $this->quoteFactory->create()->load($quoteId);
191+
192+
if ($addressType == \Magento\Sales\Model\Order\Address::TYPE_SHIPPING) {
193+
$quoteAddressId = $quote->getShippingAddress()->getId();
194+
$orderAddress->setData('quote_address_id', $quoteAddressId);
195+
} elseif ($addressType == \Magento\Sales\Model\Order\Address::TYPE_BILLING) {
196+
$quoteAddressId = $quote->getBillingAddress()->getId();
197+
$orderAddress->setData('quote_address_id', $quoteAddressId);
200198
}
199+
200+
$orderAddress->save();
201201
}
202202
}
203203
}

app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ private function isTokenExpired(Token $token): bool
133133
// other user-type tokens are considered always valid
134134
return false;
135135
}
136+
137+
if (empty($tokenTtl)) {
138+
return false;
139+
}
140+
136141
if ($this->dateTime->strToTime($token->getCreatedAt()) < ($this->date->gmtTimestamp() - $tokenTtl * 3600)) {
137142
return true;
138143
}

app/code/Magento/Wishlist/CustomerData/Wishlist.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem)
147147
*/
148148
protected function getImageData($product)
149149
{
150+
/*Set variant product if it is configurable product.
151+
It will show variant product image in sidebar instead of configurable product image.*/
152+
$simpleOption = $product->getCustomOption('simple_product');
153+
if ($simpleOption !== null) {
154+
$optionProduct = $simpleOption->getProduct();
155+
$product = $optionProduct;
156+
}
157+
150158
/** @var \Magento\Catalog\Helper\Image $helper */
151159
$helper = $this->imageHelperFactory->create()
152160
->init($product, 'wishlist_sidebar_block');

dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,57 @@ public function testRateAppliedToShipping()
3030
$this->assertEquals(0, $customerQuote->getBaseGrandTotal());
3131
}
3232

33+
/**
34+
* @magentoConfigFixture current_store carriers/tablerate/active 1
35+
* @magentoConfigFixture current_store carriers/flatrate/active 0
36+
* @magentoConfigFixture current_store carriers/freeshipping/active 0
37+
* @magentoConfigFixture current_store carriers/tablerate/condition_name package_qty
38+
* @magentoDataFixture Magento/SalesRule/_files/cart_rule_free_shipping_by_cart.php
39+
* @magentoDataFixture Magento/Sales/_files/quote.php
40+
* @magentoDataFixture Magento/OfflineShipping/_files/tablerates.php
41+
* @return void
42+
*/
43+
public function testTableRateFreeShipping()
44+
{
45+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
46+
/** @var \Magento\Quote\Model\Quote $quote */
47+
$quote = $objectManager->get(\Magento\Quote\Model\Quote::class);
48+
$quote->load('test01', 'reserved_order_id');
49+
$cartId = $quote->getId();
50+
if (!$cartId) {
51+
$this->fail('quote fixture failed');
52+
}
53+
/** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */
54+
$quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
55+
->create(\Magento\Quote\Model\QuoteIdMaskFactory::class)
56+
->create();
57+
$quoteIdMask->load($cartId, 'quote_id');
58+
//Use masked cart Id
59+
$cartId = $quoteIdMask->getMaskedId();
60+
$data = [
61+
'data' => [
62+
'country_id' => "US",
63+
'postcode' => null,
64+
'region' => null,
65+
'region_id' => null
66+
]
67+
];
68+
/** @var \Magento\Quote\Api\Data\EstimateAddressInterface $address */
69+
$address = $objectManager->create(\Magento\Quote\Api\Data\EstimateAddressInterface::class, $data);
70+
/** @var \Magento\Quote\Api\GuestShippingMethodManagementInterface $shippingEstimation */
71+
$shippingEstimation = $objectManager->get(\Magento\Quote\Api\GuestShippingMethodManagementInterface::class);
72+
$result = $shippingEstimation->estimateByAddress($cartId, $address);
73+
$this->assertNotEmpty($result);
74+
$expectedResult = [
75+
'method_code' => 'bestway',
76+
'amount' => 0
77+
];
78+
foreach ($result as $rate) {
79+
$this->assertEquals($expectedResult['amount'], $rate->getAmount());
80+
$this->assertEquals($expectedResult['method_code'], $rate->getMethodCode());
81+
}
82+
}
83+
3384
/**
3485
* @magentoConfigFixture current_store carriers/tablerate/active 1
3586
* @magentoConfigFixture current_store carriers/tablerate/condition_name package_qty
@@ -53,6 +104,7 @@ public function testEstimateByAddressWithCartPriceRuleByItem()
53104
*/
54105
public function testEstimateByAddressWithCartPriceRuleByShipment()
55106
{
107+
$this->markTestSkipped('According to MAGETWO-69940 it is an incorrect behavior');
56108
// Rule applied to entire shipment should not overwrite flat or table rate shipping prices
57109
// Only rules applied to specific items should modify those prices (MAGETWO-63844)
58110
$this->executeTestFlow(5, 10);

lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null)
286286
* @param string|\DateTimeInterface $date
287287
* @param int $dateType
288288
* @param int $timeType
289-
* @param null $locale
290-
* @param null $timezone
289+
* @param string|null $locale
290+
* @param string|null $timezone
291291
* @param string|null $pattern
292292
* @return string
293293
*/

lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null);
124124
* @param string|\DateTimeInterface $date
125125
* @param int $dateType
126126
* @param int $timeType
127-
* @param null $locale
128-
* @param null $timezone
127+
* @param string|null $locale
128+
* @param string|null $timezone
129129
* @param string|null $pattern
130130
* @return string
131131
*/

lib/web/css/source/lib/_buttons.less

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,7 @@
266266
&.disabled,
267267
&[disabled],
268268
fieldset[disabled] & {
269-
cursor: not-allowed;
270-
pointer-events: none; // Disabling of clicks
269+
pointer-events: none; // Disabling of all pointer events
271270
.lib-css(opacity, @button__disabled__opacity);
272271
}
273272
}

0 commit comments

Comments
 (0)