Skip to content

Commit 3bd64f6

Browse files
committed
Merge pull request #472 from magento-api/develop
[API] Bug Fixes 39919, 39700
2 parents 0b8fc26 + 5cf055f commit 3bd64f6

File tree

3 files changed

+35
-7
lines changed
  • app/code/Magento/Config/Model/Config/Backend/Currency
  • dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter
  • lib/internal/Magento/Framework/DB/Adapter/Pdo

3 files changed

+35
-7
lines changed

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

+34-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**
108
* Backend Directory currency backend model
119
* Allows dispatching before and after events for each controller action
@@ -14,6 +12,33 @@
1412

1513
class Base extends AbstractCurrency
1614
{
15+
/** @var \Magento\Directory\Model\CurrencyFactory */
16+
private $currencyFactory;
17+
18+
/**
19+
* @param \Magento\Framework\Model\Context $context
20+
* @param \Magento\Framework\Registry $registry
21+
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
22+
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
23+
* @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
24+
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
25+
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
26+
* @param array $data
27+
*/
28+
public function __construct(
29+
\Magento\Framework\Model\Context $context,
30+
\Magento\Framework\Registry $registry,
31+
\Magento\Framework\App\Config\ScopeConfigInterface $config,
32+
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
33+
\Magento\Directory\Model\CurrencyFactory $currencyFactory,
34+
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
35+
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
36+
array $data = []
37+
) {
38+
parent::__construct($context, $registry, $config, $scopeConfig, $resource, $resourceCollection, $data);
39+
$this->currencyFactory = $currencyFactory;
40+
}
41+
1742
/**
1843
* Check base currency is available in installed currencies
1944
*
@@ -22,9 +47,14 @@ class Base extends AbstractCurrency
2247
*/
2348
public function afterSave()
2449
{
25-
if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) {
26-
throw new \Magento\Framework\Exception\LocalizedException(__('Sorry, we haven\'t installed the base currency you selected.'));
50+
$value = $this->getValue();
51+
if (!in_array($value, $this->_getInstalledCurrencies())) {
52+
throw new \Magento\Framework\Exception\LocalizedException(
53+
__('Sorry, we haven\'t installed the base currency you selected.')
54+
);
2755
}
56+
57+
$this->currencyFactory->create()->saveRates([$value =>[$value => 1]]);
2858
return $this;
2959
}
3060
}

dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function __construct()
4242
$objectManager = Bootstrap::getObjectManager();
4343
$this->_soapConfig = $objectManager->get('Magento\Webapi\Model\Soap\Config');
4444
$this->_converter = $objectManager->get('Magento\Framework\Api\SimpleDataObjectConverter');
45+
ini_set('default_socket_timeout', 120);
4546
}
4647

4748
/**

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

-3
Original file line numberDiff line numberDiff line change
@@ -1801,9 +1801,6 @@ public function insertOnDuplicate($table, array $data, array $fields = [])
18011801
$fields = $cols;
18021802
}
18031803

1804-
// quote column names
1805-
// $cols = array_map(array($this, 'quoteIdentifier'), $cols);
1806-
18071804
// prepare ON DUPLICATE KEY conditions
18081805
foreach ($fields as $k => $v) {
18091806
$field = $value = null;

0 commit comments

Comments
 (0)