Skip to content

Commit

Permalink
Merge branch '2.2-develop' into 2.2-develop-pr24
Browse files Browse the repository at this point in the history
  • Loading branch information
serhii-balko committed Mar 18, 2019
2 parents 6948313 + 71e61a7 commit 3843a6c
Show file tree
Hide file tree
Showing 20 changed files with 495 additions and 192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public function getFieldSuffix()
* Retrieve current store id
*
* @return int
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
*/
public function getStoreId()
{
$storeId = $this->getRequest()->getParam('store');
return (int)$storeId;
return (int)$this->getRequest()->getParam('store');
}

/**
Expand All @@ -99,6 +99,8 @@ public function getTabLabel()
}

/**
* Return Tab title.
*
* @return \Magento\Framework\Phrase
*/
public function getTabTitle()
Expand All @@ -107,22 +109,24 @@ public function getTabTitle()
}

/**
* @return bool
* @inheritdoc
*/
public function canShowTab()
{
return true;
}

/**
* @return bool
* @inheritdoc
*/
public function isHidden()
{
return false;
}

/**
* Get availability status.
*
* @param string $fieldName
* @return bool
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
});
</script>

<?php
$defaultMinSaleQty = $block->getDefaultConfigValue('min_sale_qty');
if (!is_numeric($defaultMinSaleQty)) {
$defaultMinSaleQty = json_decode($defaultMinSaleQty, true);
$defaultMinSaleQty = (float) $defaultMinSaleQty[\Magento\Customer\Api\Data\GroupInterface::CUST_GROUP_ALL] ?? 1;
}
?>
<div class="fieldset-wrapper form-inline advanced-inventory-edit">
<div class="fieldset-wrapper-title">
<strong class="title">
Expand Down Expand Up @@ -132,7 +139,7 @@
<div class="field">
<input type="text" class="input-text validate-number" id="inventory_min_sale_qty"
name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[min_sale_qty]"
value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('min_sale_qty') * 1 ?>"
value="<?= /* @escapeNotVerified */ $defaultMinSaleQty ?>"
disabled="disabled"/>
</div>
<div class="field choice">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
method="post"
id="form-validate"
data-mage-init='{"Magento_Checkout/js/action/update-shopping-cart":
{"validationURL" : "/checkout/cart/updateItemQty"}
{"validationURL" : "/checkout/cart/updateItemQty",
"updateCartActionContainer": "#update_cart_action_container"}
}'
class="form form-cart">
<?= $block->getBlockHtml('formkey') ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ define([
$.widget('mage.updateShoppingCart', {
options: {
validationURL: '',
eventName: 'updateCartItemQty'
eventName: 'updateCartItemQty',
updateCartActionContainer: ''
},

/** @inheritdoc */
Expand All @@ -31,7 +32,9 @@ define([
* @return {Boolean}
*/
onSubmit: function (event) {
if (!this.options.validationURL) {
var action = this.element.find(this.options.updateCartActionContainer).val();

if (!this.options.validationURL || action === 'empty_cart') {
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ public function getDirsCollection($path)
$collection = $this->getCollection($path)
->setCollectDirs(true)
->setCollectFiles(false)
->setCollectRecursively(false);
->setCollectRecursively(false)
->setOrder('basename', \Magento\Framework\Data\Collection\Filesystem::SORT_ORDER_ASC);

$conditions = $this->getConditionsForExcludeDirs();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ protected function generalTestGetDirsCollection($path, $collectionArray = [], $e
->method('setCollectRecursively')
->with(false)
->willReturnSelf();
$storageCollectionMock->expects($this->once())
->method('setOrder')
->with('basename', \Magento\Framework\Data\Collection\Filesystem::SORT_ORDER_ASC)
->willReturnSelf();
$storageCollectionMock->expects($this->once())
->method('getIterator')
->willReturn(new \ArrayIterator($collectionArray));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*/
namespace Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier;

use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\Catalog\Model\Product\Attribute\Backend\Sku;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Framework\UrlInterface;
use Magento\Ui\Component\Container;
use Magento\Ui\Component\Form;
use Magento\Ui\Component\DynamicRows;
use Magento\Ui\Component\Form;
use Magento\Ui\Component\Modal;
use Magento\Framework\UrlInterface;
use Magento\Catalog\Model\Locator\LocatorInterface;

/**
* Data provider for Configurable panel
Expand Down Expand Up @@ -90,15 +90,15 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function modifyData(array $data)
{
return $data;
}

/**
* {@inheritdoc}
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function modifyMeta(array $meta)
Expand Down Expand Up @@ -197,7 +197,7 @@ public function modifyMeta(array $meta)
'autoRender' => false,
'componentType' => 'insertListing',
'component' => 'Magento_ConfigurableProduct/js'
.'/components/associated-product-insert-listing',
. '/components/associated-product-insert-listing',
'dataScope' => $this->associatedListingPrefix
. static::ASSOCIATED_PRODUCT_LISTING,
'externalProvider' => $this->associatedListingPrefix
Expand Down Expand Up @@ -328,14 +328,12 @@ protected function getButtonSet()
'component' => 'Magento_Ui/js/form/components/button',
'actions' => [
[
'targetName' =>
$this->dataScopeName . '.configurableModal',
'targetName' => $this->dataScopeName . '.configurableModal',
'actionName' => 'trigger',
'params' => ['active', true],
],
[
'targetName' =>
$this->dataScopeName . '.configurableModal',
'targetName' => $this->dataScopeName . '.configurableModal',
'actionName' => 'openModal',
],
],
Expand Down Expand Up @@ -574,6 +572,7 @@ protected function getColumn(
'dataType' => Form\Element\DataType\Text::NAME,
'dataScope' => $name,
'visibleIfCanEdit' => false,
'labelVisible' => false,
'imports' => [
'visible' => '!${$.provider}:${$.parentScope}.canEdit'
],
Expand All @@ -592,6 +591,7 @@ protected function getColumn(
'component' => 'Magento_Ui/js/form/components/group',
'label' => $label,
'dataScope' => '',
'showLabel' => false
];
$container['children'] = [
$name . '_edit' => $fieldEdit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ protected function _construct()
{
parent::_construct();
$this->setId('customer_orders_grid');
$this->setDefaultSort('created_at', 'desc');
$this->setDefaultSort('created_at');
$this->setDefaultDir('desc');
$this->setUseAjax(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ protected function _construct()
{
parent::_construct();
$this->setId('customer_view_cart_grid');
$this->setDefaultSort('added_at', 'desc');
$this->setDefaultSort('added_at');
$this->setDefaultDir('desc');
$this->setSortable(false);
$this->setPagerVisibility(false);
$this->setFilterVisibility(false);
Expand Down
8 changes: 5 additions & 3 deletions app/code/Magento/Eav/Model/Entity/AbstractEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1695,14 +1695,16 @@ public function saveAttribute(DataObject $object, $attributeCode)
$connection->beginTransaction();

try {
$select = $connection->select()->from($table, 'value_id')->where($where);
$origValueId = $connection->fetchOne($select);
$select = $connection->select()->from($table, ['value_id', 'value'])->where($where);
$origRow = $connection->fetchRow($select);
$origValueId = $origRow['value_id'] ?? false;
$origValue = $origRow['value'] ?? null;

if ($origValueId === false && $newValue !== null) {
$this->_insertAttribute($object, $attribute, $newValue);
} elseif ($origValueId !== false && $newValue !== null) {
$this->_updateAttribute($object, $attribute, $origValueId, $newValue);
} elseif ($origValueId !== false && $newValue === null) {
} elseif ($origValueId !== false && $newValue === null && $origValue !== null) {
$connection->delete($table, $where);
}
$this->_processAttributeValues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public function getDateRange($range, $customStart, $customEnd, $returnObjects =
break;

case 'custom':
$dateStart = $customStart ? $customStart : $dateEnd;
$dateStart = $customStart ? $customStart : $dateStart;
$dateEnd = $customEnd ? $customEnd : $dateEnd;
break;

Expand Down
Loading

0 comments on commit 3843a6c

Please sign in to comment.