Skip to content

Commit

Permalink
Showing 3 changed files with 26 additions and 12 deletions.
19 changes: 10 additions & 9 deletions app/code/Magento/Sales/Model/Order/Address/Validator.php
Original file line number Diff line number Diff line change
@@ -61,6 +61,16 @@ public function __construct(
$this->countryFactory = $countryFactory;
$this->eavConfig = $eavConfig ?: ObjectManager::getInstance()
->get(EavConfig::class);
}

/**
*
* @param \Magento\Sales\Model\Order\Address $address
* @return array
*/
public function validate(Address $address)
{
$warnings = [];

if ($this->isTelephoneRequired()) {
$this->required['telephone'] = 'Phone Number';
@@ -73,16 +83,7 @@ public function __construct(
if ($this->isFaxRequired()) {
$this->required['fax'] = 'Fax';
}
}

/**
*
* @param \Magento\Sales\Model\Order\Address $address
* @return array
*/
public function validate(Address $address)
{
$warnings = [];
foreach ($this->required as $code => $label) {
if (!$address->hasData($code)) {
$warnings[] = sprintf('"%s" is required. Enter and try again.', $label);
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/Locale/Format.php
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ public function getPriceFormat($localeCode = null, $currencyCode = null)
}

$formatter = new \NumberFormatter(
$localeCode . '@currency=' . $currency->getCode(),
$currency->getCode() ? $localeCode . '@currency=' . $currency->getCode() : $localeCode,
\NumberFormatter::CURRENCY
);
$format = $formatter->getPattern();
17 changes: 15 additions & 2 deletions lib/internal/Magento/Framework/Locale/Resolver.php
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@
namespace Magento\Framework\Locale;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\App\ObjectManager;

class Resolver implements ResolverInterface
{
@@ -52,21 +54,29 @@ class Resolver implements ResolverInterface
*/
private $defaultLocalePath;

/**
* @var DeploymentConfig
*/
private $deploymentConfig;

/**
* @param ScopeConfigInterface $scopeConfig
* @param string $defaultLocalePath
* @param string $scopeType
* @param mixed $locale
* @param DeploymentConfig|null $deploymentConfig
*/
public function __construct(
ScopeConfigInterface $scopeConfig,
$defaultLocalePath,
$scopeType,
$locale = null
$locale = null,
DeploymentConfig $deploymentConfig = null
) {
$this->scopeConfig = $scopeConfig;
$this->defaultLocalePath = $defaultLocalePath;
$this->scopeType = $scopeType;
$this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->create(DeploymentConfig::class);
$this->setLocale($locale);
}

@@ -93,7 +103,10 @@ public function setDefaultLocale($locale)
public function getDefaultLocale()
{
if (!$this->defaultLocale) {
$locale = $this->scopeConfig->getValue($this->getDefaultLocalePath(), $this->scopeType);
$locale = false;
if ($this->deploymentConfig->isAvailable() && $this->deploymentConfig->isDbAvailable()) {
$locale = $this->scopeConfig->getValue($this->getDefaultLocalePath(), $this->scopeType);
}
if (!$locale) {
$locale = self::DEFAULT_LOCALE;
}

0 comments on commit b1d55f8

Please sign in to comment.