Skip to content

Commit

Permalink
1.3.3 (FINAL RELEASE)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-belousov committed Mar 21, 2018
1 parent f6388fe commit f883c6e
Show file tree
Hide file tree
Showing 63 changed files with 1,385 additions and 169 deletions.
28 changes: 19 additions & 9 deletions Block/Adminhtml/Amazon/Account/Edit/Tabs/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,28 @@ protected function _prepareForm()
]
)->setFieldExtraAttributes('style="display: none"');

$accessDataFieldConfig = [
'container_id' => 'marketplaces_register_url_container_' . $marketplace['id'],
'label' => '',
'href' => '',
'onclick' => '',
'target' => '_blank',
'value' => $this->__('Get Access Data'),
'class' => 'external-link',
];

if ($marketplace['is_automatic_token_retrieving_available']) {
$accessDataFieldConfig['onclick'] = 'return AmazonAccountObj.getToken('.$marketplace['id'].')';
} else {
$accessDataFieldConfig['href'] = $this->getHelper('Component\Amazon')->getRegisterUrl(
$marketplace['id']
);
}

$fieldset->addField(
'marketplaces_register_url_' . $marketplace['id'],
'link',
[
'container_id' => 'marketplaces_register_url_container_' . $marketplace['id'],
'label' => '',
'href' => '',
'onclick' => 'return AmazonAccountObj.getToken('.$marketplace['id'].')',
'target' => '_blank',
'value' => $this->__('Get Access Data'),
'class' => 'external-link',
]
$accessDataFieldConfig
)->setFieldExtraAttributes('style="display: none"');
}

Expand Down
6 changes: 3 additions & 3 deletions Block/Adminhtml/Amazon/Listing/Log/Grid/LastActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ protected function getGroupedActions(array $logs)

$descArr = [];
foreach ($actionsRow['items'] as $key => &$item) {
if (array_key_exists($item['description'], $descArr)) {
$descArr[$item['description']]['count']++;
if (array_key_exists((string)$item['description'], $descArr)) {
$descArr[(string)$item['description']]['count']++;
unset($actionsRow['items'][$key]);
continue;
}
$item['count'] = 1;
$descArr[$item['description']] = $item;
$descArr[(string)$item['description']] = $item;
}
$actionsRow['items'] = array_values($descArr);
}
Expand Down
5 changes: 0 additions & 5 deletions Block/Adminhtml/Amazon/Marketplace/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,6 @@ protected function addStaticMarketplaces(\Magento\Framework\Data\Form $form)
'label' => $this->__('India'),
'note' => 'amazon.in',
],
[
'group_id' => 1,
'label' => $this->__('Mexico'),
'note' => 'amazon.com.mx',
],
];

foreach ($staticData as $marketplace) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

/*
* @author M2E Pro Developers Team
* @copyright M2E LTD
* @license Commercial use is forbidden
*/

namespace Ess\M2ePro\Block\Adminhtml\ControlPanel\Tabs\Database\Table\Column\Filter;

class Select extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select
{
//########################################

/** @var \Ess\M2ePro\Helper\Factory */
protected $helperFactory;

/** @var \Ess\M2ePro\Model\Factory */
protected $activeRecordFactory;

public function __construct(
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Block $context,
\Magento\Framework\DB\Helper $resourceHelper,
array $data = []
)
{
$this->helperFactory = $context->getHelperFactory();
$this->activeRecordFactory = $context->getActiveRecordFactory();

parent::__construct($context, $resourceHelper, $data);
}

protected function _getOptions()
{
$options = array();

$modelName = $this->getColumn()->getGrid()->getTableModel()->getModelName();
$htmlName = $this->_getHtmlName();

$colOptions = $this->activeRecordFactory->getObject($modelName)
->getCollection()
->getSelect()
->group($htmlName)
->query();

if (!empty($colOptions)) {
$options = array(array('value' => null, 'label' => ''));
foreach ($colOptions as $colOption) {
$options[] = array(
'value' => $colOption[$htmlName],
'label' => $colOption[$htmlName],
);
}
}

return $options;
}

//########################################
}
9 changes: 9 additions & 0 deletions Block/Adminhtml/ControlPanel/Tabs/Database/Table/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ protected function _prepareColumns()
$params['format'] = \IntlDateFormatter::MEDIUM;
}

if($this->tableModel->getTableName() == 'm2epro_operation_history' && $column['name'] == 'nick') {
$params['filter'] = '\Ess\M2ePro\Block\Adminhtml\ControlPanel\Tabs\Database\Table\Column\Filter\Select';
}

$this->addColumn($column['name'], $params);
}

Expand Down Expand Up @@ -404,6 +408,11 @@ public function getRowUrl($row)
//return $this->getUrl('*/*/editTableRow', array('id' => $row->getId()));
}

public function getTableModel()
{
return $this->tableModel;
}

//########################################

private function getColumnType($columnData)
Expand Down
1 change: 1 addition & 0 deletions Block/Adminhtml/Ebay/Order/View/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ protected function _beforeToHtml()
if (!is_null($magentoOrder) && $magentoOrder->hasShipments()) {
$url = $this->getUrl('*/order/resubmitShippingInfo', array('id' => $this->order->getId()));
$data = array(
'class' => 'primary',
'label' => $this->__('Resend Shipping Information'),
'onclick' => 'setLocation(\''.$url.'\');',
);
Expand Down
4 changes: 3 additions & 1 deletion Block/Adminhtml/Ebay/Template/Description/Edit/Form/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,9 @@ protected function _prepareForm()
window.AttributeObj = new Attribute();
}
window.EbayTemplateDescriptionObj = new EbayTemplateDescription();
EbayTemplateDescriptionObj.initObservers();
setTimeout(function() {
EbayTemplateDescriptionObj.initObservers();
}, 50);
{$initWYSIWYG}
window.MagentoAttributeButtonObj = new MagentoAttributeButton();
Expand Down
110 changes: 110 additions & 0 deletions Block/Adminhtml/Magento/Context/Block.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php

/*
* @author M2E Pro Developers Team
* @copyright M2E LTD
* @license Commercial use is forbidden
*/

namespace Ess\M2ePro\Block\Adminhtml\Magento\Context;

use Magento\Backend\Block\Context;

class Block extends Context
{
/** @var \Ess\M2ePro\Helper\Factory */
protected $helperFactory;

/** @var \Ess\M2ePro\Model\Factory */
protected $modelFactory;

/** @var \Ess\M2ePro\Model\ActiveRecord\Factory */
protected $activeRecordFactory;

/** @var \Ess\M2ePro\Model\ActiveRecord\Component\Parent\Factory */
protected $parentFactory;

public function __construct(
\Ess\M2ePro\Helper\Factory $helperFactory,
\Ess\M2ePro\Model\Factory $modelFactory,
\Ess\M2ePro\Model\ActiveRecord\Factory $activeRecordFactory,
\Ess\M2ePro\Model\ActiveRecord\Component\Parent\Factory $parentFactory,
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\View\LayoutInterface $layout,
\Magento\Framework\Event\ManagerInterface $eventManager,
\Magento\Framework\UrlInterface $urlBuilder,
\Magento\Framework\App\CacheInterface $cache,
\Magento\Framework\View\DesignInterface $design,
\Magento\Framework\Session\SessionManagerInterface $session,
\Magento\Framework\Session\SidResolverInterface $sidResolver,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\View\Asset\Repository $assetRepo,
\Magento\Framework\View\ConfigInterface $viewConfig,
\Magento\Framework\App\Cache\StateInterface $cacheState,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Escaper $escaper,
\Magento\Framework\Filter\FilterManager $filterManager,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
\Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
\Magento\Framework\AuthorizationInterface $authorization
)
{
$this->helperFactory = $helperFactory;
$this->modelFactory = $modelFactory;
$this->activeRecordFactory = $activeRecordFactory;
$this->parentFactory = $parentFactory;

parent::__construct(
$request,
$layout,
$eventManager,
$urlBuilder,
$cache,
$design,
$session,
$sidResolver,
$scopeConfig,
$assetRepo,
$viewConfig,
$cacheState,
$logger,
$escaper,
$filterManager,
$localeDate,
$inlineTranslation,
$authorization
);
}

/**
* @return \Ess\M2ePro\Helper\Factory
*/
public function getHelperFactory()
{
return $this->helperFactory;
}

/**
* @return \Ess\M2ePro\Model\Factory
*/
public function getModelFactory()
{
return $this->modelFactory;
}

/**
* @return \Ess\M2ePro\Model\ActiveRecord\Factory
*/
public function getActiveRecordFactory()
{
return $this->activeRecordFactory;
}

/**
* @return \Ess\M2ePro\Model\ActiveRecord\Component\Parent\Factory
*/
public function getParentFactory()
{
return $this->parentFactory;
}
}
34 changes: 34 additions & 0 deletions Block/Adminhtml/Magento/Form/Renderer/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@

class Element extends MagentoElement
{
/** @var \Ess\M2ePro\Helper\Factory */
protected $helperFactory;

//########################################

public function __construct(
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context,
array $data = []
){
$this->helperFactory = $context->getHelperFactory();
parent::__construct($context, $data);
}

//########################################

protected function getTooltipHtml($content)
{
return <<<HTML
Expand Down Expand Up @@ -44,4 +59,23 @@ public function render(AbstractElement $element)

return parent::render($element);
}

//########################################

/**
* @param array|string $data
* @param null $allowedTags
* @return array|string
* @throws \Ess\M2ePro\Model\Exception\Logic
*
* Starting from version 2.2.3 Magento forcibly escapes content of tooltips. But we are using HTML there
*/
public function escapeHtml($data, $allowedTags = NULL)
{
return $this->helperFactory->getObject('Data')->escapeHtml(
$data, ['div', 'a', 'strong', 'br', 'i', 'b', 'ul', 'li'], ENT_NOQUOTES
);
}

//########################################
}
34 changes: 34 additions & 0 deletions Block/Adminhtml/Magento/Form/Renderer/Fieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@

class Fieldset extends MagentoFieldset
{
/** @var \Ess\M2ePro\Helper\Factory */
protected $helperFactory;

//########################################

public function __construct(
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context,
array $data = []
){
$this->helperFactory = $context->getHelperFactory();
parent::__construct($context, $data);
}

//########################################

protected function getTooltipHtml($content, $directionClass)
{
return <<<HTML
Expand Down Expand Up @@ -47,4 +62,23 @@ public function render(AbstractElement $element)

return parent::render($element);
}

//########################################

/**
* @param array|string $data
* @param null $allowedTags
* @return array|string
* @throws \Ess\M2ePro\Model\Exception\Logic
*
* Starting from version 2.2.3 Magento forcibly escapes content of tooltips. But we are using HTML there
*/
public function escapeHtml($data, $allowedTags = NULL)
{
return $this->helperFactory->getObject('Data')->escapeHtml(
$data, ['div', 'a', 'strong', 'br', 'i', 'b', 'ul', 'li'], ENT_NOQUOTES
);
}

//########################################
}
2 changes: 1 addition & 1 deletion Block/Adminhtml/Magento/Grid/Column/Renderer/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected function _toLinkHtml($action, \Magento\Framework\DataObject $row)

if (isset($action['confirm'])) {
$action['onclick'] = 'CommonObj.confirm({
content: \''.addslashes($this->escapeHtml($action['confirm'])).'\',
content: \''.addslashes(htmlspecialchars($this->escapeHtml($action['confirm']))).'\',
actions: {
confirm: function () {
setLocation(this.href);
Expand Down
Loading

0 comments on commit f883c6e

Please sign in to comment.