Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 0483421

Browse files
Merge pull request #1666 from magento-engcom/2.2-develop-prs
[EngCom] Public Pull Requests - 2.2-develop - MAGETWO-83278: Add validation for number of street lines #12013 - MAGETWO-83277: [backport 2.2] Magento 2 Store Code validation regex: doesn't support uppercase letters in store code #12011 - MAGETWO-82991: Product attribute creation page handles Storefront tab visibility wrong #11770 - MAGETWO-82976: Update wrong layout update xml handle installed in CMS Home Page by d… #11863 - MAGETWO-82952: Check attribute unique between same fields in magento commerce #11620
2 parents 13a933a + 525a2c7 commit 0483421

File tree

7 files changed

+22
-9
lines changed

7 files changed

+22
-9
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,11 @@ function switchDefaultValueField()
196196

197197
<?php foreach ($this->helper('Magento\Catalog\Helper\Data')->getAttributeHiddenFields() as $type => $fields): ?>
198198
case '<?= /* @escapeNotVerified */ $type ?>':
199+
var isFrontTabHidden = false;
199200
<?php foreach ($fields as $one): ?>
200201
<?php if ($one == '_front_fieldset'): ?>
201202
getFrontTab().hide();
203+
isFrontTabHidden = true;
202204
<?php elseif ($one == '_default_value'): ?>
203205
defaultValueTextVisibility =
204206
defaultValueTextareaVisibility =
@@ -210,6 +212,10 @@ function switchDefaultValueField()
210212
setRowVisibility('<?= /* @escapeNotVerified */ $one ?>', false);
211213
<?php endif; ?>
212214
<?php endforeach; ?>
215+
216+
if (!isFrontTabHidden){
217+
getFrontTab().show();
218+
}
213219
break;
214220
<?php endforeach; ?>
215221

app/code/Magento/Customer/etc/adminhtml/system.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@
198198
<field id="street_lines" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
199199
<label>Number of Lines in a Street Address</label>
200200
<backend_model>Magento\Customer\Model\Config\Backend\Address\Street</backend_model>
201-
<comment>Leave empty for default (2). Valid range: 1-4</comment>
201+
<comment>Valid range: 1-4</comment>
202+
<validate>required-entry validate-digits validate-digits-range digits-range-1-4</validate>
202203
</field>
203204
<field id="prefix_show" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
204205
<label>Show Prefix</label>

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ public function checkAttributeUniqueValue(AbstractAttribute $attribute, $object)
908908
'value' => trim($value),
909909
];
910910

911-
$entityIdField = $attributeBackend->getEntityIdField();
911+
$entityIdField = $object->getResource()->getLinkField();
912912
$select->from(
913913
$attributeBackend->getTable(),
914914
$entityIdField

app/code/Magento/Reports/Setup/InstallData.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
8383
// @codingStandardsIgnoreStart
8484
$reportLayoutUpdate = '<!--
8585
<referenceContainer name="right">
86-
<action method="unsetChild"><argument name="alias" xsi:type="string">right.reports.product.viewed</argument></action>
87-
<action method="unsetChild"><argument name="alias" xsi:type="string">right.reports.product.compared</argument></action>
86+
<referenceBlock name="catalog.compare.sidebar" remove="true" />
8887
</referenceContainer>-->';
8988
// @codingStandardsIgnoreEnd
9089

app/code/Magento/Store/Model/ResourceModel/Website.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function readAllWebsites()
5353
->select()
5454
->from($this->getTable('store_website'));
5555

56-
foreach($this->getConnection()->fetchAll($select) as $websiteData) {
56+
foreach ($this->getConnection()->fetchAll($select) as $websiteData) {
5757
$websites[$websiteData['code']] = $websiteData;
5858
}
5959

@@ -69,7 +69,7 @@ public function readAllWebsites()
6969
*/
7070
protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
7171
{
72-
if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $object->getCode())) {
72+
if (!preg_match('/^[a-z]+[a-z0-9_]*$/i', $object->getCode())) {
7373
throw new \Magento\Framework\Exception\LocalizedException(
7474
__(
7575
'Website code may only contain letters (a-z), numbers (0-9) or underscore (_),'

app/code/Magento/Store/Model/Store.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
use Magento\Framework\App\Http\Context;
1313
use Magento\Framework\App\ObjectManager;
1414
use Magento\Framework\App\ScopeInterface as AppScopeInterface;
15-
use Magento\Framework\Filesystem;
1615
use Magento\Framework\DataObject\IdentityInterface;
17-
use Magento\Framework\Url\ScopeInterface as UrlScopeInterface;
16+
use Magento\Framework\Filesystem;
1817
use Magento\Framework\Model\AbstractExtensibleModel;
18+
use Magento\Framework\Url\ScopeInterface as UrlScopeInterface;
1919
use Magento\Framework\UrlInterface;
2020
use Magento\Store\Api\Data\StoreInterface;
2121

@@ -463,7 +463,7 @@ protected function _getValidationRulesBeforeSave()
463463
$storeLabelRule->setMessage(__('Name is required'), \Zend_Validate_NotEmpty::IS_EMPTY);
464464
$validator->addRule($storeLabelRule, 'name');
465465

466-
$storeCodeRule = new \Zend_Validate_Regex('/^[a-z]+[a-z0-9_]*$/');
466+
$storeCodeRule = new \Zend_Validate_Regex('/^[a-z]+[a-z0-9_]*$/i');
467467
$storeCodeRule->setMessage(
468468
__(
469469
'The store code may contain only letters (a-z), numbers (0-9) or underscore (_),'

app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ define([
182182
useProductImageForSwatch = false,
183183
defaultValueUpdateImage = false,
184184
optionDefaultInputType = '',
185+
isFrontTabHidden = false,
185186
thing = this;
186187

187188
if (!this.frontendInput.length) {
@@ -246,6 +247,7 @@ define([
246247
switch (option) {
247248
case '_front_fieldset':
248249
thing.tabsFront.hide();
250+
isFrontTabHidden = true;
249251
break;
250252

251253
case '_default_value':
@@ -262,6 +264,11 @@ define([
262264
thing.setRowVisibility($('#' + option), false);
263265
}
264266
});
267+
268+
if (!isFrontTabHidden) {
269+
thing.tabsFront.show();
270+
}
271+
265272
} else {
266273
this.tabsFront.show();
267274
this.showDefaultRows();

0 commit comments

Comments
 (0)