Skip to content

Commit 2d8ac6a

Browse files
authored
Merge pull request #4422 from magento-tango/PR-M22-06-27-19
[tango] Bugfixes
2 parents f087569 + 9120659 commit 2d8ac6a

File tree

20 files changed

+289
-121
lines changed

20 files changed

+289
-121
lines changed

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/cc-form.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define([
1212
'Magento_Ui/js/model/messageList',
1313
'mage/translate',
1414
'Magento_Checkout/js/model/full-screen-loader',
15-
'Magento_Checkout/js/action/set-payment-information',
15+
'Magento_Checkout/js/action/set-payment-information-extended',
1616
'Magento_Checkout/js/model/payment/additional-validators',
1717
'Magento_Braintree/js/view/payment/validator-handler'
1818
], function (
@@ -22,7 +22,7 @@ define([
2222
messageList,
2323
$t,
2424
fullScreenLoader,
25-
setPaymentInformationAction,
25+
setPaymentInformationExtended,
2626
additionalValidators,
2727
validatorManager
2828
) {
@@ -51,9 +51,10 @@ define([
5151
if (additionalValidators.validate()) {
5252
fullScreenLoader.startLoader();
5353
$.when(
54-
setPaymentInformationAction(
54+
setPaymentInformationExtended(
5555
this.messageContainer,
56-
this.getData()
56+
this.getData(),
57+
true
5758
)
5859
).done(this.done.bind(this))
5960
.fail(this.fail.bind(this));

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/paypal.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ define([
88
'jquery',
99
'underscore',
1010
'Magento_Braintree/js/view/payment/method-renderer/paypal',
11-
'Magento_Checkout/js/action/set-payment-information',
11+
'Magento_Checkout/js/action/set-payment-information-extended',
1212
'Magento_Checkout/js/model/payment/additional-validators',
1313
'Magento_Checkout/js/model/full-screen-loader'
1414
], function (
1515
$,
1616
_,
1717
Component,
18-
setPaymentInformationAction,
18+
setPaymentInformationExtended,
1919
additionalValidators,
2020
fullScreenLoader
2121
) {
@@ -131,9 +131,10 @@ define([
131131
placeOrder: function () {
132132
fullScreenLoader.startLoader();
133133
$.when(
134-
setPaymentInformationAction(
134+
setPaymentInformationExtended(
135135
this.messageContainer,
136-
this.getData()
136+
this.getData(),
137+
true
137138
)
138139
).done(this.done.bind(this))
139140
.fail(this.fail.bind(this));

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2525,6 +2525,12 @@ public function validateRow(array $rowData, $rowNum)
25252525
*/
25262526
private function isNeedToValidateUrlKey($rowData)
25272527
{
2528+
if (!empty($rowData[self::COL_SKU]) && empty($rowData[self::URL_KEY])
2529+
&& $this->getBehavior() === Import::BEHAVIOR_APPEND
2530+
&& $this->isSkuExist($rowData[self::COL_SKU])) {
2531+
return false;
2532+
}
2533+
25282534
return (!empty($rowData[self::URL_KEY]) || !empty($rowData[self::COL_NAME]))
25292535
&& (empty($rowData[self::COL_VISIBILITY])
25302536
|| $rowData[self::COL_VISIBILITY]
@@ -2842,7 +2848,8 @@ protected function getUrlKey($rowData)
28422848
return trim(strtolower($urlKey));
28432849
}
28442850

2845-
if (!empty($rowData[self::COL_NAME])) {
2851+
if (!empty($rowData[self::COL_NAME])
2852+
&& (array_key_exists(self::URL_KEY, $rowData) || !$this->isSkuExist($rowData[self::COL_SKU]))) {
28462853
return $this->productUrl->formatUrlKey($rowData[self::COL_NAME]);
28472854
}
28482855

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,8 @@ public function execute(Observer $observer)
232232
protected function _populateForUrlGeneration($rowData)
233233
{
234234
$newSku = $this->import->getNewSku($rowData[ImportProduct::COL_SKU]);
235-
if (empty($newSku) || !isset($newSku['entity_id'])) {
236-
return null;
237-
}
238-
if ($this->import->getRowScope($rowData) == ImportProduct::SCOPE_STORE
239-
&& empty($rowData[self::URL_KEY_ATTRIBUTE_CODE])) {
235+
$oldSku = $this->import->getOldSku();
236+
if (!$this->isNeedToPopulateForUrlGeneration($rowData, $newSku, $oldSku)) {
240237
return null;
241238
}
242239
$rowData['entity_id'] = $newSku['entity_id'];
@@ -268,6 +265,27 @@ protected function _populateForUrlGeneration($rowData)
268265
return $this;
269266
}
270267

268+
/**
269+
* Check is need to populate data for url generation
270+
*
271+
* @param array $rowData
272+
* @param array $newSku
273+
* @param array $oldSku
274+
* @return bool
275+
*/
276+
private function isNeedToPopulateForUrlGeneration($rowData, $newSku, $oldSku): bool
277+
{
278+
if ((empty($newSku) || !isset($newSku['entity_id']))
279+
|| ($this->import->getRowScope($rowData) == ImportProduct::SCOPE_STORE
280+
&& empty($rowData[self::URL_KEY_ATTRIBUTE_CODE]))
281+
|| (array_key_exists($rowData[ImportProduct::COL_SKU], $oldSku)
282+
&& !isset($rowData[self::URL_KEY_ATTRIBUTE_CODE])
283+
&& $this->import->getBehavior() === ImportExport::BEHAVIOR_APPEND)) {
284+
return false;
285+
}
286+
return true;
287+
}
288+
271289
/**
272290
* Add store id to product data.
273291
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ private function generateChangedProductUrls(
280280
/* @var Collection $collection */
281281
$collection = $this->productCollectionFactory->create()
282282
->setStoreId($categoryStoreId)
283-
->addIdFilter($category->getAffectedProductIds())
283+
->addIdFilter($category->getChangedProductIds())
284284
->addAttributeToSelect('visibility')
285285
->addAttributeToSelect('name')
286286
->addAttributeToSelect('url_key')
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/**
7+
* @api
8+
*/
9+
define([
10+
'Magento_Checkout/js/model/quote',
11+
'Magento_Checkout/js/model/url-builder',
12+
'mage/storage',
13+
'Magento_Checkout/js/model/error-processor',
14+
'Magento_Customer/js/model/customer',
15+
'Magento_Checkout/js/action/get-totals',
16+
'Magento_Checkout/js/model/full-screen-loader'
17+
], function (quote, urlBuilder, storage, errorProcessor, customer, getTotalsAction, fullScreenLoader) {
18+
'use strict';
19+
20+
return function (messageContainer, paymentData, skipBilling) {
21+
var serviceUrl,
22+
payload;
23+
24+
skipBilling = skipBilling || false;
25+
payload = {
26+
cartId: quote.getQuoteId(),
27+
paymentMethod: paymentData
28+
};
29+
30+
/**
31+
* Checkout for guest and registered customer.
32+
*/
33+
if (!customer.isLoggedIn()) {
34+
serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/set-payment-information', {
35+
cartId: quote.getQuoteId()
36+
});
37+
payload.email = quote.guestEmail;
38+
} else {
39+
serviceUrl = urlBuilder.createUrl('/carts/mine/set-payment-information', {});
40+
}
41+
42+
if (skipBilling === false) {
43+
payload.billingAddress = quote.billingAddress();
44+
}
45+
46+
fullScreenLoader.startLoader();
47+
48+
return storage.post(
49+
serviceUrl, JSON.stringify(payload)
50+
).fail(
51+
function (response) {
52+
errorProcessor.process(response, messageContainer);
53+
}
54+
).always(
55+
function () {
56+
fullScreenLoader.stopLoader();
57+
}
58+
);
59+
};
60+
});

app/code/Magento/Checkout/view/frontend/web/js/action/set-payment-information.js

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,13 @@
77
* @api
88
*/
99
define([
10-
'Magento_Checkout/js/model/quote',
11-
'Magento_Checkout/js/model/url-builder',
12-
'mage/storage',
13-
'Magento_Checkout/js/model/error-processor',
14-
'Magento_Customer/js/model/customer',
15-
'Magento_Checkout/js/action/get-totals',
16-
'Magento_Checkout/js/model/full-screen-loader'
17-
], function (quote, urlBuilder, storage, errorProcessor, customer, getTotalsAction, fullScreenLoader) {
10+
'Magento_Checkout/js/action/set-payment-information-extended'
11+
12+
], function (setPaymentInformationExtended) {
1813
'use strict';
1914

2015
return function (messageContainer, paymentData) {
21-
var serviceUrl,
22-
payload;
23-
24-
/**
25-
* Checkout for guest and registered customer.
26-
*/
27-
if (!customer.isLoggedIn()) {
28-
serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/set-payment-information', {
29-
cartId: quote.getQuoteId()
30-
});
31-
payload = {
32-
cartId: quote.getQuoteId(),
33-
email: quote.guestEmail,
34-
paymentMethod: paymentData,
35-
billingAddress: quote.billingAddress()
36-
};
37-
} else {
38-
serviceUrl = urlBuilder.createUrl('/carts/mine/set-payment-information', {});
39-
payload = {
40-
cartId: quote.getQuoteId(),
41-
paymentMethod: paymentData,
42-
billingAddress: quote.billingAddress()
43-
};
44-
}
45-
46-
fullScreenLoader.startLoader();
4716

48-
return storage.post(
49-
serviceUrl, JSON.stringify(payload)
50-
).fail(
51-
function (response) {
52-
errorProcessor.process(response, messageContainer);
53-
}
54-
).always(
55-
function () {
56-
fullScreenLoader.stopLoader();
57-
}
58-
);
17+
return setPaymentInformationExtended(messageContainer, paymentData, false);
5918
};
6019
});

app/code/Magento/Payment/view/frontend/web/js/view/payment/iframe.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,7 @@ define([
125125
this.isPlaceOrderActionAllowed(false);
126126

127127
$.when(
128-
setPaymentInformationAction(
129-
this.messageContainer,
130-
{
131-
method: this.getCode()
132-
}
133-
)
128+
this.setPaymentInformation()
134129
).done(
135130
this.done.bind(this)
136131
).fail(
@@ -145,6 +140,18 @@ define([
145140
}
146141
},
147142

143+
/**
144+
* {Function}
145+
*/
146+
setPaymentInformation: function () {
147+
setPaymentInformationAction(
148+
this.messageContainer,
149+
{
150+
method: this.getCode()
151+
}
152+
);
153+
},
154+
148155
/**
149156
* {Function}
150157
*/

app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,10 @@ public function generatePool()
168168
++$attempt;
169169
} while ($this->getResource()->exists($code));
170170

171-
$expirationDate = $this->getToDate();
172-
if ($expirationDate instanceof \DateTimeInterface) {
173-
$expirationDate = $expirationDate->format('Y-m-d H:i:s');
174-
}
175-
176171
$coupon->setId(null)
177172
->setRuleId($this->getRuleId())
178173
->setUsageLimit($this->getUsesPerCoupon())
179174
->setUsagePerCustomer($this->getUsagePerCustomer())
180-
->setExpirationDate($expirationDate)
181175
->setCreatedAt($nowTimestamp)
182176
->setType(\Magento\SalesRule\Helper\Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED)
183177
->setCode($code)

app/code/Magento/SalesRule/Model/CouponRepository.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ public function save(\Magento\SalesRule\Api\Data\CouponInterface $coupon)
119119
__('Specified rule does not allow auto generated coupons')
120120
);
121121
}
122-
$coupon->setExpirationDate($rule->getToDate());
123122
$coupon->setUsageLimit($rule->getUsesPerCoupon());
124123
$coupon->setUsagePerCustomer($rule->getUsesPerCustomer());
125124
} catch (\Exception $e) {

0 commit comments

Comments
 (0)