Skip to content

Commit 7482199

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #18917: Fixed-Global-search icon misaligned (by @speedy008) - #18591: [Backport] Fix SKU limit in import new products (by @ravi-chandra3197) - #18862: [Backport] Adding trimming sku value function to sku backend model. (by @gelanivishal) - #18865: fixed issue #18458 : Alert widget gets close when click anywhere on screen #18576 (by @Shubham-Webkul) - #18886: [Backport] fixed Translation issue send-friend in send.phtml (by @rahulwebkul) Fixed GitHub Issues: - #18913: Global-search icon misaligned (reported by @speedy008) has been fixed in #18917 by @speedy008 in 2.2-develop branch Related commits: 1. 3cbc255 - #17865: import new products via csv: products are created with empty value when strings are too long (reported by @LouNik1984) has been fixed in #18591 by @ravi-chandra3197 in 2.2-develop branch Related commits: 1. e59dee0 2. a10f074 3. ad68105 - #12300: SKU values are not trimmed with the space. (reported by @ShaileshChauhan92) has been fixed in #18862 by @gelanivishal in 2.2-develop branch Related commits: 1. 109a27e - #16572: Trim whitespace on SKU when saving product (reported by @Zyles) has been fixed in #18862 by @gelanivishal in 2.2-develop branch Related commits: 1. 109a27e - #18458: Magento version 2.2.6 Alert widget gets close when click anywhere on screen (reported by @asgarh) has been fixed in #18865 by @Shubham-Webkul in 2.2-develop branch Related commits: 1. f59bc17 2. 06b243f 3. c3bc361 4. 26a9520 5. 87167e7 6. c6586ab 7. d40a26c 8. 84c7391 9. e1483f6 10. 3b2e4e4 11. 7dc2d1b - #18779: Translation issue send-friend in sendphtml (reported by @Franzld) has been fixed in #18886 by @rahulwebkul in 2.2-develop branch Related commits: 1. 443e681
2 parents adda280 + a8a1094 commit 7482199

File tree

11 files changed

+39
-9
lines changed

11 files changed

+39
-9
lines changed

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ protected function _generateUniqueSku($object)
9797
public function beforeSave($object)
9898
{
9999
$this->_generateUniqueSku($object);
100+
$this->trimValue($object);
100101
return parent::beforeSave($object);
101102
}
102103

@@ -127,4 +128,17 @@ protected function _getLastSimilarAttributeValueIncrement($attribute, $object)
127128
$data = $connection->fetchOne($select, $bind);
128129
return abs((int)str_replace($value, '', $data));
129130
}
131+
132+
/**
133+
* @param Product $object
134+
* @return void
135+
*/
136+
private function trimValue($object)
137+
{
138+
$attrCode = $this->getAttribute()->getAttributeCode();
139+
$value = $object->getData($attrCode);
140+
if ($value) {
141+
$object->setData($attrCode, trim($value));
142+
}
143+
}
130144
}

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ protected function customizeNameListeners(array $meta)
373373
$skuPath . static::META_CONFIG_PATH,
374374
$meta,
375375
[
376-
'autoImportIfEmpty' => true
376+
'autoImportIfEmpty' => true,
377+
'validation' => ['no-marginal-whitespace' => true]
377378
]
378379
);
379380

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\CatalogImportExport\Model\Import\Product;
99
use Magento\Framework\Validator\AbstractValidator;
10+
use Magento\Catalog\Model\Product\Attribute\Backend\Sku;
1011

1112
/**
1213
* Class Validator
@@ -69,6 +70,8 @@ protected function textValidation($attrCode, $type)
6970
$val = $this->string->cleanString($this->_rowData[$attrCode]);
7071
if ($type == 'text') {
7172
$valid = $this->string->strlen($val) < Product::DB_MAX_TEXT_LENGTH;
73+
} else if ($attrCode == Product::COL_SKU) {
74+
$valid = $this->string->strlen($val) <= SKU::SKU_MAX_LENGTH;
7275
} else {
7376
$valid = $this->string->strlen($val) < Product::DB_MAX_VARCHAR_LENGTH;
7477
}

app/code/Magento/SendFriend/view/frontend/templates/send.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
<div class="secondary">
1818
<button type="button" id="btn-remove<%- data._index_ %>" class="action remove"
1919
title="<?= $block->escapeHtmlAttr(__('Remove Recipent')) ?>">
20-
<span><?= $block->escapeJs($block->escapeHtml(__('Remove'))) ?></span>
20+
<span><?= $block->escapeHtml(__('Remove')) ?></span>
2121
</button>
2222
</div>
2323
</div>
2424
<fieldset class="fieldset">
2525
<div class="field name required">
26-
<label for="recipients-name<%- data._index_ %>" class="label"><span><?= $block->escapeJs($block->escapeHtml(__('Name'))) ?></span></label>
26+
<label for="recipients-name<%- data._index_ %>" class="label"><span><?= $block->escapeHtml(__('Name')) ?></span></label>
2727
<div class="control">
2828
<input name="recipients[name][<%- data._index_ %>]" type="text" title="<?= $block->escapeHtmlAttr(__('Name')) ?>" class="input-text"
2929
id="recipients-name<%- data._index_ %>" data-validate="{required:true}"/>
3030
</div>
3131
</div>
3232

3333
<div class="field email required">
34-
<label for="recipients-email<%- data._index_ %>" class="label"><span><?= $block->escapeJs($block->escapeHtml(__('Email'))) ?></span></label>
34+
<label for="recipients-email<%- data._index_ %>" class="label"><span><?= $block->escapeHtml(__('Email')) ?></span></label>
3535
<div class="control">
3636
<input name="recipients[email][<%- data._index_ %>]" title="<?= $block->escapeHtmlAttr(__('Email')) ?>"
3737
id="recipients-email<%- data._index_ %>" type="email" class="input-text"

app/code/Magento/Ui/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Keyword,Keyword
5858
"Letters, numbers, spaces or underscores only please","Letters, numbers, spaces or underscores only please"
5959
"Letters only please","Letters only please"
6060
"No white space please","No white space please"
61+
"No marginal white space please","No marginal white space please"
6162
"Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx","Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx"
6263
"A positive or negative non-decimal number please","A positive or negative non-decimal number please"
6364
"The specified vehicle identification number (VIN) is invalid.","The specified vehicle identification number (VIN) is invalid."

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ define([
115115
},
116116
$.mage.__('No white space please')
117117
],
118+
'no-marginal-whitespace': [
119+
function (value) {
120+
return !/^\s+|\s+$/i.test(value);
121+
},
122+
$.mage.__('No marginal white space please')
123+
],
118124
'zip-range': [
119125
function (value) {
120126
return utils.isEmpty(value) || /^90[2-5]-\d{2}-\d{4}$/.test(value);

app/code/Magento/Ui/view/base/web/js/modal/modal-component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ define([
9393
* @returns {Object} Chainable.
9494
*/
9595
initModalEvents: function () {
96-
this.options.keyEventHandlers.escapeKey = this.options.outerClickHandler = this[this.onCancel].bind(this);
96+
this.options.keyEventHandlers.escapeKey = this[this.onCancel].bind(this);
9797

9898
return this;
9999
},

app/code/Magento/Ui/view/base/web/js/modal/modal.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,7 @@ define([
424424
* Creates overlay, append it to wrapper, set previous click event on overlay.
425425
*/
426426
_createOverlay: function () {
427-
var events,
428-
outerClickHandler = this.options.outerClickHandler || this.closeModal;
427+
var events;
429428

430429
this.overlay = $('.' + this.options.overlayClass);
431430

@@ -437,7 +436,6 @@ define([
437436
}
438437
events = $._data(this.overlay.get(0), 'events');
439438
events ? this.prevOverlayHandler = events.click[0].handler : false;
440-
this.options.clickableOverlay ? this.overlay.unbind().on('click', outerClickHandler) : false;
441439
},
442440

443441
/**

app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/header/actions-group/_search.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
background-color: transparent;
152152
border: 1px solid transparent;
153153
font-size: @search-global-input__font-size;
154-
height: @search-global-input__height;
154+
height: @search-global-input__height + .2;
155155
padding: @search-global-input__padding-top @search-global-input__padding-side @search-global-input__padding-bottom;
156156
position: absolute;
157157
right: 0;

lib/web/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Submit,Submit
2727
"Letters, numbers, spaces or underscores only please","Letters, numbers, spaces or underscores only please"
2828
"Letters only please","Letters only please"
2929
"No white space please","No white space please"
30+
"No marginal white space please","No marginal white space please"
3031
"Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx","Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx"
3132
"A positive or negative non-decimal number please","A positive or negative non-decimal number please"
3233
"The specified vehicle identification number (VIN) is invalid.","The specified vehicle identification number (VIN) is invalid."

0 commit comments

Comments
 (0)