Skip to content

Commit

Permalink
Merge branch '2.4-develop' into cache-config-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Knase authored Jun 23, 2020
2 parents cc2c5b9 + 02b87f6 commit 26b41af
Show file tree
Hide file tree
Showing 16 changed files with 317 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ public function getFailedItems()
}
}

/**
* Clear validation messages to prevent wrong validation for subsequent price update.
* Work around for backward compatible changes.
*/
$this->failedItems = [];

return $failedItems;
}
}
5 changes: 5 additions & 0 deletions app/code/Magento/Catalog/etc/db_schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
<index referenceId="CATALOG_PRODUCT_ENTITY_INT_STORE_ID" indexType="btree">
<column name="store_id"/>
</index>
<index referenceId="CATALOG_PRODUCT_ENTITY_INT_ATTRIBUTE_ID_STORE_ID_VALUE" indexType="btree">
<column name="attribute_id"/>
<column name="store_id"/>
<column name="value"/>
</index>
</table>
<table name="catalog_product_entity_text" resource="default" engine="innodb"
comment="Catalog Product Text Attribute Backend Table">
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Catalog/etc/db_schema_whitelist.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
},
"index": {
"CATALOG_PRODUCT_ENTITY_INT_ATTRIBUTE_ID": true,
"CATALOG_PRODUCT_ENTITY_INT_STORE_ID": true
"CATALOG_PRODUCT_ENTITY_INT_STORE_ID": true,
"CATALOG_PRODUCT_ENTITY_INT_ATTRIBUTE_ID_STORE_ID_VALUE": true
},
"constraint": {
"PRIMARY": true,
Expand Down
58 changes: 35 additions & 23 deletions app/code/Magento/Contact/view/frontend/templates/form.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* See COPYING.txt for license details.
*/

// phpcs:disable Magento2.Templates.ThisInTemplate
// phpcs:disable Generic.Files.LineLength.TooLong

/** @var \Magento\Contact\Block\ContactForm $block */
/** @var \Magento\Contact\ViewModel\UserDataProvider $viewModel */

Expand All @@ -23,35 +26,35 @@ $viewModel = $block->getViewModel();
<div class="field name required">
<label class="label" for="name"><span><?= $block->escapeHtml(__('Name')) ?></span></label>
<div class="control">
<input name="name"
id="name"
title="<?= $block->escapeHtmlAttr(__('Name')) ?>"
value="<?= $block->escapeHtmlAttr($viewModel->getUserName()) ?>"
class="input-text"
type="text"
<input name="name"
id="name"
title="<?= $block->escapeHtmlAttr(__('Name')) ?>"
value="<?= $block->escapeHtmlAttr($viewModel->getUserName()) ?>"
class="input-text"
type="text"
data-validate="{required:true}"/>
</div>
</div>
<div class="field email required">
<label class="label" for="email"><span><?= $block->escapeHtml(__('Email')) ?></span></label>
<div class="control">
<input name="email"
id="email"
title="<?= $block->escapeHtmlAttr(__('Email')) ?>"
value="<?= $block->escapeHtmlAttr($viewModel->getUserEmail()) ?>"
class="input-text"
type="email"
<input name="email"
id="email"
title="<?= $block->escapeHtmlAttr(__('Email')) ?>"
value="<?= $block->escapeHtmlAttr($viewModel->getUserEmail()) ?>"
class="input-text"
type="email"
data-validate="{required:true, 'validate-email':true}"/>
</div>
</div>
<div class="field telephone">
<label class="label" for="telephone"><span><?= $block->escapeHtml(__('Phone Number')) ?></span></label>
<div class="control">
<input name="telephone"
id="telephone"
title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>"
value="<?= $block->escapeHtmlAttr($viewModel->getUserTelephone()) ?>"
class="input-text"
<input name="telephone"
id="telephone"
title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>"
value="<?= $block->escapeHtmlAttr($viewModel->getUserTelephone()) ?>"
class="input-text"
type="tel" />
</div>
</div>
Expand All @@ -60,12 +63,12 @@ $viewModel = $block->getViewModel();
<span><?= $block->escapeHtml(__('What’s on your mind?')) ?></span>
</label>
<div class="control">
<textarea name="comment"
id="comment"
title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>"
class="input-text"
cols="5"
rows="3"
<textarea name="comment"
id="comment"
title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>"
class="input-text"
cols="5"
rows="3"
data-validate="{required:true}"><?= $block->escapeHtml($viewModel->getUserComment()) ?>
</textarea>
</div>
Expand All @@ -81,3 +84,12 @@ $viewModel = $block->getViewModel();
</div>
</div>
</form>
<script type="text/x-magento-init">
{
"*": {
"Magento_Customer/js/block-submit-on-send": {
"formId": "contact-form"
}
}
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @var $block \Magento\Customer\Block\Account\Forgotpassword
*/

// phpcs:disable Generic.Files.LineLength.TooLong

/** @var \Magento\Customer\Block\Account\Forgotpassword $block */
?>
<form class="form password forget"
Expand All @@ -32,3 +34,12 @@
</div>
</div>
</form>
<script type="text/x-magento-init">
{
"*": {
"Magento_Customer/js/block-submit-on-send": {
"formId": "form-validate"
}
}
}
</script>
24 changes: 22 additions & 2 deletions app/code/Magento/Customer/view/frontend/templates/form/login.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* See COPYING.txt for license details.
*/

// phpcs:disable Generic.Files.LineLength.TooLong

/** @var \Magento\Customer\Block\Form\Login $block */
?>
<div class="block block-customer-login">
Expand All @@ -22,13 +24,22 @@
<div class="field email required">
<label class="label" for="email"><span><?= $block->escapeHtml(__('Email')) ?></span></label>
<div class="control">
<input name="login[username]" value="<?= $block->escapeHtmlAttr($block->getUsername()) ?>" <?php if ($block->isAutocompleteDisabled()) : ?> autocomplete="off"<?php endif; ?> id="email" type="email" class="input-text" title="<?= $block->escapeHtmlAttr(__('Email')) ?>" data-mage-init='{"mage/trim-input":{}}' data-validate="{required:true, 'validate-email':true}">
<input name="login[username]" value="<?= $block->escapeHtmlAttr($block->getUsername()) ?>"
<?php if ($block->isAutocompleteDisabled()): ?> autocomplete="off"<?php endif; ?>
id="email" type="email" class="input-text"
title="<?= $block->escapeHtmlAttr(__('Email')) ?>"
data-mage-init='{"mage/trim-input":{}}'
data-validate="{required:true, 'validate-email':true}">
</div>
</div>
<div class="field password required">
<label for="pass" class="label"><span><?= $block->escapeHtml(__('Password')) ?></span></label>
<div class="control">
<input name="login[password]" type="password" <?php if ($block->isAutocompleteDisabled()) : ?> autocomplete="off"<?php endif; ?> class="input-text" id="pass" title="<?= $block->escapeHtmlAttr(__('Password')) ?>" data-validate="{required:true}">
<input name="login[password]" type="password"
<?php if ($block->isAutocompleteDisabled()): ?> autocomplete="off"<?php endif; ?>
class="input-text" id="pass"
title="<?= $block->escapeHtmlAttr(__('Password')) ?>"
data-validate="{required:true}">
</div>
</div>
<?= $block->getChildHtml('form_additional_info') ?>
Expand All @@ -41,3 +52,12 @@
</div>
</div>

<script type="text/x-magento-init">
{
"*": {
"Magento_Customer/js/block-submit-on-send": {
"formId": "login-form"
}
}
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,6 @@ require([
ignore: ignore ? ':hidden:not(' + ignore + ')' : ':hidden'
<?php endif ?>
}).find('input:text').attr('autocomplete', 'off');
dataForm.submit(function () {
$(this).find(':submit').attr('disabled', 'disabled');
});
dataForm.bind("invalid-form.validate", function () {
$(this).find(':submit').prop('disabled', false);
});

});
</script>
<?php if ($block->getShowAddressFields()): ?>
Expand Down Expand Up @@ -337,6 +330,11 @@ require([
"passwordStrengthIndicator": {
"formSelector": "form.form-create-account"
}
},
"*": {
"Magento_Customer/js/block-submit-on-send": {
"formId": "form-validate"
}
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

define([
'jquery',
'mage/mage'
], function ($) {
'use strict';

return function (config) {
var dataForm = $('#' + config.formId);

dataForm.submit(function () {
$(this).find(':submit').attr('disabled', 'disabled');
});
dataForm.bind('invalid-form.validate', function () {
$(this).find(':submit').prop('disabled', false);
});
};
});
12 changes: 11 additions & 1 deletion app/code/Magento/GoogleOptimizer/Observer/AbstractSave.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\GoogleOptimizer\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

/**
* Abstract entity for saving codes
*
* @api
* @since 100.0.2
*/
Expand Down Expand Up @@ -96,7 +100,9 @@ protected function _processCode()
$this->_initRequestParams();

if ($this->_isNewCode()) {
$this->_saveCode();
if (!$this->_isEmptyCode()) {
$this->_saveCode();
}
} else {
$this->_loadCode();
if ($this->_isEmptyCode()) {
Expand Down Expand Up @@ -185,6 +191,8 @@ protected function _deleteCode()
}

/**
* Check data availability
*
* @return bool
*/
private function isDataAvailable()
Expand All @@ -194,6 +202,8 @@ private function isDataAvailable()
}

/**
* Get request data
*
* @return mixed
*/
private function getRequestData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,39 @@ public function testCreatingCodeIfRequestIsValid()
$this->_modelObserver->execute($this->_eventObserverMock);
}

/**
* Test that code is not saving when request is empty
*
* @return void
*/
public function testCreatingCodeIfRequestIsEmpty(): void
{
$this->_helperMock->expects(
$this->once()
)->method(
'isGoogleExperimentActive'
)->with(
$this->_storeId
)->willReturn(
true
);

$this->_requestMock->expects(
$this->exactly(3)
)->method(
'getParam'
)->with(
'google_experiment'
)->willReturn(
['code_id' => '', 'experiment_script' => '']
);

$this->_codeMock->expects($this->never())->method('addData');
$this->_codeMock->expects($this->never())->method('save');

$this->_modelObserver->execute($this->_eventObserverMock);
}

/**
* @param array $params
* @dataProvider dataProviderWrongRequestForCreating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@
</form>
</div>
</div>
<script type="text/x-magento-init">
{
"*": {
"Magento_Customer/js/block-submit-on-send": {
"formId": "newsletter-validate-detail"
}
}
}
</script>
4 changes: 3 additions & 1 deletion app/code/Magento/Quote/Model/Quote/Item/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ public function prepare(Item $item, DataObject $request, Product $candidate): vo
$item->addQty($candidate->getCartQty());

$customPrice = $request->getCustomPrice();
$item->setPrice($candidate->getFinalPrice());
if (!$item->getParentItem() || $item->getParentItem()->isChildrenCalculated()) {
$item->setPrice($candidate->getFinalPrice());
}
if (!empty($customPrice)) {
$item->setCustomPrice($customPrice);
$item->setOriginalCustomPrice($customPrice);
Expand Down
Loading

0 comments on commit 26b41af

Please sign in to comment.