Skip to content

Commit b3f1945

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents b7f2a66 + 23bc18f commit b3f1945

File tree

39 files changed

+362
-58
lines changed

39 files changed

+362
-58
lines changed

app/code/Magento/Backend/Controller/Adminhtml/System/Design/Save.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
*/
77
namespace Magento\Backend\Controller\Adminhtml\System\Design;
88

9-
class Save extends \Magento\Backend\Controller\Adminhtml\System\Design
9+
use Magento\Framework\App\Action\HttpPostActionInterface;
10+
11+
/**
12+
* Save design action.
13+
*/
14+
class Save extends \Magento\Backend\Controller\Adminhtml\System\Design implements HttpPostActionInterface
1015
{
1116
/**
1217
* Filtering posted data. Converting localized data if needed
@@ -26,6 +31,8 @@ protected function _filterPostData($data)
2631
}
2732

2833
/**
34+
* Save design action.
35+
*
2936
* @return \Magento\Backend\Model\View\Result\Redirect
3037
*/
3138
public function execute()
@@ -54,10 +61,10 @@ public function execute()
5461
} catch (\Exception $e) {
5562
$this->messageManager->addErrorMessage($e->getMessage());
5663
$this->_objectManager->get(\Magento\Backend\Model\Session::class)->setDesignData($data);
57-
return $resultRedirect->setPath('adminhtml/*/', ['id' => $design->getId()]);
64+
return $resultRedirect->setPath('*/*/edit', ['id' => $design->getId()]);
5865
}
5966
}
6067

61-
return $resultRedirect->setPath('adminhtml/*/');
68+
return $resultRedirect->setPath('*/*/');
6269
}
6370
}

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Catalog\Model\Config\Source\Product\Options\Price as ProductOptionsPrice;
1212
use Magento\Framework\UrlInterface;
1313
use Magento\Framework\Stdlib\ArrayManager;
14+
use Magento\Ui\Component\Form\Element\Hidden;
1415
use Magento\Ui\Component\Modal;
1516
use Magento\Ui\Component\Container;
1617
use Magento\Ui\Component\DynamicRows;
@@ -867,10 +868,9 @@ protected function getPositionFieldConfig($sortOrder)
867868
'data' => [
868869
'config' => [
869870
'componentType' => Field::NAME,
870-
'formElement' => Input::NAME,
871+
'formElement' => Hidden::NAME,
871872
'dataScope' => static::FIELD_SORT_ORDER_NAME,
872873
'dataType' => Number::NAME,
873-
'visible' => false,
874874
'sortOrder' => $sortOrder,
875875
],
876876
],

app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@
190190
<label translate="true">Websites</label>
191191
</settings>
192192
</column>
193+
<column name="cost" class="Magento\Catalog\Ui\Component\Listing\Columns\Price" sortOrder="120">
194+
<settings>
195+
<addField>true</addField>
196+
<filter>textRange</filter>
197+
<label translate="true">Cost</label>
198+
</settings>
199+
</column>
193200
<actionsColumn name="actions" class="Magento\Catalog\Ui\Component\Listing\Columns\ProductActions" sortOrder="200">
194201
<settings>
195202
<indexField>entity_id</indexField>

app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<legend class="legend admin__legend">
1818
<span><?= /* @escapeNotVerified */ __('Associated Products') ?></span>
1919
</legend>
20-
<div class="product-options">
21-
<div class="field admin__field _required required">
22-
<?php foreach ($_attributes as $_attribute): ?>
20+
<div class="product-options fieldset admin__fieldset">
21+
<?php foreach ($_attributes as $_attribute): ?>
22+
<div class="field admin__field _required required">
2323
<label class="label admin__field-label"><?php
2424
/* @escapeNotVerified */ echo $_attribute->getProductAttribute()
2525
->getStoreLabel($_product->getStoreId());
@@ -34,8 +34,8 @@
3434
<option><?= /* @escapeNotVerified */ __('Choose an Option...') ?></option>
3535
</select>
3636
</div>
37-
<?php endforeach; ?>
38-
</div>
37+
</div>
38+
<?php endforeach; ?>
3939
</div>
4040
</fieldset>
4141
<script>

app/code/Magento/Cookie/Helper/Cookie.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class Cookie extends \Magento\Framework\App\Helper\AbstractHelper
4242
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
4343
* @param array $data
4444
*
45-
* @throws \InvalidArgumentException
45+
* @throws \Magento\Framework\Exception\LocalizedException
46+
* @throws \Magento\Framework\Exception\NoSuchEntityException
4647
*/
4748
public function __construct(
4849
\Magento\Framework\App\Helper\Context $context,

app/code/Magento/Customer/Model/ResourceModel/Group.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class Group extends \Magento\Framework\Model\ResourceModel\Db\VersionControl\Abs
2929

3030
/**
3131
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
32-
* @param Snapshot $entitySnapshot,
33-
* @param RelationComposite $entityRelationComposite,
32+
* @param Snapshot $entitySnapshot
33+
* @param RelationComposite $entityRelationComposite
3434
* @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
3535
* @param Customer\CollectionFactory $customersFactory
3636
* @param string $connectionName
@@ -110,6 +110,8 @@ protected function _afterDelete(\Magento\Framework\Model\AbstractModel $group)
110110
}
111111

112112
/**
113+
* Create customers collection.
114+
*
113115
* @return \Magento\Customer\Model\ResourceModel\Customer\Collection
114116
*/
115117
protected function _createCustomersCollection()
@@ -131,7 +133,7 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $group)
131133
}
132134

133135
/**
134-
* {@inheritdoc}
136+
* @inheritdoc
135137
*/
136138
protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
137139
{

app/code/Magento/Customer/Model/Vat.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,21 @@ public function checkVatNumber($countryCode, $vatNumber, $requesterCountryCode =
179179
return $gatewayResponse;
180180
}
181181

182+
$countryCodeForVatNumber = $this->getCountryCodeForVatNumber($countryCode);
183+
$requesterCountryCodeForVatNumber = $this->getCountryCodeForVatNumber($requesterCountryCode);
184+
182185
try {
183186
$soapClient = $this->createVatNumberValidationSoapClient();
184187

185188
$requestParams = [];
186-
$requestParams['countryCode'] = $countryCode;
189+
$requestParams['countryCode'] = $countryCodeForVatNumber;
187190
$vatNumberSanitized = $this->isCountryInEU($countryCode)
188-
? str_replace([' ', '-', $countryCode], ['', '', ''], $vatNumber)
191+
? str_replace([' ', '-', $countryCodeForVatNumber], ['', '', ''], $vatNumber)
189192
: str_replace([' ', '-'], ['', ''], $vatNumber);
190193
$requestParams['vatNumber'] = $vatNumberSanitized;
191-
$requestParams['requesterCountryCode'] = $requesterCountryCode;
194+
$requestParams['requesterCountryCode'] = $requesterCountryCodeForVatNumber;
192195
$reqVatNumSanitized = $this->isCountryInEU($requesterCountryCode)
193-
? str_replace([' ', '-', $requesterCountryCode], ['', '', ''], $requesterVatNumber)
196+
? str_replace([' ', '-', $requesterCountryCodeForVatNumber], ['', '', ''], $requesterVatNumber)
194197
: str_replace([' ', '-'], ['', ''], $requesterVatNumber);
195198
$requestParams['requesterVatNumber'] = $reqVatNumSanitized;
196199
// Send request to service
@@ -301,4 +304,22 @@ public function isCountryInEU($countryCode, $storeId = null)
301304
);
302305
return in_array($countryCode, $euCountries);
303306
}
307+
308+
/**
309+
* Returns the country code to use in the VAT number which is not always the same as the normal country code
310+
*
311+
* @param string $countryCode
312+
* @return string
313+
*/
314+
private function getCountryCodeForVatNumber(string $countryCode): string
315+
{
316+
// Greece uses a different code for VAT numbers then its country code
317+
// See: http://ec.europa.eu/taxation_customs/vies/faq.html#item_11
318+
// And https://en.wikipedia.org/wiki/VAT_identification_number:
319+
// "The full identifier starts with an ISO 3166-1 alpha-2 (2 letters) country code
320+
// (except for Greece, which uses the ISO 639-1 language code EL for the Greek language,
321+
// instead of its ISO 3166-1 alpha-2 country code GR)"
322+
323+
return $countryCode === 'GR' ? 'EL' : $countryCode;
324+
}
304325
}

app/code/Magento/Directory/Model/CurrencyConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function __construct(
5757
*/
5858
public function getConfigCurrencies(string $path)
5959
{
60-
$result = $this->appState->getAreaCode() === Area::AREA_ADMINHTML
60+
$result = in_array($this->appState->getAreaCode(), [Area::AREA_ADMINHTML, Area::AREA_CRONTAB])
6161
? $this->getConfigForAllStores($path)
6262
: $this->getConfigForCurrentStore($path);
6363
sort($result);

app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ private function addDefaultCountryToOptions(array &$options)
327327

328328
foreach ($options as $key => $option) {
329329
if (isset($defaultCountry[$option['value']])) {
330-
$options[$key]['is_default'] = $defaultCountry[$option['value']];
330+
$options[$key]['is_default'] = !empty($defaultCountry[$option['value']]);
331331
}
332332
}
333333
}

app/code/Magento/Directory/Test/Unit/Model/CurrencyConfigTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function setUp()
6868
}
6969

7070
/**
71-
* Test get currency config for admin and storefront areas.
71+
* Test get currency config for admin, crontab and storefront areas.
7272
*
7373
* @dataProvider getConfigCurrenciesDataProvider
7474
* @return void
@@ -91,7 +91,7 @@ public function testGetConfigCurrencies(string $areCode)
9191
->method('getCode')
9292
->willReturn('testCode');
9393

94-
if ($areCode === Area::AREA_ADMINHTML) {
94+
if (in_array($areCode, [Area::AREA_ADMINHTML, Area::AREA_CRONTAB])) {
9595
$this->storeManager->expects(self::once())
9696
->method('getStores')
9797
->willReturn([$store]);
@@ -121,6 +121,7 @@ public function getConfigCurrenciesDataProvider()
121121
{
122122
return [
123123
['areaCode' => Area::AREA_ADMINHTML],
124+
['areaCode' => Area::AREA_CRONTAB],
124125
['areaCode' => Area::AREA_FRONTEND],
125126
];
126127
}

0 commit comments

Comments
 (0)