Skip to content

Commit

Permalink
Merge pull request #1666 from magento-engcom/2.2-develop-prs
Browse files Browse the repository at this point in the history
[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
  • Loading branch information
ishakhsuvarov authored Nov 6, 2017
2 parents 13a933a + 525a2c7 commit 0483421
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,11 @@ function switchDefaultValueField()

<?php foreach ($this->helper('Magento\Catalog\Helper\Data')->getAttributeHiddenFields() as $type => $fields): ?>
case '<?= /* @escapeNotVerified */ $type ?>':
var isFrontTabHidden = false;
<?php foreach ($fields as $one): ?>
<?php if ($one == '_front_fieldset'): ?>
getFrontTab().hide();
isFrontTabHidden = true;
<?php elseif ($one == '_default_value'): ?>
defaultValueTextVisibility =
defaultValueTextareaVisibility =
Expand All @@ -210,6 +212,10 @@ function switchDefaultValueField()
setRowVisibility('<?= /* @escapeNotVerified */ $one ?>', false);
<?php endif; ?>
<?php endforeach; ?>

if (!isFrontTabHidden){
getFrontTab().show();
}
break;
<?php endforeach; ?>

Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Customer/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@
<field id="street_lines" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
<label>Number of Lines in a Street Address</label>
<backend_model>Magento\Customer\Model\Config\Backend\Address\Street</backend_model>
<comment>Leave empty for default (2). Valid range: 1-4</comment>
<comment>Valid range: 1-4</comment>
<validate>required-entry validate-digits validate-digits-range digits-range-1-4</validate>
</field>
<field id="prefix_show" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Show Prefix</label>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Eav/Model/Entity/AbstractEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ public function checkAttributeUniqueValue(AbstractAttribute $attribute, $object)
'value' => trim($value),
];

$entityIdField = $attributeBackend->getEntityIdField();
$entityIdField = $object->getResource()->getLinkField();
$select->from(
$attributeBackend->getTable(),
$entityIdField
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Reports/Setup/InstallData.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
// @codingStandardsIgnoreStart
$reportLayoutUpdate = '<!--
<referenceContainer name="right">
<action method="unsetChild"><argument name="alias" xsi:type="string">right.reports.product.viewed</argument></action>
<action method="unsetChild"><argument name="alias" xsi:type="string">right.reports.product.compared</argument></action>
<referenceBlock name="catalog.compare.sidebar" remove="true" />
</referenceContainer>-->';
// @codingStandardsIgnoreEnd

Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Store/Model/ResourceModel/Website.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function readAllWebsites()
->select()
->from($this->getTable('store_website'));

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

Expand All @@ -69,7 +69,7 @@ public function readAllWebsites()
*/
protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
{
if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $object->getCode())) {
if (!preg_match('/^[a-z]+[a-z0-9_]*$/i', $object->getCode())) {
throw new \Magento\Framework\Exception\LocalizedException(
__(
'Website code may only contain letters (a-z), numbers (0-9) or underscore (_),'
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Store/Model/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
use Magento\Framework\App\Http\Context;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\ScopeInterface as AppScopeInterface;
use Magento\Framework\Filesystem;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Url\ScopeInterface as UrlScopeInterface;
use Magento\Framework\Filesystem;
use Magento\Framework\Model\AbstractExtensibleModel;
use Magento\Framework\Url\ScopeInterface as UrlScopeInterface;
use Magento\Framework\UrlInterface;
use Magento\Store\Api\Data\StoreInterface;

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

$storeCodeRule = new \Zend_Validate_Regex('/^[a-z]+[a-z0-9_]*$/');
$storeCodeRule = new \Zend_Validate_Regex('/^[a-z]+[a-z0-9_]*$/i');
$storeCodeRule->setMessage(
__(
'The store code may contain only letters (a-z), numbers (0-9) or underscore (_),'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ define([
useProductImageForSwatch = false,
defaultValueUpdateImage = false,
optionDefaultInputType = '',
isFrontTabHidden = false,
thing = this;

if (!this.frontendInput.length) {
Expand Down Expand Up @@ -246,6 +247,7 @@ define([
switch (option) {
case '_front_fieldset':
thing.tabsFront.hide();
isFrontTabHidden = true;
break;

case '_default_value':
Expand All @@ -262,6 +264,11 @@ define([
thing.setRowVisibility($('#' + option), false);
}
});

if (!isFrontTabHidden) {
thing.tabsFront.show();
}

} else {
this.tabsFront.show();
this.showDefaultRows();
Expand Down

0 comments on commit 0483421

Please sign in to comment.