Skip to content

Commit 1d083d4

Browse files
Merge pull request #1669 from magento-engcom/2.1-develop-prs
[EngCom] Public Pull Requests - 2.1-develop - MAGETWO-83320: #7903 correct the position of the datepicker when you scroll #12045 - MAGETWO-83319: [backport 2.1] Magento 2 Store Code validation regex: doesn't support uppercase letters in store code #12040 - MAGETWO-82948: fix #8846 [Backport 2.1-develop]: avoid duplicated attribute option values #11786 - MAGETWO-81328: [Fix:5439] Send email to subscribers only when are new 2.1 #11316
2 parents 8ffe3cc + 32439d7 commit 1d083d4

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ public function getItems($attributeCode)
4040
*/
4141
public function add($attributeCode, $option)
4242
{
43+
/** @var \Magento\Eav\Api\Data\AttributeOptionInterface[] $currentOptions */
44+
$currentOptions = $this->getItems($attributeCode);
45+
if (is_array($currentOptions)) {
46+
array_walk($currentOptions, function (&$attributeOption) {
47+
/** @var \Magento\Eav\Api\Data\AttributeOptionInterface $attributeOption */
48+
$attributeOption = $attributeOption->getLabel();
49+
});
50+
if (in_array($option->getLabel(), $currentOptions)) {
51+
return false;
52+
}
53+
}
4354
return $this->eavOptionManagement->add(
4455
\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE,
4556
$attributeCode,

app/code/Magento/Newsletter/Model/Subscriber.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ public function subscribe($email)
395395
{
396396
$this->loadByEmail($email);
397397

398+
if ($this->getId() && $this->getStatus() == self::STATUS_SUBSCRIBED) {
399+
return $this->getStatus();
400+
}
401+
398402
if (!$this->getId()) {
399403
$this->setSubscriberConfirmCode($this->randomSequence());
400404
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function readAllWebsites()
4747
->select()
4848
->from($this->getTable('store_website'));
4949

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

@@ -63,7 +63,7 @@ public function readAllWebsites()
6363
*/
6464
protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
6565
{
66-
if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $object->getCode())) {
66+
if (!preg_match('/^[a-z]+[a-z0-9_]*$/i', $object->getCode())) {
6767
throw new \Magento\Framework\Exception\LocalizedException(
6868
__(
6969
'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

@@ -459,7 +459,7 @@ protected function _getValidationRulesBeforeSave()
459459
$storeLabelRule->setMessage(__('Name is required'), \Zend_Validate_NotEmpty::IS_EMPTY);
460460
$validator->addRule($storeLabelRule, 'name');
461461

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

app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@
122122
}
123123
}
124124

125+
td {
126+
.admin__field-control {
127+
position: relative;
128+
}
129+
}
130+
125131
th {
126132
color: @color-very-dark-gray-black;
127133
font-size: @font-size__base;

0 commit comments

Comments
 (0)