Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.3-develop' into chaika_february
Browse files Browse the repository at this point in the history
  • Loading branch information
olysenko committed Feb 13, 2019
2 parents 6178c98 + f211371 commit 5b3afb5
Show file tree
Hide file tree
Showing 59 changed files with 1,549 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
*/
namespace Magento\Backend\Controller\Adminhtml\System\Design;

class Save extends \Magento\Backend\Controller\Adminhtml\System\Design
use Magento\Framework\App\Action\HttpPostActionInterface;

/**
* Save design action.
*/
class Save extends \Magento\Backend\Controller\Adminhtml\System\Design implements HttpPostActionInterface
{
/**
* Filtering posted data. Converting localized data if needed
Expand All @@ -26,6 +31,8 @@ protected function _filterPostData($data)
}

/**
* Save design action.
*
* @return \Magento\Backend\Model\View\Result\Redirect
*/
public function execute()
Expand Down Expand Up @@ -54,10 +61,10 @@ public function execute()
} catch (\Exception $e) {
$this->messageManager->addErrorMessage($e->getMessage());
$this->_objectManager->get(\Magento\Backend\Model\Session::class)->setDesignData($data);
return $resultRedirect->setPath('adminhtml/*/', ['id' => $design->getId()]);
return $resultRedirect->setPath('*/*/edit', ['id' => $design->getId()]);
}
}

return $resultRedirect->setPath('adminhtml/*/');
return $resultRedirect->setPath('*/*/');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Magento\Catalog\Model\Config\Source\Product\Options\Price as ProductOptionsPrice;
use Magento\Framework\UrlInterface;
use Magento\Framework\Stdlib\ArrayManager;
use Magento\Ui\Component\Form\Element\Hidden;
use Magento\Ui\Component\Modal;
use Magento\Ui\Component\Container;
use Magento\Ui\Component\DynamicRows;
Expand Down Expand Up @@ -867,10 +868,9 @@ protected function getPositionFieldConfig($sortOrder)
'data' => [
'config' => [
'componentType' => Field::NAME,
'formElement' => Input::NAME,
'formElement' => Hidden::NAME,
'dataScope' => static::FIELD_SORT_ORDER_NAME,
'dataType' => Number::NAME,
'visible' => false,
'sortOrder' => $sortOrder,
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@
<label translate="true">Websites</label>
</settings>
</column>
<column name="cost" class="Magento\Catalog\Ui\Component\Listing\Columns\Price" sortOrder="120">
<settings>
<addField>true</addField>
<filter>textRange</filter>
<label translate="true">Cost</label>
</settings>
</column>
<actionsColumn name="actions" class="Magento\Catalog\Ui\Component\Listing\Columns\ProductActions" sortOrder="200">
<settings>
<indexField>entity_id</indexField>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<legend class="legend admin__legend">
<span><?= /* @escapeNotVerified */ __('Associated Products') ?></span>
</legend>
<div class="product-options">
<div class="field admin__field _required required">
<?php foreach ($_attributes as $_attribute): ?>
<div class="product-options fieldset admin__fieldset">
<?php foreach ($_attributes as $_attribute): ?>
<div class="field admin__field _required required">
<label class="label admin__field-label"><?php
/* @escapeNotVerified */ echo $_attribute->getProductAttribute()
->getStoreLabel($_product->getStoreId());
Expand All @@ -34,8 +34,8 @@
<option><?= /* @escapeNotVerified */ __('Choose an Option...') ?></option>
</select>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</fieldset>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
use Magento\Framework\GraphQl\Query\Resolver\Value;
use Magento\Catalog\Model\Product;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
Expand Down Expand Up @@ -45,12 +46,14 @@ public function resolve(
$data = [];
foreach ($value['options'] as $option) {
$code = $option['attribute_code'];
if (!isset($value['product']['model'][$code])) {
/** @var Product|null $model */
$model = $value['product']['model'] ?? null;
if (!$model || !$model->getData($code)) {
continue;
}

foreach ($option['values'] as $optionValue) {
if ($optionValue['value_index'] != $value['product']['model'][$code]) {
if ($optionValue['value_index'] != $model->getData($code)) {
continue;
}
$data[] = [
Expand Down
30 changes: 30 additions & 0 deletions app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.
type Mutation {
addConfigurableProductsToCart(input: AddConfigurableProductsToCartInput): AddConfigurableProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart")
}

type ConfigurableProduct implements ProductInterface, PhysicalProductInterface, CustomizableProductInterface @doc(description: "ConfigurableProduct defines basic features of a configurable product and its simple product variants") {
variants: [ConfigurableVariant] @doc(description: "An array of variants of products") @resolver(class: "Magento\\ConfigurableProductGraphQl\\Model\\Resolver\\ConfigurableVariant")
Expand Down Expand Up @@ -35,3 +38,30 @@ type ConfigurableProductOptionsValues @doc(description: "ConfigurableProductOpti
store_label: String @doc(description: "The label of the product on the current store")
use_default_value: Boolean @doc(description: "Indicates whether to use the default_label")
}

input AddConfigurableProductsToCartInput {
cart_id: String!
cartItems: [ConfigurableProductCartItemInput!]!
}

type AddConfigurableProductsToCartOutput {
cart: Cart!
}

input ConfigurableProductCartItemInput {
data: CartItemDetailsInput!
variant_sku: String!
customizable_options:[CustomizableOptionInput!]
}

type ConfigurableCartItem implements CartItemInterface {
customizable_options: [SelectedCustomizableOption]!
configurable_options: [SelectedConfigurableOption!]!
}

type SelectedConfigurableOption {
id: Int!
option_label: String!
value_id: Int!
value_label: String!
}
3 changes: 2 additions & 1 deletion app/code/Magento/Cookie/Helper/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class Cookie extends \Magento\Framework\App\Helper\AbstractHelper
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param array $data
*
* @throws \InvalidArgumentException
* @throws \Magento\Framework\Exception\LocalizedException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
Expand Down
8 changes: 5 additions & 3 deletions app/code/Magento/Customer/Model/ResourceModel/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class Group extends \Magento\Framework\Model\ResourceModel\Db\VersionControl\Abs

/**
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
* @param Snapshot $entitySnapshot,
* @param RelationComposite $entityRelationComposite,
* @param Snapshot $entitySnapshot
* @param RelationComposite $entityRelationComposite
* @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
* @param Customer\CollectionFactory $customersFactory
* @param string $connectionName
Expand Down Expand Up @@ -110,6 +110,8 @@ protected function _afterDelete(\Magento\Framework\Model\AbstractModel $group)
}

/**
* Create customers collection.
*
* @return \Magento\Customer\Model\ResourceModel\Customer\Collection
*/
protected function _createCustomersCollection()
Expand All @@ -131,7 +133,7 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $group)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
{
Expand Down
29 changes: 25 additions & 4 deletions app/code/Magento/Customer/Model/Vat.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,21 @@ public function checkVatNumber($countryCode, $vatNumber, $requesterCountryCode =
return $gatewayResponse;
}

$countryCodeForVatNumber = $this->getCountryCodeForVatNumber($countryCode);
$requesterCountryCodeForVatNumber = $this->getCountryCodeForVatNumber($requesterCountryCode);

try {
$soapClient = $this->createVatNumberValidationSoapClient();

$requestParams = [];
$requestParams['countryCode'] = $countryCode;
$requestParams['countryCode'] = $countryCodeForVatNumber;
$vatNumberSanitized = $this->isCountryInEU($countryCode)
? str_replace([' ', '-', $countryCode], ['', '', ''], $vatNumber)
? str_replace([' ', '-', $countryCodeForVatNumber], ['', '', ''], $vatNumber)
: str_replace([' ', '-'], ['', ''], $vatNumber);
$requestParams['vatNumber'] = $vatNumberSanitized;
$requestParams['requesterCountryCode'] = $requesterCountryCode;
$requestParams['requesterCountryCode'] = $requesterCountryCodeForVatNumber;
$reqVatNumSanitized = $this->isCountryInEU($requesterCountryCode)
? str_replace([' ', '-', $requesterCountryCode], ['', '', ''], $requesterVatNumber)
? str_replace([' ', '-', $requesterCountryCodeForVatNumber], ['', '', ''], $requesterVatNumber)
: str_replace([' ', '-'], ['', ''], $requesterVatNumber);
$requestParams['requesterVatNumber'] = $reqVatNumSanitized;
// Send request to service
Expand Down Expand Up @@ -301,4 +304,22 @@ public function isCountryInEU($countryCode, $storeId = null)
);
return in_array($countryCode, $euCountries);
}

/**
* Returns the country code to use in the VAT number which is not always the same as the normal country code
*
* @param string $countryCode
* @return string
*/
private function getCountryCodeForVatNumber(string $countryCode): string
{
// Greece uses a different code for VAT numbers then its country code
// See: http://ec.europa.eu/taxation_customs/vies/faq.html#item_11
// And https://en.wikipedia.org/wiki/VAT_identification_number:
// "The full identifier starts with an ISO 3166-1 alpha-2 (2 letters) country code
// (except for Greece, which uses the ISO 639-1 language code EL for the Greek language,
// instead of its ISO 3166-1 alpha-2 country code GR)"

return $countryCode === 'GR' ? 'EL' : $countryCode;
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Directory/Model/CurrencyConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(
*/
public function getConfigCurrencies(string $path)
{
$result = $this->appState->getAreaCode() === Area::AREA_ADMINHTML
$result = in_array($this->appState->getAreaCode(), [Area::AREA_ADMINHTML, Area::AREA_CRONTAB])
? $this->getConfigForAllStores($path)
: $this->getConfigForCurrentStore($path);
sort($result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ private function addDefaultCountryToOptions(array &$options)

foreach ($options as $key => $option) {
if (isset($defaultCountry[$option['value']])) {
$options[$key]['is_default'] = $defaultCountry[$option['value']];
$options[$key]['is_default'] = !empty($defaultCountry[$option['value']]);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function setUp()
}

/**
* Test get currency config for admin and storefront areas.
* Test get currency config for admin, crontab and storefront areas.
*
* @dataProvider getConfigCurrenciesDataProvider
* @return void
Expand All @@ -91,7 +91,7 @@ public function testGetConfigCurrencies(string $areCode)
->method('getCode')
->willReturn('testCode');

if ($areCode === Area::AREA_ADMINHTML) {
if (in_array($areCode, [Area::AREA_ADMINHTML, Area::AREA_CRONTAB])) {
$this->storeManager->expects(self::once())
->method('getStores')
->willReturn([$store]);
Expand Down Expand Up @@ -121,6 +121,7 @@ public function getConfigCurrenciesDataProvider()
{
return [
['areaCode' => Area::AREA_ADMINHTML],
['areaCode' => Area::AREA_CRONTAB],
['areaCode' => Area::AREA_FRONTEND],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
</thead>

<?php if ($_hasAssociatedProducts): ?>
<?php foreach ($_associatedProducts as $_item): ?>
<tbody>
<?php foreach ($_associatedProducts as $_item): ?>
<tr>
<td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
<strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
Expand Down Expand Up @@ -80,8 +80,8 @@
</td>
</tr>
<?php endif; ?>
</tbody>
<?php endforeach; ?>
</tbody>
<?php else: ?>
<tbody>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<argument name="message_block_visibility" xsi:type="string">true</argument>
<argument name="use_ajax" xsi:type="string">true</argument>
<argument name="save_parameters_in_session" xsi:type="string">1</argument>
<argument name="grid_url" xsi:type="url" path="*/*/grid"/>
</arguments>
<block class="Magento\Backend\Block\Widget\Grid\ColumnSet" name="adminhtml.newslettrer.problem.grid.columnSet" as="grid.columnSet">
<arguments>
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Quote/Model/ResourceModel/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class Quote extends AbstractDb

/**
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
* @param Snapshot $entitySnapshot,
* @param RelationComposite $entityRelationComposite,
* @param Snapshot $entitySnapshot
* @param RelationComposite $entityRelationComposite
* @param \Magento\SalesSequence\Model\Manager $sequenceManager
* @param string $connectionName
*/
Expand Down Expand Up @@ -296,7 +296,7 @@ public function markQuotesRecollect($productIds)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function save(\Magento\Framework\Model\AbstractModel $object)
{
Expand Down
Loading

0 comments on commit 5b3afb5

Please sign in to comment.