diff --git a/vendor/magento/module-customer/Model/Config/Backend/Show/Customer.php b/vendor/magento/module-customer/Model/Config/Backend/Show/Customer.php index 102a78d5ea3..f2793373579 100644 --- a/vendor/magento/module-customer/Model/Config/Backend/Show/Customer.php +++ b/vendor/magento/module-customer/Model/Config/Backend/Show/Customer.php @@ -6,6 +6,7 @@ namespace Magento\Customer\Model\Config\Backend\Show; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; +use Magento\Framework\App\Config\ScopeConfigInterface; /** * Customer Show Customer Model @@ -24,6 +25,21 @@ class Customer extends \Magento\Framework\App\Config\Value */ protected $storeManager; + /** + * @var string + */ + private $telephoneShowDefaultValue = 'req'; + + /** + * @var array + */ + private $valueConfig = [ + '' => ['is_required' => 0, 'is_visible' => 0], + 'opt' => ['is_required' => 0, 'is_visible' => 1], + '1' => ['is_required' => 0, 'is_visible' => 1], + 'req' => ['is_required' => 1, 'is_visible' => 1], + ]; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -80,20 +96,8 @@ class Customer extends \Magento\Framework\App\Config\Value { $result = parent::afterSave(); - $valueConfig = [ - '' => ['is_required' => 0, 'is_visible' => 0], - 'opt' => ['is_required' => 0, 'is_visible' => 1], - '1' => ['is_required' => 0, 'is_visible' => 1], - 'req' => ['is_required' => 1, 'is_visible' => 1], - ]; - $value = $this->getValue(); - if (isset($valueConfig[$value])) { - $data = $valueConfig[$value]; - } else { - $data = $valueConfig['']; - } - + $data = $this->getValueConfig($value); if ($this->getScope() == 'websites') { $website = $this->storeManager->getWebsite($this->getScopeCode()); $dataFieldPrefix = 'scope_'; @@ -133,8 +137,31 @@ class Customer extends \Magento\Framework\App\Config\Value $attributeObject->setData('scope_is_visible', null); $attributeObject->save(); } + } else if ($this->getScope() == ScopeConfigInterface::SCOPE_TYPE_DEFAULT) { + $valueConfig = $this->getValueConfig($this->telephoneShowDefaultValue); + foreach ($this->_getAttributeObjects() as $attributeObject) { + $attributeObject->setData('is_required', $valueConfig['is_required']); + $attributeObject->setData('is_visible', $valueConfig['is_visible']); + $attributeObject->save(); + } } return $result; } + + /** + * Get value config + * + * @param string|int $value + * @return array + */ + private function getValueConfig($value): array + { + if (isset($this->valueConfig[$value])) { + $config = $this->valueConfig[$value]; + } else { + $config = $this->valueConfig['']; + } + return $config; + } } diff --git a/vendor/magento/module-quote-graph-ql/etc/schema.graphqls b/vendor/magento/module-quote-graph-ql/etc/schema.graphqls index 35d7cf082fc..2d8849a79da 100644 --- a/vendor/magento/module-quote-graph-ql/etc/schema.graphqls +++ b/vendor/magento/module-quote-graph-ql/etc/schema.graphqls @@ -118,7 +118,7 @@ input CartAddressInput { region_id: Int postcode: String country_code: String! - telephone: String! + telephone: String save_in_address_book: Boolean @doc(description: "Determines whether to save the address in the customer's address book. The default value is true") } @@ -224,7 +224,7 @@ interface CartAddressInterface @typeResolver(class: "\\Magento\\QuoteGraphQl\\Mo region: CartAddressRegion postcode: String country: CartAddressCountry! - telephone: String! + telephone: String } type ShippingCartAddress implements CartAddressInterface {