Skip to content

Commit 2c36da2

Browse files
authored
Merge pull request #1300 from magento-south/PRS
Fixed issues: - MAGETWO-57995 [GITHUB] Simple product videos display the thumbnail image rather than the embedded video player. #6360 - MAGETWO-57070 [GitHub] Locale\Format throws away country part, results in wrong number format #5073 - MAGETWO-69854 Can't set allowed or default currencies using config:set command - MAGETWO-66627 [GitHub] Default Post Code is applied for all Order's addresses if zip is not required - MAGETWO-66906 Deprecate setup:store-config:set command - MAGETWO-67274 Can't set value using config:set on uninstalled instance - MAGETWO-70294 [GitHub] Mass Actions with Childs don't work in CMS #9854 - MAGETWO-70216 Remove section i18n from shared file (config.php) - MAGETWO-59514 Hard coded "tax_region_id" in the \Magento\Tax\Setup\InstallData
2 parents 04c5b80 + c8b676e commit 2c36da2

File tree

56 files changed

+1317
-784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1317
-784
lines changed

app/code/Magento/Catalog/Block/Product/View/Gallery.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ public function getGalleryImagesJson()
118118
'caption' => $image->getLabel(),
119119
'position' => $image->getPosition(),
120120
'isMain' => $this->isMainImage($image),
121+
'type' => str_replace('external-', '', $image->getMediaType()),
122+
'videoUrl' => $image->getVideoUrl(),
121123
];
122124
}
123125
if (empty($imagesItems)) {
@@ -128,6 +130,8 @@ public function getGalleryImagesJson()
128130
'caption' => '',
129131
'position' => '0',
130132
'isMain' => true,
133+
'type' => 'image',
134+
'videoUrl' => null,
131135
];
132136
}
133137
return json_encode($imagesItems);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
define([], function () {
6+
'use strict';
7+
8+
/**
9+
* Define necessity of using default post code value
10+
*/
11+
var useDefaultPostCode;
12+
13+
return {
14+
/**
15+
* Resolve default post code
16+
*
17+
* @returns {String|null}
18+
*/
19+
resolve: function () {
20+
return useDefaultPostCode ? window.checkoutConfig.defaultPostcode : null;
21+
},
22+
23+
/**
24+
* Set state to useDefaultPostCode variable
25+
*
26+
* @param {Boolean} shouldUseDefaultPostCode
27+
* @returns {underscore}
28+
*/
29+
setUseDefaultPostCode: function (shouldUseDefaultPostCode) {
30+
useDefaultPostCode = shouldUseDefaultPostCode;
31+
32+
return this;
33+
}
34+
};
35+
});

app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
* @api
77
*/
88
define([
9-
'underscore'
10-
], function (_) {
9+
'underscore',
10+
'Magento_Checkout/js/model/default-post-code-resolver'
11+
], function (_, DefaultPostCodeResolver) {
1112
'use strict';
1213

1314
/**
@@ -35,7 +36,7 @@ define([
3536
company: addressData.company,
3637
telephone: addressData.telephone,
3738
fax: addressData.fax,
38-
postcode: addressData.postcode ? addressData.postcode : window.checkoutConfig.defaultPostcode || undefined,
39+
postcode: addressData.postcode ? addressData.postcode : DefaultPostCodeResolver.resolve(),
3940
city: addressData.city,
4041
firstname: addressData.firstname,
4142
lastname: addressData.lastname,

app/code/Magento/Config/Console/Command/ConfigSet/ConfigSetProcessorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface ConfigSetProcessorInterface
2020
/**
2121
* Processes config:set command.
2222
*
23-
* @param string $path The configuration path in format section/group/field_name
23+
* @param string $path The configuration path in format group/section/field_name
2424
* @param string $value The configuration value
2525
* @param string $scope The configuration scope (default, website, or store)
2626
* @param string $scopeCode The scope code

app/code/Magento/Config/Console/Command/ConfigSet/DefaultProcessor.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,6 @@ public function __construct(
6666
*/
6767
public function process($path, $value, $scope, $scopeCode)
6868
{
69-
if (!$this->deploymentConfig->isAvailable()) {
70-
throw new CouldNotSaveException(
71-
__(
72-
'We can\'t save this option because Magento is not installed. '
73-
. 'To lock this value, enter the command again using the --%1 option.',
74-
ConfigSetCommand::OPTION_LOCK
75-
)
76-
);
77-
}
78-
7969
if ($this->isLocked($path, $scope, $scopeCode)) {
8070
throw new CouldNotSaveException(
8171
__(

app/code/Magento/Config/Console/Command/ConfigSet/ProcessorFacade.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Config\Console\Command\ConfigSet;
77

88
use Magento\Config\Console\Command\ConfigSetCommand;
9+
use Magento\Framework\App\Config\ScopeConfigInterface;
910
use Magento\Framework\App\Scope\ValidatorInterface;
1011
use Magento\Config\Model\Config\PathValidator;
1112
use Magento\Framework\Exception\LocalizedException;
@@ -14,6 +15,7 @@
1415
use Magento\Framework\Exception\ValidatorException;
1516
use Magento\Deploy\Model\DeploymentConfig\Hash;
1617
use Magento\Config\App\Config\Type\System;
18+
use Magento\Framework\App\Config;
1719

1820
/**
1921
* Processor facade for config:set command.
@@ -57,22 +59,32 @@ class ProcessorFacade
5759
*/
5860
private $hash;
5961

62+
/**
63+
* The application config storage.
64+
*
65+
* @var ScopeConfigInterface
66+
*/
67+
private $scopeConfig;
68+
6069
/**
6170
* @param ValidatorInterface $scopeValidator The scope validator
6271
* @param PathValidator $pathValidator The path validator
6372
* @param ConfigSetProcessorFactory $configSetProcessorFactory The factory for config:set processors
6473
* @param Hash $hash The hash manager
74+
* @param ScopeConfigInterface $scopeConfig The application config storage
6575
*/
6676
public function __construct(
6777
ValidatorInterface $scopeValidator,
6878
PathValidator $pathValidator,
6979
ConfigSetProcessorFactory $configSetProcessorFactory,
70-
Hash $hash
80+
Hash $hash,
81+
ScopeConfigInterface $scopeConfig
7182
) {
7283
$this->scopeValidator = $scopeValidator;
7384
$this->pathValidator = $pathValidator;
7485
$this->configSetProcessorFactory = $configSetProcessorFactory;
7586
$this->hash = $hash;
87+
$this->scopeConfig = $scopeConfig;
7688
}
7789

7890
/**
@@ -109,6 +121,10 @@ public function process($path, $value, $scope, $scopeCode, $lock)
109121

110122
$this->hash->regenerate(System::CONFIG_TYPE);
111123

124+
if ($this->scopeConfig instanceof Config) {
125+
$this->scopeConfig->clean();
126+
}
127+
112128
return $message;
113129
}
114130
}

app/code/Magento/Config/Console/Command/ConfigSetCommand.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Config\App\Config\Type\System;
99
use Magento\Config\Console\Command\ConfigSet\ProcessorFacadeFactory;
1010
use Magento\Deploy\Model\DeploymentConfig\ChangeDetector;
11+
use Magento\Framework\App\DeploymentConfig;
1112
use Magento\Framework\App\Config\ScopeConfigInterface;
1213
use Magento\Framework\Console\Cli;
1314
use Symfony\Component\Console\Command\Command;
@@ -55,19 +56,29 @@ class ConfigSetCommand extends Command
5556
*/
5657
private $processorFacadeFactory;
5758

59+
/**
60+
* Application deployment configuration
61+
*
62+
* @var DeploymentConfig
63+
*/
64+
private $deploymentConfig;
65+
5866
/**
5967
* @param EmulatedAdminhtmlAreaProcessor $emulatedAreaProcessor Emulator adminhtml area for CLI command
6068
* @param ChangeDetector $changeDetector The config change detector
6169
* @param ProcessorFacadeFactory $processorFacadeFactory The factory for processor facade
70+
* @param DeploymentConfig $deploymentConfig Application deployment configuration
6271
*/
6372
public function __construct(
6473
EmulatedAdminhtmlAreaProcessor $emulatedAreaProcessor,
6574
ChangeDetector $changeDetector,
66-
ProcessorFacadeFactory $processorFacadeFactory
75+
ProcessorFacadeFactory $processorFacadeFactory,
76+
DeploymentConfig $deploymentConfig
6777
) {
6878
$this->emulatedAreaProcessor = $emulatedAreaProcessor;
6979
$this->changeDetector = $changeDetector;
7080
$this->processorFacadeFactory = $processorFacadeFactory;
81+
$this->deploymentConfig = $deploymentConfig;
7182

7283
parent::__construct();
7384
}
@@ -117,6 +128,12 @@ protected function configure()
117128
*/
118129
protected function execute(InputInterface $input, OutputInterface $output)
119130
{
131+
if (!$this->deploymentConfig->isAvailable()) {
132+
$output->writeln(
133+
'<error>You cannot run this command because the Magento application is not installed.</error>'
134+
);
135+
return Cli::RETURN_FAILURE;
136+
}
120137
if ($this->changeDetector->hasChanges(System::CONFIG_TYPE)) {
121138
$output->writeln(
122139
'<error>'

app/code/Magento/Config/Console/CommandList.php

Lines changed: 0 additions & 50 deletions
This file was deleted.

app/code/Magento/Config/Model/Config/Backend/Currency/AbstractCurrency.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ abstract class AbstractCurrency extends \Magento\Framework\App\Config\Value
2525
*/
2626
protected function _getAllowedCurrencies()
2727
{
28-
if ($this->getData('groups/options/fields/allow/inherit')) {
28+
if (!$this->isFormData() || $this->getData('groups/options/fields/allow/inherit')) {
2929
return explode(
3030
',',
3131
(string)$this->_config->getValue(
@@ -62,7 +62,8 @@ protected function _getInstalledCurrencies()
6262
*/
6363
protected function _getCurrencyBase()
6464
{
65-
if (!($value = $this->getData('groups/options/fields/base/value'))) {
65+
$value = $this->getData('groups/options/fields/base/value');
66+
if (!$this->isFormData() || !$value) {
6667
$value = $this->_config->getValue(
6768
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE,
6869
$this->getScope(),
@@ -79,7 +80,7 @@ protected function _getCurrencyBase()
7980
*/
8081
protected function _getCurrencyDefault()
8182
{
82-
if (!($value = $this->getData('groups/options/fields/default/value'))) {
83+
if (!$this->isFormData() || !($value = $this->getData('groups/options/fields/default/value'))) {
8384
$value = $this->_config->getValue(
8485
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT,
8586
$this->getScope(),
@@ -88,4 +89,14 @@ protected function _getCurrencyDefault()
8889
}
8990
return strval($value);
9091
}
92+
93+
/**
94+
* Check whether field saved from Admin form with other currency data or as single field, e.g. from CLI command
95+
*
96+
* @return bool True in case when field was saved from Admin form
97+
*/
98+
private function isFormData()
99+
{
100+
return $this->getData('groups/options/fields') !== null;
101+
}
91102
}

app/code/Magento/Config/Model/Config/Backend/Currency/Allow.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public function __construct(
5454
public function afterSave()
5555
{
5656
$exceptions = [];
57-
foreach ($this->_getAllowedCurrencies() as $currencyCode) {
57+
$allowedCurrencies = $this->_getAllowedCurrencies();
58+
foreach ($allowedCurrencies as $currencyCode) {
5859
if (!in_array($currencyCode, $this->_getInstalledCurrencies())) {
5960
$exceptions[] = __(
6061
'Selected allowed currency "%1" is not available in installed currencies.',
@@ -63,7 +64,7 @@ public function afterSave()
6364
}
6465
}
6566

66-
if (!in_array($this->_getCurrencyDefault(), $this->_getAllowedCurrencies())) {
67+
if (!in_array($this->_getCurrencyDefault(), $allowedCurrencies)) {
6768
$exceptions[] = __(
6869
'Default display currency "%1" is not available in allowed currencies.',
6970
$this->_localeCurrency->getCurrency($this->_getCurrencyDefault())->getName()
@@ -76,4 +77,22 @@ public function afterSave()
7677

7778
return parent::afterSave();
7879
}
80+
81+
/**
82+
* @inheritdoc
83+
*/
84+
protected function _getAllowedCurrencies()
85+
{
86+
$value = $this->getValue();
87+
$isFormData = $this->getData('groups/options/fields') !== null;
88+
if ($isFormData && $this->getData('groups/options/fields/allow/inherit')) {
89+
$value = (string)$this->_config->getValue(
90+
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW,
91+
$this->getScope(),
92+
$this->getScopeId()
93+
);
94+
}
95+
96+
return explode(',', $value);
97+
}
7998
}

0 commit comments

Comments
 (0)