Skip to content

Commit

Permalink
Merge remote-tracking branch 'engcom-Hotel/grid_search_selectall_issu…
Browse files Browse the repository at this point in the history
…e' into grid_search_selectall_issue
  • Loading branch information
engcom-Hotel committed Sep 10, 2020
2 parents f019712 + 8a9546f commit 4a20d6e
Show file tree
Hide file tree
Showing 61 changed files with 1,115 additions and 113 deletions.
8 changes: 7 additions & 1 deletion app/code/Magento/Bundle/Model/Product/LinksList.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function __construct(
}

/**
* Bundle Product Items Data
*
* @param \Magento\Catalog\Api\Data\ProductInterface $product
* @param int $optionId
* @return \Magento\Bundle\Api\Data\LinkInterface[]
Expand All @@ -50,8 +52,12 @@ public function getItems(\Magento\Catalog\Api\Data\ProductInterface $product, $o
$productLinks = [];
/** @var \Magento\Catalog\Model\Product $selection */
foreach ($selectionCollection as $selection) {
$bundledProductPrice = $selection->getSelectionPriceValue();
if ($bundledProductPrice <= 0) {
$bundledProductPrice = $selection->getPrice();
}
$selectionPriceType = $product->getPriceType() ? $selection->getSelectionPriceType() : null;
$selectionPrice = $product->getPriceType() ? $selection->getSelectionPriceValue() : null;
$selectionPrice = $bundledProductPrice ? $bundledProductPrice : null;

/** @var \Magento\Bundle\Api\Data\LinkInterface $productLink */
$productLink = $this->linkFactory->create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function testLinksList()
->method('getSelectionsCollection')
->with([$optionId], $this->productMock)
->willReturn([$this->selectionMock]);
$this->productMock->expects($this->exactly(2))->method('getPriceType')->willReturn('price_type');
$this->productMock->expects($this->once())->method('getPriceType')->willReturn('price_type');
$this->selectionMock->expects($this->once())
->method('getSelectionPriceType')
->willReturn('selection_price_type');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ $_helper = $block->getData('outputHelper');
<?= $block->getBlockHtml('formkey') ?>
<button type="submit"
title="<?= $escaper->escapeHtmlAttr(__('Add to Cart')) ?>"
class="action tocart primary">
class="action tocart primary"
disabled>
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ define([
if (this.options.bindSubmit) {
this._bindSubmit();
}
$(this.options.addToCartButtonSelector).attr('disabled', false);
},

/**
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Contact/view/frontend/templates/form.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ $viewModel = $block->getViewModel();
class="input-text"
cols="5"
rows="3"
data-validate="{required:true}"><?= $block->escapeHtml($viewModel->getUserComment()) ?>
</textarea>
data-validate="{required:true}"
><?= $block->escapeHtml($viewModel->getUserComment()) ?></textarea>
</div>
</div>
<?= $block->getChildHtml('form.additional.info') ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ protected function _prepareLayout()
]
);

$onClick = "setLocation('" . $this->getUrl('adminhtml/system_config/edit/section/currency') . "')";
$currencyOptionPath = $this->getUrl(
'adminhtml/system_config/edit',
[
'section' => 'currency',
'_fragment' => 'currency_options-link'
]
);
$onClick = "setLocation('$currencyOptionPath')";

$this->getToolbar()->addChild(
'options_button',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminNavigateToCurrencyRatesOptionActionGroup">
<click selector="{{AdminCurrencyRatesSection.options}}" stepKey="clickOptionsButton"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<section name="AdminCurrencyRatesSection">
<element name="import" type="button" selector="//button[@title='Import']"/>
<element name="saveCurrencyRates" type="button" selector="//button[@title='Save Currency Rates']"/>
<element name="options" type="button" selector="//button[@title='Options']"/>
<element name="oldRate" type="text" selector="//div[contains(@class, 'admin__field-note') and contains(text(), 'Old rate:')]/strong"/>
<element name="rateService" type="select" selector="#rate_services"/>
<element name="currencyRate" type="input" selector="input[name='rate[{{fistCurrency}}][{{secondCurrency}}]']" parameterized="true"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminCurrencyOptionsSystemConfigExpandedTabTest">
<annotations>
<features value="Expanded tab on Currency Option page"/>
<stories value="Expanded tab"/>
<title value=" Verify the Currency Option tab expands automatically."/>
<description value="Check auto open the collapse on Currency Option page."/>
<severity value="MINOR"/>
<testCaseId value="MC-37425"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresCurrencyRatesPage">
<argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/>
<argument name="submenuUiId" value="{{AdminMenuStoresCurrencyCurrencyRates.dataUiId}}"/>
</actionGroup>
<actionGroup ref="AdminNavigateToCurrencyRatesOptionActionGroup" stepKey="navigateToOptions" />
<grabAttributeFrom selector="{{CurrencySetupSection.currencyOptions}}" userInput="class" stepKey="grabClass"/>
<assertStringContainsString stepKey="assertClass">
<actualResult type="string">{$grabClass}</actualResult>
<expectedResult type="string">open</expectedResult>
</assertStringContainsString>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@

namespace Magento\CurrencySymbol\Test\Unit\Block\Adminhtml\System;

use Magento\Backend\Block\Template\Context;
use Magento\Backend\Block\Widget\Button;
use Magento\CurrencySymbol\Block\Adminhtml\System\Currency;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Framework\View\Element\BlockInterface;
use Magento\Framework\View\LayoutInterface;
use PHPUnit\Framework\TestCase;
use Magento\Framework\UrlInterface;

class CurrencyTest extends TestCase
{
/**
* Stub currency option link url
*/
const STUB_OPTION_LINK_URL = 'https://localhost/admin/system_config/edit/section/currency#currency_options-link';

/**
* Object manager helper
*
Expand Down Expand Up @@ -70,12 +77,25 @@ public function testPrepareLayout()
]
);

$contextMock = $this->createMock(Context::class);
$urlBuilderMock = $this->createMock(UrlInterface::class);

$contextMock->expects($this->once())->method('getUrlBuilder')->willReturn($urlBuilderMock);

$urlBuilderMock->expects($this->once())->method('getUrl')->with(
'adminhtml/system_config/edit',
[
'section' => 'currency',
'_fragment' => 'currency_options-link'
]
)->willReturn(self::STUB_OPTION_LINK_URL);

$childBlockMock->expects($this->at(1))
->method('addChild')
->with(
'options_button',
Button::class,
['label' => __('Options'), 'onclick' => 'setLocation(\'\')']
['label' => __('Options'), 'onclick' => 'setLocation(\''.self::STUB_OPTION_LINK_URL.'\')']
);

$childBlockMock->expects($this->at(2))
Expand All @@ -90,7 +110,8 @@ public function testPrepareLayout()
$block = $this->objectManagerHelper->getObject(
Currency::class,
[
'layout' => $layoutMock
'layout' => $layoutMock,
'context' => $contextMock
]
);
$block->setLayout($layoutMock);
Expand Down
8 changes: 7 additions & 1 deletion app/code/Magento/Eav/Model/Entity/AbstractEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,8 @@ protected function _isApplicableAttribute($object, $attribute)
public function walkAttributes($partMethod, array $args = [], $collectExceptionMessages = null)
{
$methodArr = explode('/', $partMethod);
$part = '';
$method = '';
switch (count($methodArr)) {
case 1:
$part = 'attribute';
Expand All @@ -642,6 +644,7 @@ public function walkAttributes($partMethod, array $args = [], $collectExceptionM
}
$results = [];
$suffix = $this->getAttributesCacheSuffix($args[0]);
$instance = null;
foreach ($this->getAttributesByScope($suffix) as $attrCode => $attribute) {
if (isset($args[0]) && is_object($args[0]) && !$this->_isApplicableAttribute($args[0], $attribute)) {
continue;
Expand Down Expand Up @@ -1337,7 +1340,9 @@ protected function _collectSaveData($newObject)
if ($this->_canUpdateAttribute($attribute, $v, $origData)) {
if ($this->_isAttributeValueEmpty($attribute, $v)) {
$this->_aggregateDeleteData($delete, $attribute, $newObject);
} elseif (!is_numeric($v) && $v !== $origData[$k] || is_numeric($v) && $v != $origData[$k]) {
} elseif (!is_numeric($v) && $v !== $origData[$k]
|| is_numeric($v) && ($v != $origData[$k] || strlen($v) !== strlen($origData[$k]))
) {
$update[$attrId] = [
'value_id' => $attribute->getBackend()->getEntityValueId($newObject),
'value' => is_array($v) ? array_shift($v) : $v,//@TODO: MAGETWO-44182,
Expand Down Expand Up @@ -1739,6 +1744,7 @@ public function delete($object)
{
try {
$connection = $this->transactionManager->start($this->getConnection());
$id = 0;
if (is_numeric($object)) {
$id = (int) $object;
} elseif ($object instanceof \Magento\Framework\Model\AbstractModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@ protected function prepareIndex($storeId, $indexName, $mappedIndexerId)
*/
private function getMappingTotalFieldsLimit(array $allAttributeTypes): int
{
return count($allAttributeTypes) + self::MAPPING_TOTAL_FIELDS_BUFFER_LIMIT;
$count = count($allAttributeTypes);
foreach ($allAttributeTypes as $attributeType) {
if (isset($attributeType['fields'])) {
$count += count($attributeType['fields']);
}
}
return $count + self::MAPPING_TOTAL_FIELDS_BUFFER_LIMIT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,14 @@ protected function setUp(): void
->method('getAllAttributesTypes')
->willReturn(
[
'name' => 'string',
'name' => [
'type' => 'string',
'fields' => [
'keyword' => [
'type' => "keyword",
],
],
],
]
);
$this->clientConfig->expects($this->any())
Expand Down Expand Up @@ -564,6 +571,28 @@ public function testUpdateIndexMappingWithAliasDefinition(): void
$this->model->updateIndexMapping($storeId, $mappedIndexerId, $attributeCode);
}

/**
* Test for get mapping total fields limit
*
* @return void
*/
public function testGetMappingTotalFieldsLimit(): void
{
$settings = [
'index' => [
'mapping' => [
'total_fields' => [
'limit' => 1002
]
]
]
];
$this->client->expects($this->at(1))
->method('createIndex')
->with(null, ['settings' => $settings]);
$this->model->cleanIndex(1, 'product');
}

/**
* Get elasticsearch client options
*
Expand Down
26 changes: 14 additions & 12 deletions app/code/Magento/Sales/Model/ResourceModel/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ protected function _construct()

/**
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
* @param Attribute $attribute
* @param Manager $sequenceManager
* @param Snapshot $entitySnapshot
* @param RelationComposite $entityRelationComposite
* @param Attribute $attribute
* @param Manager $sequenceManager
* @param StateHandler $stateHandler
* @param string $connectionName
* @param string|null $connectionName
*/
public function __construct(
\Magento\Framework\Model\ResourceModel\Db\Context $context,
Expand Down Expand Up @@ -137,6 +137,8 @@ protected function calculateItems(\Magento\Sales\Model\Order $object)
}

/**
* Before save
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return $this
*/
Expand All @@ -152,15 +154,15 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
];
$object->setStoreName(implode(PHP_EOL, $name));
$object->setTotalItemCount($this->calculateItems($object));
$object->setData(
'protect_code',
substr(
hash('sha256', uniqid(Random::getRandomNumber(), true) . ':' . microtime(true)),
5,
32
)
);
}
$object->setData(
'protect_code',
substr(
hash('sha256', uniqid(Random::getRandomNumber(), true) . ':' . microtime(true)),
5,
32
)
);
$isNewCustomer = !$object->getCustomerId() || $object->getCustomerId() === true;
if ($isNewCustomer && $object->getCustomer()) {
$object->setCustomerId($object->getCustomer()->getId());
Expand All @@ -169,7 +171,7 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function save(\Magento\Framework\Model\AbstractModel $object)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
use Magento\Framework\View\Result\Layout;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\App\Action\HttpPostActionInterface;

/**
* Export Coupons to csv file
*
* Class \Magento\SalesRule\Controller\Adminhtml\Promo\Quote\ExportCouponsCsv
*/
class ExportCouponsCsv extends Quote implements HttpGetActionInterface
class ExportCouponsCsv extends Quote implements HttpGetActionInterface, HttpPostActionInterface
{
/**
* Export coupon codes as CSV file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
use Magento\Framework\View\Result\Layout;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\App\Action\HttpPostActionInterface;

/**
* Export coupons to xml file
*
* Class \Magento\SalesRule\Controller\Adminhtml\Promo\Quote\ExportCouponsXml
*/
class ExportCouponsXml extends Quote implements HttpGetActionInterface
class ExportCouponsXml extends Quote implements HttpGetActionInterface, HttpPostActionInterface
{
/**
* Export coupon codes as excel xml file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ define([
* @returns {Object} Chainable
*/
toggleListVisible: function () {
this.listVisible(!this.listVisible());
this.listVisible(!this.disabled() && !this.listVisible());

return this;
},
Expand Down
Loading

0 comments on commit 4a20d6e

Please sign in to comment.