Skip to content

Commit ec788ec

Browse files
authored
Merge branch '2.4-develop' into B2B-2259
2 parents 7eacfe2 + 4aeb66b commit ec788ec

File tree

6 files changed

+118
-46
lines changed

6 files changed

+118
-46
lines changed

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/radio.phtml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,66 +20,72 @@ $viewModel = $block->getData('validateQuantityViewModel');
2020
</label>
2121
<div class="control">
2222
<div class="nested options-list">
23-
<?php if ($block->showSingle()) : ?>
23+
<?php if ($block->showSingle()): ?>
2424
<?= /* @noEscape */ $block->getSelectionTitlePrice($_selections[0]) ?>
2525
<?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selections[0]) ?>
2626
<input type="hidden"
27-
class="bundle-option-<?= (int)$_option->getId() ?> product bundle option"
28-
name="bundle_option[<?= (int)$_option->getId() ?>]"
29-
value="<?= (int)$_selections[0]->getSelectionId() ?>"
30-
id="bundle-option-<?= (int)$_option->getId() ?>-<?= (int)$_selections[0]->getSelectionId() ?>"
31-
checked="checked"
27+
class="bundle-option-<?= (int)$_option->getId() ?> product bundle option"
28+
name="bundle_option[<?= (int)$_option->getId() ?>]"
29+
value="<?= (int)$_selections[0]->getSelectionId() ?>"
30+
id="bundle-option-<?= (int)$_option->getId() ?>-<?= (int)$_selections[0]->getSelectionId() ?>"
31+
checked="checked"
3232
/>
33-
<?php else :?>
34-
<?php if (!$_option->getRequired()) : ?>
33+
<?php else: ?>
34+
<?php if (!$_option->getRequired()): ?>
3535
<div class="field choice">
3636
<input type="radio"
3737
class="radio product bundle option"
3838
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>"
3939
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
4040
data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
41-
<?= ($_default && $_default->isSalable())?'':' checked="checked" ' ?>
41+
<?= ($_default && $_default->isSalable())?'':' checked="checked" ' ?>
4242
value=""/>
4343
<label class="label" for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>">
4444
<span><?= $block->escapeHtml(__('None')) ?></span>
4545
</label>
4646
</div>
4747
<?php endif; ?>
48-
<?php foreach ($_selections as $_selection) : ?>
48+
<?php foreach ($_selections as $_selection): ?>
4949
<div class="field choice">
5050
<input type="radio"
5151
class="radio product bundle option change-container-classname"
52-
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
53-
<?php if ($_option->getRequired()) { echo 'data-validate="{\'validate-one-required-by-name\':true}"'; }?>
52+
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>
53+
-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
54+
<?php if ($_option->getRequired()) {
55+
echo 'data-validate="{\'validate-one-required-by-name\':true}"';
56+
} ?>
5457
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
5558
data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
56-
<?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?>
57-
<?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?>
58-
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"/>
59+
<?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?>
60+
<?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?>
61+
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
62+
data-errors-message-box="#validation-message-box-radio"/>
5963
<label class="label"
60-
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>">
64+
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>
65+
-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>">
6166
<span><?= /* @noEscape */ $block->getSelectionTitlePrice($_selection) ?></span>
6267
<br/>
6368
<?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selection) ?>
6469
</label>
6570
</div>
6671
<?php endforeach; ?>
6772
<div id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></div>
73+
<div id="validation-message-box-radio"></div>
6874
<?php endif; ?>
6975
<div class="field qty qty-holder">
7076
<label class="label" for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input">
7177
<span><?= $block->escapeHtml(__('Quantity')) ?></span>
7278
</label>
7379
<div class="control">
7480
<input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?>
75-
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"
76-
class="input-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
77-
type="number"
78-
min="0"
79-
data-validate="<?= $block->escapeHtmlAttr($viewModel->getQuantityValidators()) ?>"
80-
name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
81-
data-selector="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
82-
value="<?= $block->escapeHtmlAttr($_defaultQty) ?>"/>
81+
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"
82+
class="input-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
83+
type="number"
84+
min="0"
85+
data-validate="<?= $block->escapeHtmlAttr($viewModel->getQuantityValidators()) ?>"
86+
name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
87+
data-selector="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
88+
value="<?= $block->escapeHtmlAttr($_defaultQty) ?>"/>
8389
</div>
8490
</div>
8591
</div>

app/code/Magento/Sales/Model/Order/Creditmemo/Total/Tax.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ public function collect(Creditmemo $creditmemo)
134134
$baseShippingDiscountTaxCompensationAmount = 0;
135135
$shippingDelta = $baseOrderShippingAmount - $baseOrderShippingRefundedAmount;
136136

137-
if ($shippingDelta > $creditmemo->getBaseShippingAmount() ||
138-
$this->isShippingIncludeTaxWithTaxAfterDiscount($order->getStoreId())) {
137+
if ($orderShippingAmount > 0 && ($shippingDelta > $creditmemo->getBaseShippingAmount() ||
138+
$this->isShippingIncludeTaxWithTaxAfterDiscount($order->getStoreId()))) {
139139
$part = $creditmemo->getShippingAmount() / $orderShippingAmount;
140140
$basePart = $creditmemo->getBaseShippingAmount() / $baseOrderShippingAmount;
141141
$shippingTaxAmount = $order->getShippingTaxAmount() * $part;

app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/TaxTest.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,67 @@ public function collectDataProvider()
806806
],
807807
];
808808

809+
// scenario 8: 1 items, 1 invoiced, shipping covered by cart rule
810+
// shipping amount is 0 i.e., free shipping
811+
$result['creditmemo_with_discount_for_entire_shipping_all_prices_including_tax_free_shipping'] = [
812+
'order_data' => [
813+
'data_fields' => [
814+
'shipping_tax_amount' => 0,
815+
'base_shipping_tax_amount' => 0,
816+
'shipping_discount_tax_compensation_amount' => 1.36,
817+
'base_shipping_discount_tax_compensation_amount' => 1.36,
818+
'tax_amount' => 1.22,
819+
'base_tax_amount' => 1.22,
820+
'tax_invoiced' => 1.22,
821+
'base_tax_invoiced' => 1.22,
822+
'shipping_amount' => 0,
823+
'shipping_discount_amount' => 15,
824+
'base_shipping_amount' => 13.64,
825+
'discount_tax_compensation_invoiced' => 1.73,
826+
'base_discount_tax_compensation_invoiced' => 1.73
827+
],
828+
],
829+
'creditmemo_data' => [
830+
'items' => [
831+
'item_1' => [
832+
'order_item' => [
833+
'qty_invoiced' => 1,
834+
'tax_invoiced' => 1.22,
835+
'base_tax_invoiced' => 1.22,
836+
'discount_tax_compensation_amount' => 1.73,
837+
'base_discount_tax_compensation_amount' => 1.73,
838+
'discount_tax_compensation_invoiced' => 1.73,
839+
'base_discount_tax_compensation_invoiced' => 1.73
840+
],
841+
'is_last' => true,
842+
'qty' => 1,
843+
],
844+
],
845+
'is_last' => true,
846+
'data_fields' => [
847+
'shipping_amount' => 0,
848+
'base_shipping_amount' => 0,
849+
'grand_total' => 10.45,
850+
'base_grand_total' => 10.45,
851+
'tax_amount' => 0,
852+
'base_tax_amount' => 0
853+
],
854+
],
855+
'expected_results' => [
856+
'creditmemo_items' => [
857+
'item_1' => [
858+
'tax_amount' => 1.22,
859+
'base_tax_amount' => 1.22,
860+
],
861+
],
862+
'creditmemo_data' => [
863+
'grand_total' => 14.76,
864+
'base_grand_total' => 13.4,
865+
'tax_amount' => 1.22,
866+
'base_tax_amount' => 1.22,
867+
],
868+
],
869+
];
809870
return $result;
810871
}
811872

composer.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/web/jquery/jquery.validate.js

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*!
2-
* jQuery Validation Plugin v1.19.3
2+
* jQuery Validation Plugin v1.19.5
33
*
44
* https://jqueryvalidation.org/
55
*
6-
* Copyright (c) 2021 Jörn Zaefferer
6+
* Copyright (c) 2022 Jörn Zaefferer
77
* Released under the MIT license
88
*/
99
(function( factory ) {
@@ -378,7 +378,6 @@
378378
dateISO: "Please enter a valid date (ISO).",
379379
number: "Please enter a valid number.",
380380
digits: "Please enter only digits.",
381-
creditcard: "Please enter a valid credit card number.",
382381
equalTo: "Please enter the same value again.",
383382
maxlength: $.validator.format( "Please enter no more than {0} characters." ),
384383
minlength: $.validator.format( "Please enter at least {0} characters." ),
@@ -784,7 +783,7 @@
784783
normalizer = this.settings.normalizer;
785784
}
786785

787-
// If normalizer is defined, then call it to retrieve the changed value instead
786+
// If normalizer is defined, then call it to the changed value instead
788787
// of using the real one.
789788
// Note that `this` in the normalizer is `element`.
790789
if ( normalizer ) {
@@ -875,13 +874,13 @@
875874
}
876875

877876
var message = this.findDefined(
878-
this.customMessage( element.name, rule.method ),
879-
this.customDataMessage( element, rule.method ),
877+
this.customMessage( element.name, rule.method ),
878+
this.customDataMessage( element, rule.method ),
880879

881-
// 'title' is never undefined, so handle empty string as undefined
882-
!this.settings.ignoreTitle && element.title || undefined,
883-
$.validator.messages[ rule.method ],
884-
"<strong>Warning: No message defined for " + element.name + "</strong>"
880+
// 'title' is never undefined, so handle empty string as undefined
881+
!this.settings.ignoreTitle && element.title || undefined,
882+
$.validator.messages[ rule.method ],
883+
"<strong>Warning: No message defined for " + element.name + "</strong>"
885884
),
886885
theregex = /\$?\{(\d+)\}/g;
887886
if ( typeof message === "function" ) {
@@ -982,7 +981,7 @@
982981
if ( this.labelContainer.length ) {
983982
this.labelContainer.append( place );
984983
} else if ( this.settings.errorPlacement ) {
985-
this.settings.errorPlacement( place, $( element ) );
984+
this.settings.errorPlacement.call( this, place, $( element ) );
986985
} else {
987986
place.insertAfter( element );
988987
}
@@ -1052,7 +1051,11 @@
10521051
// meta-characters that should be escaped in order to be used with JQuery
10531052
// as a literal part of a name/id or any selector.
10541053
escapeCssMeta: function( string ) {
1055-
return (string || '').replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
1054+
if ( string === undefined ) {
1055+
return "";
1056+
}
1057+
1058+
return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
10561059
},
10571060

10581061
idOrName: function( element ) {
@@ -1128,8 +1131,8 @@
11281131
}
11291132
delete this.pending[ element.name ];
11301133
$( element ).removeClass( this.settings.pendingClass );
1131-
if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
1132-
$( this.currentForm ).submit();
1134+
if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() && this.pendingRequest === 0 ) {
1135+
$( this.currentForm ).trigger( "submit" );
11331136

11341137
// Remove the hidden input that was used as a replacement for the
11351138
// missing submit button. The hidden input is added by `handle()`
@@ -1234,7 +1237,7 @@
12341237

12351238
// Exception: the jquery validate 'range' method
12361239
// does not test for the html5 'range' type
1237-
rules[ method ] = true;
1240+
rules[ type === "date" ? "dateISO" : method ] = true;
12381241
}
12391242
},
12401243

@@ -1283,7 +1286,7 @@
12831286
$(element).metadata()[meta] :
12841287
$(element).metadata();
12851288
},
1286-
1289+
12871290
dataRules: function( element ) {
12881291
var rules = {},
12891292
$element = $( element ),
@@ -1443,7 +1446,7 @@
14431446
// https://gist.github.com/dperini/729294
14441447
// see also https://mathiasbynens.be/demo/url-regex
14451448
// modified to allow protocol-relative URLs
1446-
return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value );
1449+
return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value );
14471450
},
14481451

14491452
// https://jqueryvalidation.org/date-method/

lib/web/moment.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)