Skip to content

Commit

Permalink
Merge pull request magento#11 from magento/2.1-develop
Browse files Browse the repository at this point in the history
2.1 develop pull
  • Loading branch information
ronak2ram authored Jul 23, 2018
2 parents b5f47a1 + ff04f26 commit bbdda7f
Show file tree
Hide file tree
Showing 171 changed files with 733 additions and 282 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Magento is thankful for any contribution that can improve our code base, documen

<h2>Reporting security issues</h2>

To report security vulnerabilities in Magento software or web sites, please e-mail <a href="mailto:security@magento.com">security@magento.com</a>. Please do not report security issues using GitHub. Be sure to encrypt your e-mail with our <a href="https://info2.magento.com/rs/magentoenterprise/images/security_at_magento.asc">encryption key</a> if it includes sensitive information. Learn more about reporting security issues <a href="https://magento.com/security/reporting-magento-security-issue">here</a>.
To report security vulnerabilities in Magento software or web sites, please create a Bugcrowd researcher account <a href="https://bugcrowd.com/magento">there</a> to submit and follow-up your issue. Learn more about reporting security issues <a href="https://magento.com/security/reporting-magento-security-issue">here</a>.

Stay up-to-date on the latest vulnerabilities and patches for Magento by signing up for <a href="https://magento.com/security/sign-up">Security Alert Notifications</a>.

Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ protected function saveAndReplaceAdvancedPrices()
),
'qty' => $rowData[self::COL_TIER_PRICE_QTY],
'value' => $rowData[self::COL_TIER_PRICE],
'website_id' => $this->getWebsiteId($rowData[self::COL_TIER_PRICE_WEBSITE])
'website_id' => $this->getWebSiteId($rowData[self::COL_TIER_PRICE_WEBSITE])
];
}
}
Expand Down
11 changes: 7 additions & 4 deletions app/code/Magento/Authorizenet/Model/Directpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -820,11 +820,14 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = ''
{
try {
$response = $this->getResponse();
if (
$voidPayment && $response->getXTransId() && strtoupper($response->getXType())
== self::REQUEST_TYPE_AUTH_ONLY
if ($voidPayment
&& $response->getXTransId()
&& strtoupper($response->getXType()) == self::REQUEST_TYPE_AUTH_ONLY
) {
$order->getPayment()->setTransactionId(null)->setParentTransactionId($response->getXTransId())->void();
$order->getPayment()
->setTransactionId(null)
->setParentTransactionId($response->getXTransId())
->void($response);
}
$order->registerCancellation($message)->save();
} catch (\Exception $e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function _prepareForm()
['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]
);

$this->_prepareStoreFieldSet($form);
$this->_prepareStoreFieldset($form);

$form->addField(
'store_type',
Expand Down
20 changes: 12 additions & 8 deletions app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,18 @@ protected function _toHtml()
if (!$this->_depends) {
return '';
}
return '<script>
require(["mage/adminhtml/form"], function(){
new FormElementDependenceController(' .
$this->_getDependsJson() .
($this->_configOptions ? ', ' .
$this->_jsonEncoder->encode(
$this->_configOptions
) : '') . '); });</script>';

$params = $this->_getDependsJson();

if ($this->_configOptions) {
$params .= ', ' . $this->_jsonEncoder->encode($this->_configOptions);
}

return "<script>
require(['mage/adminhtml/form'], function(){
new FormElementDependenceController({$params});
});
</script>";
}

/**
Expand Down
114 changes: 95 additions & 19 deletions app/code/Magento/Backend/Block/Widget/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public function addTab($tabId, $tab)
if (empty($tabId)) {
throw new \Exception(__('Please correct the tab configuration and try again. Tab Id should be not empty'));
}

if (is_array($tab)) {
$this->_tabs[$tabId] = new \Magento\Framework\DataObject($tab);
} elseif ($tab instanceof \Magento\Framework\DataObject) {
Expand All @@ -123,13 +124,15 @@ public function addTab($tabId, $tab)
}
} elseif (is_string($tab)) {
$this->_addTabByName($tab, $tabId);

if (!$this->_tabs[$tabId] instanceof TabInterface) {
unset($this->_tabs[$tabId]);
return $this;
}
} else {
throw new \Exception(__('Please correct the tab configuration and try again.'));
}

if ($this->_tabs[$tabId]->getUrl() === null) {
$this->_tabs[$tabId]->setUrl('#');
}
Expand All @@ -140,10 +143,7 @@ public function addTab($tabId, $tab)

$this->_tabs[$tabId]->setId($tabId);
$this->_tabs[$tabId]->setTabId($tabId);

if ($this->_activeTab === null) {
$this->_activeTab = $tabId;
}

if (true === $this->_tabs[$tabId]->getActive()) {
$this->setActiveTab($tabId);
}
Expand Down Expand Up @@ -232,33 +232,109 @@ protected function _setActiveTab($tabId)
*/
protected function _beforeToHtml()
{
$this->_tabs = $this->reorderTabs();

if ($activeTab = $this->getRequest()->getParam('active_tab')) {
$this->setActiveTab($activeTab);
} elseif ($activeTabId = $this->_authSession->getActiveTabId()) {
$this->_setActiveTab($activeTabId);
}

$_new = [];
if ($this->_activeTab === null && !empty($this->_tabs)) {
/** @var TabInterface $tab */
$tab = reset($this->_tabs);
$this->_activeTab = $tab->getId();
}

$this->assign('tabs', $this->_tabs);
return parent::_beforeToHtml();
}

/**
* Reorder the tabs.
*
* @return array
*/
private function reorderTabs()
{
$orderByIdentity = [];
$orderByPosition = [];
$position = 100;

/**
* Set the initial positions for each tab.
*
* @var string $key
* @var TabInterface $tab
*/
foreach ($this->_tabs as $key => $tab) {
foreach ($this->_tabs as $k => $t) {
if ($t->getAfter() == $key) {
$_new[$key] = $tab;
$_new[$k] = $t;
} else {
if (!$tab->getAfter() || !in_array($tab->getAfter(), array_keys($this->_tabs))) {
$_new[$key] = $tab;
}
}
}
$tab->setPosition($position);

$orderByIdentity[$key] = $tab;
$orderByPosition[$position] = $tab;

$position += 100;
}

$this->_tabs = $_new;
unset($_new);
return $this->applyTabsCorrectOrder($orderByPosition, $orderByIdentity);
}

/**
* @param array $orderByPosition
* @param array $orderByIdentity
*
* @return array
*/
private function applyTabsCorrectOrder(array $orderByPosition, array $orderByIdentity)
{
$positionFactor = 1;

/**
* Rearrange the positions by using the after tag for each tab.
*
* @var integer $position
* @var TabInterface $tab
*/
foreach ($orderByPosition as $position => $tab) {
if (!$tab->getAfter() || !in_array($tab->getAfter(), array_keys($orderByIdentity))) {
$positionFactor = 1;
continue;
}

$grandPosition = $orderByIdentity[$tab->getAfter()]->getPosition();
$newPosition = $grandPosition + $positionFactor;

$this->assign('tabs', $this->_tabs);
return parent::_beforeToHtml();
unset($orderByPosition[$position]);
$orderByPosition[$newPosition] = $tab;
$tab->setPosition($newPosition);

$positionFactor++;
}

return $this->finalTabsSortOrder($orderByPosition);
}

/**
* Apply the last sort order to tabs.
*
* @param array $orderByPosition
*
* @return array
*/
private function finalTabsSortOrder(array $orderByPosition)
{
ksort($orderByPosition);

$ordered = [];

/** @var TabInterface $tab */
foreach ($orderByPosition as $tab) {
$ordered[$tab->getId()] = $tab;
}

return $ordered;
}

/**
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public function execute()
$user = $this->_objectManager->create('Magento\User\Model\User')->load($userId);

$user->setId($userId)
->setUsername($this->getRequest()->getParam('username', false))
->setFirstname($this->getRequest()->getParam('firstname', false))
->setLastname($this->getRequest()->getParam('lastname', false))
->setUserName($this->getRequest()->getParam('username', false))
->setFirstName($this->getRequest()->getParam('firstname', false))
->setLastName($this->getRequest()->getParam('lastname', false))
->setEmail(strtolower($this->getRequest()->getParam('email', false)));

if ($this->_objectManager->get('Magento\Framework\Validator\Locale')->isValid($interfaceLocale)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
data-mage-init='{"dropdown":{}}'
data-toggle="dropdown">
<span class="admin__action-dropdown-text">
<span class="admin-user-account-text"><?php echo $block->escapeHtml($block->getUser()->getUsername()); ?></span>
<span class="admin-user-account-text"><?php echo $block->escapeHtml($block->getUser()->getUserName()); ?></span>
</span>
</a>
<ul class="admin__action-dropdown-menu">
Expand All @@ -39,7 +39,7 @@
href="<?php /* @escapeNotVerified */ echo $block->getUrl('adminhtml/system_account/index') ?>"
<?php /* @escapeNotVerified */ echo $block->getUiId('user', 'account', 'settings')?>
title="<?php echo $block->escapeHtml(__('Account Setting')) ?>">
<?php /* @escapeNotVerified */ echo __('Account Setting') ?> (<span class="admin-user-name"><?php echo $block->escapeHtml($block->getUser()->getUsername()); ?></span>)
<?php /* @escapeNotVerified */ echo __('Account Setting') ?> (<span class="admin-user-name"><?php echo $block->escapeHtml($block->getUser()->getUserName()); ?></span>)
</a>
</li>
<?php endif; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
<script data-template="search-suggest" type="text/x-magento-template">
<ul class="search-global-menu">
<li class="item">
<a id="searchPreviewProducts" href="<?php /* @escapeNotVerified */ echo $block->getURL('catalog/product/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a>
<a id="searchPreviewProducts" href="<?php /* @escapeNotVerified */ echo $block->getUrl('catalog/product/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a>
</li>
<li class="item">
<a id="searchPreviewOrders" href="<?php /* @escapeNotVerified */ echo $block->getURL('sales/order/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a>
<a id="searchPreviewOrders" href="<?php /* @escapeNotVerified */ echo $block->getUrl('sales/order/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a>
</li>
<li class="item">
<a id="searchPreviewCustomers" href="<?php /* @escapeNotVerified */ echo $block->getURL('customer/index/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a>
<a id="searchPreviewCustomers" href="<?php /* @escapeNotVerified */ echo $block->getUrl('customer/index/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a>
</li>
<li class="item">
<a id="searchPreviewPages" href="<?php /* @escapeNotVerified */ echo $block->getURL('cms/page/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a>
<a id="searchPreviewPages" href="<?php /* @escapeNotVerified */ echo $block->getUrl('cms/page/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a>
</li>
<% if (data.items.length) { %>
<% _.each(data.items, function(value){ %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ $numColumns = sizeof($block->getColumns());
<?php if ($block->getPagerVisibility()): ?>
<div class="admin__data-grid-pager-wrap">
<select name="<?php /* @escapeNotVerified */ echo $block->getVarNameLimit() ?>"
id="<?php echo $block->escapeHTML($block->getHtmlId())?>_page-limit"
id="<?php echo $block->escapeHtml($block->getHtmlId())?>_page-limit"
onchange="<?php /* @escapeNotVerified */ echo $block->getJsObjectName() ?>.loadByElement(this)"
class="admin__control-select">
<option value="20"<?php if ($block->getCollection()->getPageSize() == 20): ?>
Expand All @@ -91,7 +91,7 @@ $numColumns = sizeof($block->getColumns());
selected="selected"<?php endif; ?>>200
</option>
</select>
<label for="<?php echo $block->escapeHTML($block->getHtmlId())?><?php echo $block->escapeHTML($block->getHtmlId())?>_page-limit"
<label for="<?php echo $block->escapeHtml($block->getHtmlId())?><?php echo $block->escapeHtml($block->getHtmlId())?>_page-limit"
class="admin__control-support-text"><?php /* @escapeNotVerified */ echo __('per page') ?></label>

<div class="admin__data-grid-pager">
Expand All @@ -107,12 +107,12 @@ $numColumns = sizeof($block->getColumns());
<button type="button" class="action-previous disabled"><span><?php /* @escapeNotVerified */ echo __('Previous page') ?></span></button>
<?php endif; ?>
<input type="text"
id="<?php echo $block->escapeHTML($block->getHtmlId())?>_page-current"
id="<?php echo $block->escapeHtml($block->getHtmlId())?>_page-current"
name="<?php /* @escapeNotVerified */ echo $block->getVarNamePage() ?>"
value="<?php /* @escapeNotVerified */ echo $_curPage ?>"
class="admin__control-text"
onkeypress="<?php /* @escapeNotVerified */ echo $block->getJsObjectName() ?>.inputPage(event, '<?php /* @escapeNotVerified */ echo $_lastPage ?>')" <?php /* @escapeNotVerified */ echo $block->getUiId('current-page') ?> />
<label class="admin__control-support-text" for="<?php echo $block->escapeHTML($block->getHtmlId())?>_page-current">
<label class="admin__control-support-text" for="<?php echo $block->escapeHtml($block->getHtmlId())?>_page-current">
<?php /* @escapeNotVerified */ echo __('of %1', '<span>' . $block->getCollection()->getLastPageNumber() . '</span>') ?>
</label>
<?php if ($_curPage < $_lastPage): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function handle(array $handlingSubject, array $response)
private function getCreditCardType($type)
{
$replaced = str_replace(' ', '-', strtolower($type));
$mapper = $this->config->getCctypesMapper();
$mapper = $this->config->getCcTypesMapper();

return $mapper[$replaced];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private function convertDetailsToJSON($details)
private function getCreditCardType($type)
{
$replaced = str_replace(' ', '-', strtolower($type));
$mapper = $this->config->getCctypesMapper();
$mapper = $this->config->getCcTypesMapper();

return $mapper[$replaced];
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Braintree/Model/Ui/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function getConfig()
self::CODE => [
'isActive' => $this->config->isActive($storeId),
'clientToken' => $this->getClientToken(),
'ccTypesMapper' => $this->config->getCctypesMapper(),
'ccTypesMapper' => $this->config->getCcTypesMapper(),
'sdkUrl' => $this->config->getSdkUrl(),
'countrySpecificCardTypes' => $this->config->getCountrySpecificCardTypeConfig($storeId),
'availableCardTypes' => $this->config->getAvailableCardTypes($storeId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function testGetCcTypesMapper($value, $expected)

static::assertEquals(
$expected,
$this->model->getCctypesMapper()
$this->model->getCcTypesMapper()
);
}

Expand Down
Loading

0 comments on commit bbdda7f

Please sign in to comment.