Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/develop' into bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhiy Shkolyarenko committed Oct 22, 2015
2 parents 4dd6188 + e0a56a7 commit 2317aa3
Show file tree
Hide file tree
Showing 190 changed files with 2,780 additions and 816 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,25 @@ public function render(\Magento\Framework\DataObject $row)
{
$values = $this->_getValues();
$value = $row->getData($this->getColumn()->getIndex());
$checked = '';
if (is_array($values)) {
$checked = in_array($value, $values) ? ' checked="checked"' : '';
} else {
$checked = $value === $this->getColumn()->getValue() ? ' checked="checked"' : '';
$checkedValue = $this->getColumn()->getValue();
if ($checkedValue !== null) {
$checked = $value === $checkedValue ? ' checked="checked"' : '';
}
}

$disabled = '';
$disabledValues = $this->getColumn()->getDisabledValues();
if (is_array($disabledValues)) {
$disabled = in_array($value, $disabledValues) ? ' disabled="disabled"' : '';
} else {
$disabled = $value === $this->getColumn()->getDisabledValue() ? ' disabled="disabled"' : '';
$disabledValue = $this->getColumn()->getDisabledValue();
if ($disabledValue !== null) {
$disabled = $value === $disabledValue ? ' disabled="disabled"' : '';
}
}

$this->setDisabled($disabled);
Expand All @@ -108,15 +116,18 @@ public function render(\Magento\Framework\DataObject $row)
*/
protected function _getCheckboxHtml($value, $checked)
{
$html = '<input type="checkbox" ';
$html = '<label class="data-grid-checkbox-cell-inner" ';
$html .= ' for="id_' . $this->escapeHtml($value) . '">';
$html .= '<input type="checkbox" ';
$html .= 'name="' . $this->getColumn()->getFieldName() . '" ';
$html .= 'value="' . $this->escapeHtml($value) . '" ';
$html .= 'id="id_' . $this->escapeHtml($value) . '" ';
$html .= 'class="' .
($this->getColumn()->getInlineCss() ? $this->getColumn()->getInlineCss() : 'checkbox') .
' admin__control-checkbox' .
'"';
' admin__control-checkbox' . '"';
$html .= $checked . $this->getDisabled() . '/>';
$html .= '<label></label>';
$html .= '<label for="id_' . $this->escapeHtml($value) . '"></label>';
$html .= '</label>';
/* ToDo UI: add class="admin__field-label" after some refactoring _fields.less */
return $html;
}
Expand Down
16 changes: 8 additions & 8 deletions app/code/Magento/Backend/Model/Session/AdminConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class AdminConfig extends Config
protected $_frontNameResolver;

/**
* @var \Magento\Store\Model\StoreManagerInterface
* @var \Magento\Backend\App\BackendAppList
*/
protected $_storeManager;
private $backendAppList;

/**
* @var \Magento\Backend\App\BackendAppList
* @var \Magento\Backend\Model\UrlFactory
*/
private $backendAppList;
private $backendUrlFactory;

/**
* @param \Magento\Framework\ValidatorFactory $validatorFactory
Expand All @@ -49,7 +49,7 @@ class AdminConfig extends Config
* @param string $scopeType
* @param \Magento\Backend\App\BackendAppList $backendAppList
* @param FrontNameResolver $frontNameResolver
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Backend\Model\UrlFactory $backendUrlFactory
* @param string $lifetimePath
* @param string $sessionName
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
Expand All @@ -64,7 +64,7 @@ public function __construct(
$scopeType,
\Magento\Backend\App\BackendAppList $backendAppList,
FrontNameResolver $frontNameResolver,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Backend\Model\UrlFactory $backendUrlFactory,
$lifetimePath = self::XML_PATH_COOKIE_LIFETIME,
$sessionName = self::SESSION_NAME_ADMIN
) {
Expand All @@ -79,8 +79,8 @@ public function __construct(
$lifetimePath
);
$this->_frontNameResolver = $frontNameResolver;
$this->_storeManager = $storeManager;
$this->backendAppList = $backendAppList;
$this->backendUrlFactory = $backendUrlFactory;
$adminPath = $this->extractAdminPath();
$this->setCookiePath($adminPath);
$this->setName($sessionName);
Expand All @@ -95,7 +95,7 @@ private function extractAdminPath()
{
$backendApp = $this->backendAppList->getCurrentApp();
$cookiePath = null;
$baseUrl = parse_url($this->_storeManager->getStore()->getBaseUrl(), PHP_URL_PATH);
$baseUrl = parse_url($this->backendUrlFactory->create()->getBaseUrl(), PHP_URL_PATH);
if (!$backendApp) {
$cookiePath = $baseUrl . $this->_frontNameResolver->getFrontName();
return $cookiePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class AdminConfigTest extends \PHPUnit_Framework_TestCase
private $objectManager;

/**
* @var \Magento\Store\Model\StoreManagerInterface | \PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Backend\Model\UrlFactory | \PHPUnit_Framework_MockObject_MockObject
*/
private $storeManagerMock;
private $backendUrlFactory;

/**
* @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject
Expand All @@ -56,13 +56,10 @@ protected function setUp()
$this->validatorFactory = $this->getMockBuilder('Magento\Framework\ValidatorFactory')
->disableOriginalConstructor()
->getMock();

$storeMock = $this->getMockBuilder('\Magento\Store\Model\Store')
->disableOriginalConstructor()
->getMock();
$storeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('/'));
$this->storeManagerMock = $this->getMockForAbstractClass('\Magento\Store\Model\StoreManagerInterface');
$this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock));
$backendUrl = $this->getMock('\Magento\Backend\Model\Url', [], [], '', false);
$backendUrl->expects($this->once())->method('getBaseUrl')->will($this->returnValue('/'));
$this->backendUrlFactory = $this->getMock('Magento\Backend\Model\UrlFactory', ['create'], [], '', false);
$this->backendUrlFactory->expects($this->any())->method('create')->willReturn($backendUrl);

$this->filesystemMock = $this->getMock('\Magento\Framework\Filesystem', [], [], '', false);
$dirMock = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface');
Expand Down Expand Up @@ -99,7 +96,7 @@ public function testSetCookiePathNonDefault()
'validatorFactory' => $this->validatorFactory,
'request' => $this->requestMock,
'frontNameResolver' => $mockFrontNameResolver,
'storeManager' => $this->storeManagerMock,
'backendUrlFactory' => $this->backendUrlFactory,
'filesystem' => $this->filesystemMock,
]
);
Expand Down Expand Up @@ -134,7 +131,7 @@ public function testSetSessionNameByConstructor()
'validatorFactory' => $this->validatorFactory,
'request' => $this->requestMock,
'sessionName' => $sessionName,
'storeManager' => $this->storeManagerMock,
'backendUrlFactory' => $this->backendUrlFactory,
'filesystem' => $this->filesystemMock,
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (!isset($advancedLabel)) {
$advancedLabel = __('Additional Settings');
}

$cssClass = ($isField) ? 'field ' . $element->getClass() : 'fieldset admin__fieldset' . $element->getClass();
$cssClass = ($isField) ? 'field ' . $element->getClass() : 'fieldset admin__fieldset ' . $element->getClass();

if ($isField) {
$count = $element->getCountBasicChildren();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@
<!-- ko if: (isCcDetectionEnabled())-->
<ul class="credit-card-types">
<!-- ko foreach: {data: getCcAvailableTypesValues(), as: 'item'} -->
<li class="item" data-bind="css: {_active: $parent.selectedCardType() == item.value} ">
<li class="item" data-bind="css: {
_active: $parent.selectedCardType() == item.value,
_inactive: $parent.selectedCardType() != null && $parent.selectedCardType() != item.value
} ">
<!--ko if: $parent.getIcons(item.value) -->
<img data-bind="attr: {
'src': $parent.getIcons(item.value).url,
Expand Down
5 changes: 5 additions & 0 deletions app/code/Magento/Catalog/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,11 @@
</argument>
</arguments>
</type>
<type name="Magento\Catalog\Console\Command\ImagesResizeCommand">
<arguments>
<argument name="productRepository" xsi:type="object">Magento\Catalog\Api\ProductRepositoryInterface\Proxy</argument>
</arguments>
</type>
<type name="Magento\Framework\Config\View">
<arguments>
<argument name="xpath" xsi:type="array">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@
click: function () {
(function ($) {
$.ajax({
url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>//',
url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>',
method: 'POST',
data: pd.join(""),
showLoader: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,5 @@ define([
}
};

jQuery(document).ready(function(){
productConfigure = new ProductConfigure();
});

productConfigure = new ProductConfigure();
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\CatalogSearch\Model\Adapter\Mysql\Filter;

use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
use Magento\CatalogSearch\Model\Search\TableMapper;
use Magento\Eav\Model\Config;
use Magento\Framework\App\ResourceConnection;
Expand Down Expand Up @@ -97,7 +98,7 @@ public function process(FilterInterface $filter, $isNegation, $query)
*/
private function processQueryWithField(FilterInterface $filter, $isNegation, $query)
{
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */
/** @var Attribute $attribute */
$attribute = $this->config->getAttribute(Product::ENTITY, $filter->getField());
if ($filter->getField() === 'price') {
$resultQuery = str_replace(
Expand All @@ -114,24 +115,16 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
$this->connection->quoteIdentifier($alias . '.' . $attribute->getAttributeCode()),
$query
);
} elseif ($filter->getType() === FilterInterface::TYPE_TERM
&& in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true)
} elseif (
$filter->getType() === FilterInterface::TYPE_TERM &&
in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true)
) {
$alias = $this->tableMapper->getMappingAlias($filter);
if (is_array($filter->getValue())) {
$value = sprintf(
'%s IN (%s)',
($isNegation ? 'NOT' : ''),
implode(',', $filter->getValue())
);
} else {
$value = ($isNegation ? '!' : '') . '= ' . $filter->getValue();
}
$resultQuery = sprintf(
'%1$s.value %2$s',
$alias,
$value
);
$resultQuery = $this->processTermSelect($filter, $isNegation);
} elseif (
$filter->getType() === FilterInterface::TYPE_RANGE &&
in_array($attribute->getBackendType(), ['decimal', 'int'], true)
) {
$resultQuery = $this->processRangeNumeric($filter, $query, $attribute);
} else {
$table = $attribute->getBackendTable();
$select = $this->connection->select();
Expand Down Expand Up @@ -161,4 +154,57 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu

return $resultQuery;
}

/**
* @param FilterInterface $filter
* @param string $query
* @param Attribute $attribute
* @return string
*/
private function processRangeNumeric(FilterInterface $filter, $query, $attribute)
{
$tableSuffix = $attribute->getBackendType() === 'decimal' ? '_decimal' : '';
$table = $this->resource->getTableName("catalog_product_index_eav{$tableSuffix}");
$select = $this->connection->select();

$currentStoreId = $this->scopeResolver->getScope()->getId();

$select->from(['main_table' => $table], 'entity_id')
->columns([$filter->getField() => 'main_table.value'])
->where('main_table.attribute_id = ?', $attribute->getAttributeId())
->where('main_table.store_id = ?', $currentStoreId)
->having($query);

$resultQuery = 'search_index.entity_id IN (
select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter
)';

return $resultQuery;
}

/**
* @param FilterInterface $filter
* @param bool $isNegation
* @return string
*/
private function processTermSelect(FilterInterface $filter, $isNegation)
{
$alias = $this->tableMapper->getMappingAlias($filter);
if (is_array($filter->getValue())) {
$value = sprintf(
'%s IN (%s)',
($isNegation ? 'NOT' : ''),
implode(',', $filter->getValue())
);
} else {
$value = ($isNegation ? '!' : '') . '= ' . $filter->getValue();
}
$resultQuery = sprintf(
'%1$s.value %2$s',
$alias,
$value
);

return $resultQuery;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
newAttributeSetContainer = $('[data-role=affected-attribute-set-new-name-container]'),
existingAttributeSetContainer = $('[data-role=affected-attribute-set-existing-name-container]');

$form.find('input[type=text]').on('keypress',function(e){
if(e.keyCode === 13){
e.preventDefault();
$form.closest('[data-role=modal]').find('button[data-action=confirm]').click();
}
});

$('[data-form=edit-product]').append($('<input>', {
type: 'hidden',
Expand All @@ -48,6 +54,9 @@
},
buttons: [{
text: '<?php /* @escapeNotVerified */ echo __('Confirm'); ?>',
attr: {
'data-action': 'confirm'
},
'class': 'action-secondary',
click: function() {
var affectedAttributeSetId = $form.find('input[name=affected-attribute-set]:checked').val();
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Cookie/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-cookie",
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0|~5.6.0",
"php": "~5.5.0|~5.6.0|~7.0.0",
"magento/module-store": "1.0.0-beta",
"magento/framework": "1.0.0-beta"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public function __construct(
) {
parent::__construct();
$this->customerCollectionFactory = $customerCollectionFactory;
$this->collection = $customerCollectionFactory->create();
$this->encryptor = $encryptor;
}

Expand All @@ -58,6 +57,7 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->collection = $this->customerCollectionFactory->create();
$this->collection->addAttributeToSelect('*');
$customerCollection = $this->collection->getItems();
/** @var $customer Customer */
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Deploy/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-deploy",
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0",
"php": "~5.5.0|~5.6.0|~7.0.0",
"magento/framework": "1.0.0-beta",
"magento/module-developer": "1.0.0-beta",
"magento/module-store": "1.0.0-beta",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/DownloadableImportExport/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-downloadable-import-export",
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0",
"php": "~5.5.0|~5.6.0|~7.0.0",
"magento/module-catalog": "1.0.0-beta",
"magento/module-import-export": "1.0.0-beta",
"magento/module-catalog-import-export": "1.0.0-beta",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/EncryptionKey/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-encryption-key",
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0",
"php": "~5.5.0|~5.6.0|~7.0.0",
"magento/module-config": "1.0.0-beta",
"magento/module-backend": "1.0.0-beta",
"magento/framework": "1.0.0-beta"
Expand Down
Loading

0 comments on commit 2317aa3

Please sign in to comment.