Skip to content

Commit 3ea2662

Browse files
Merge pull request #9298 from magento-gl/spartans_pr_11102024
[Spartans] Bugfix Delivery
2 parents bafba2a + 01562f7 commit 3ea2662

File tree

7 files changed

+177
-126
lines changed

7 files changed

+177
-126
lines changed

app/code/Magento/Bundle/view/frontend/requirejs-config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,12 @@ var config = {
1111
slide: 'Magento_Bundle/js/slide',
1212
productSummary: 'Magento_Bundle/js/product-summary'
1313
}
14+
},
15+
config: {
16+
mixins: {
17+
'mage/validation': {
18+
'Magento_Bundle/js/validation': true
19+
}
20+
}
1421
}
1522
};

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

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,65 @@
55
*/
66
?>
77

8-
<?php /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Checkbox */ ?>
8+
<?php
9+
/**
10+
* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Checkbox
11+
* @var \Magento\Framework\Escaper $escaper
12+
*/
13+
?>
914
<?php $_option = $block->getOption() ?>
1015
<?php $_selections = $_option->getSelections() ?>
11-
<?php $inputClass = 'checkbox product bundle option bundle-option-' . $block->escapeHtmlAttr($_option->getId()) ?>
12-
<?php $inputId = 'bundle-option-' . $block->escapeHtmlAttr($_option->getId()) ?>
13-
<?php $inputName = 'bundle_option[' . $block->escapeHtmlAttr($_option->getId()) . ']' ?>
16+
<?php $inputClass = 'checkbox product bundle option bundle-option-' . $escaper->escapeHtmlAttr($_option->getId()) ?>
17+
<?php $inputId = 'bundle-option-' . $escaper->escapeHtmlAttr($_option->getId()) ?>
18+
<?php $inputName = 'bundle_option[' . $escaper->escapeHtmlAttr($_option->getId()) . ']' ?>
1419
<?php $dataValidation = 'data-validate="{\'validate-one-required-by-name\':\'input[name^=&quot;bundle_option[' .
15-
$block->escapeHtmlAttr($_option->getId()) . ']&quot;]:checked\'}"' ?>
20+
$escaper->escapeHtmlAttr($_option->getId()) . ']&quot;]:checked\'}"' ?>
1621

1722
<div class="field option <?= ($_option->getRequired()) ? ' required': '' ?>">
1823
<label class="label">
19-
<span><?= $block->escapeHtml($_option->getTitle()) ?></span>
24+
<span><?= $escaper->escapeHtml($_option->getTitle()) ?></span>
2025
</label>
2126
<div class="control">
2227
<div class="nested options-list">
2328
<?php if ($block->showSingle()): ?>
2429
<?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?>
2530
<?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selections[0]) ?>
2631
<input type="hidden"
27-
class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> product bundle option"
28-
name="bundle_option[<?= $block->escapeHtml($_option->getId()) ?>]"
29-
value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"/>
32+
class="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?> product bundle option"
33+
name="bundle_option[<?= $escaper->escapeHtml($_option->getId()) ?>]"
34+
value="<?= $escaper->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"/>
3035
<?php else: ?>
3136
<?php foreach ($_selections as $selection): ?>
3237
<?php $sectionId = $selection->getSelectionId() ?>
3338
<div class="field choice">
3439
<input class="<?=/* @noEscape */ $inputClass ?> change-container-classname"
35-
id="<?=/* @noEscape */ $inputId . '-' . $block->escapeHtmlAttr($sectionId)?>"
36-
type="checkbox"
37-
<?php if ($_option->getRequired()): ?>
38-
<?= /* @noEscape */ $dataValidation ?>
39-
<?php endif;?>
40-
name="<?=/* @noEscape */ $inputName .'['. $block->escapeHtmlAttr($sectionId)?>]"
41-
data-selector="<?= /* @noEscape */ $inputName.'['.$block->escapeHtmlAttr($sectionId)?>]"
42-
<?php if ($block->isSelected($selection)): ?>
43-
<?= ' checked="checked"' ?>
44-
<?php endif; ?>
45-
<?php if (!$selection->isSaleable()): ?>
46-
<?= ' disabled="disabled"' ?>
47-
<?php endif; ?>
48-
value="<?= $block->escapeHtmlAttr($sectionId) ?>"
49-
data-errors-message-box="#validation-message-box"/>
40+
id="<?=/* @noEscape */ $inputId . '-' . $escaper->escapeHtmlAttr($sectionId)?>"
41+
type="checkbox"
42+
<?php if ($_option->getRequired()): ?>
43+
<?= /* @noEscape */ $dataValidation ?>
44+
<?php endif;?>
45+
name="<?=/* @noEscape */ $inputName .'['. $escaper->escapeHtmlAttr($sectionId)?>]"
46+
data-selector="<?= /* @noEscape */ $inputName.'['.$escaper->escapeHtmlAttr($sectionId)?>]"
47+
<?php if ($block->isSelected($selection)): ?>
48+
<?= ' checked="checked"' ?>
49+
<?php endif; ?>
50+
<?php if (!$selection->isSaleable()): ?>
51+
<?= ' disabled="disabled"' ?>
52+
<?php endif; ?>
53+
value="<?= $escaper->escapeHtmlAttr($sectionId) ?>"
54+
data-errors-msg-box="#validation-message-box-<?=$escaper->escapeHtmlAttr($_option->getId())?>"/>
5055
<label class="label"
51-
for="<?= /* @noEscape */ $inputId . '-' . $block->escapeHtmlAttr($sectionId) ?>">
56+
for="<?= /* @noEscape */ $inputId . '-' . $escaper->escapeHtmlAttr($sectionId) ?>">
5257
<span><?= /* @noEscape */ $block->getSelectionQtyTitlePrice($selection) ?></span>
5358
<br/>
5459
<?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($selection) ?>
5560
</label>
5661
</div>
62+
5763
<?php endforeach; ?>
58-
<div id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></div>
59-
<div id="validation-message-box"></div>
6064
<?php endif; ?>
6165
</div>
66+
<div id="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>-container"></div>
67+
<div id="validation-message-box-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>"></div>
6268
</div>
6369
</div>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
define([
2+
'jquery',
3+
'jquery-ui-modules/widget'
4+
], function ($) {
5+
'use strict';
6+
var enhancedMageValidation = {
7+
/**
8+
* @param {*} error
9+
* @param {*} element
10+
*/
11+
options: {
12+
errorPlacement: function (error, element) {
13+
var errorPlacement = element,
14+
fieldWrapper,messageBox;
15+
16+
// logic for date-picker error placement
17+
if (element.hasClass('_has-datepicker')) {
18+
errorPlacement = element.siblings('button');
19+
}
20+
// logic for field wrapper
21+
fieldWrapper = element.closest('.addon');
22+
23+
if (fieldWrapper.length) {
24+
errorPlacement = fieldWrapper.after(error);
25+
}
26+
//logic for checkboxes/radio
27+
if (element.is(':checkbox') || element.is(':radio')) {
28+
errorPlacement = element.parents('.control').children().last();
29+
30+
//fallback if group does not have .control parent
31+
if (!errorPlacement.length) {
32+
errorPlacement = element.siblings('label').last();
33+
}
34+
}
35+
if (element.attr('data-errors-msg-box')) {
36+
messageBox = $(element.attr('data-errors-msg-box'));
37+
messageBox.html(error);
38+
return;
39+
}
40+
//logic for control with tooltip
41+
if (element.siblings('.tooltip').length) {
42+
errorPlacement = element.siblings('.tooltip');
43+
}
44+
//logic for select with tooltip in after element
45+
if (element.next().find('.tooltip').length) {
46+
errorPlacement = element.next();
47+
}
48+
errorPlacement.after(error);
49+
}
50+
51+
}
52+
};
53+
54+
return function (mageValidation) {
55+
$.widget('mage.validation', mageValidation, enhancedMageValidation);
56+
return $.mage.validation;
57+
};
58+
});

app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function _construct()
6464
*/
6565
public function prepareCondition($attribute, $value)
6666
{
67-
$condition = false;
67+
$condition = $value;
6868

6969
if (is_array($value)) {
7070
if ($attribute->getBackendType() == 'varchar') { // multiselect

app/code/Magento/Customer/view/adminhtml/web/js/form/element/region.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ define([
2525
countryId = this.source.data.country_id,
2626
hasRegionList = indexedOptionsArray.some(option => option.country_id === countryId);
2727

28-
this.source.set(
29-
this.regionScope,
30-
hasRegionList
31-
? parseFloat(value) ? this.indexedOptions?.[value]?.label || '' : ''
32-
: this.source.data?.region || ''
33-
);
28+
// Clear the region field when the country changes
29+
this.source.set(this.regionScope, '');
30+
31+
if (hasRegionList) {
32+
this.source.set(
33+
this.regionScope,
34+
parseFloat(value) ? this.indexedOptions?.[value]?.label || '' : ''
35+
);
36+
}
3437
}
3538
});
3639
});

lib/internal/Magento/Framework/Amqp/Connection/Factory.php

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
namespace Magento\Framework\Amqp\Connection;
99

1010
use Magento\Framework\App\ObjectManager;
11+
use PhpAmqpLib\Connection\AMQPConnectionFactory;
12+
use PhpAmqpLib\Connection\AMQPConnectionConfig;
1113
use PhpAmqpLib\Connection\AbstractConnection;
12-
use PhpAmqpLib\Connection\AMQPSSLConnection;
13-
use PhpAmqpLib\Connection\AMQPStreamConnection;
1414

1515
/**
1616
* Create connection based on options.
@@ -20,25 +20,57 @@ class Factory
2020
/**
2121
* Create connection according to given options.
2222
*
23+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
24+
* @SuppressWarnings(PHPMD.NPathComplexity)
2325
* @param FactoryOptions $options
2426
* @return AbstractConnection
2527
*/
2628
public function create(FactoryOptions $options): AbstractConnection
2729
{
28-
$connectionType = $options->isSslEnabled() ? AMQPSSLConnection::class : AMQPStreamConnection::class;
29-
$parameters = [
30-
'host' => $options->getHost(),
31-
'port' => $options->getPort(),
32-
'user' => $options->getUsername(),
33-
'password' => $options->getPassword(),
34-
'vhost' => $options->getVirtualHost() !== null ? $options->getVirtualHost() : '/',
35-
];
30+
$config = ObjectManager::getInstance()->create(AMQPConnectionConfig::class);
3631

32+
// Set host, port, user, password, and vhost from options
33+
$config->setHost($options->getHost());
34+
$config->setPort((int)$options->getPort());
35+
$config->setUser($options->getUsername());
36+
$config->setPassword($options->getPassword());
37+
$config->setVhost($options->getVirtualHost() !== null ? $options->getVirtualHost() : '/');
38+
39+
// Set SSL options if SSL is enabled
3740
if ($options->isSslEnabled()) {
38-
$parameters['ssl_options'] = $options->getSslOptions() !== null
39-
? $options->getSslOptions()
40-
: ['verify_peer' => true];
41+
$config->setIsSecure(true);
42+
$sslOptions = $options->getSslOptions();
43+
if ($sslOptions) {
44+
if (isset($sslOptions['cafile'])) {
45+
$config->setSslCaCert($sslOptions['cafile']);
46+
}
47+
if (isset($sslOptions['local_cert'])) {
48+
$config->setSslCert($sslOptions['local_cert']);
49+
}
50+
if (isset($sslOptions['local_pk'])) {
51+
$config->setSslKey($sslOptions['local_pk']);
52+
}
53+
if (isset($sslOptions['verify_peer'])) {
54+
$config->setSslVerify($sslOptions['verify_peer']);
55+
}
56+
if (isset($sslOptions['verify_peer_name'])) {
57+
$config->setSslVerifyName($sslOptions['verify_peer_name']);
58+
}
59+
if (isset($sslOptions['passphrase'])) {
60+
$config->setSslPassPhrase($sslOptions['passphrase']);
61+
}
62+
if (isset($sslOptions['ciphers'])) {
63+
$config->setSslCiphers($sslOptions['ciphers']);
64+
}
65+
} else {
66+
// Default SSL verification option
67+
$config->setSslVerify(true);
68+
}
69+
} else {
70+
$config->setIsSecure(false);
4171
}
42-
return ObjectManager::getInstance()->create($connectionType, $parameters);
72+
73+
// Use the connection factory to create the connection
74+
return AMQPConnectionFactory::create($config);
4375
}
4476
}

0 commit comments

Comments
 (0)