Skip to content

Commit f883c6e

Browse files
committed
1.3.3 (FINAL RELEASE)
1 parent f6388fe commit f883c6e

File tree

63 files changed

+1385
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1385
-169
lines changed

Block/Adminhtml/Amazon/Account/Edit/Tabs/General.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,28 @@ protected function _prepareForm()
190190
]
191191
)->setFieldExtraAttributes('style="display: none"');
192192

193+
$accessDataFieldConfig = [
194+
'container_id' => 'marketplaces_register_url_container_' . $marketplace['id'],
195+
'label' => '',
196+
'href' => '',
197+
'onclick' => '',
198+
'target' => '_blank',
199+
'value' => $this->__('Get Access Data'),
200+
'class' => 'external-link',
201+
];
202+
203+
if ($marketplace['is_automatic_token_retrieving_available']) {
204+
$accessDataFieldConfig['onclick'] = 'return AmazonAccountObj.getToken('.$marketplace['id'].')';
205+
} else {
206+
$accessDataFieldConfig['href'] = $this->getHelper('Component\Amazon')->getRegisterUrl(
207+
$marketplace['id']
208+
);
209+
}
210+
193211
$fieldset->addField(
194212
'marketplaces_register_url_' . $marketplace['id'],
195213
'link',
196-
[
197-
'container_id' => 'marketplaces_register_url_container_' . $marketplace['id'],
198-
'label' => '',
199-
'href' => '',
200-
'onclick' => 'return AmazonAccountObj.getToken('.$marketplace['id'].')',
201-
'target' => '_blank',
202-
'value' => $this->__('Get Access Data'),
203-
'class' => 'external-link',
204-
]
214+
$accessDataFieldConfig
205215
)->setFieldExtraAttributes('style="display: none"');
206216
}
207217

Block/Adminhtml/Amazon/Listing/Log/Grid/LastActions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ protected function getGroupedActions(array $logs)
5151

5252
$descArr = [];
5353
foreach ($actionsRow['items'] as $key => &$item) {
54-
if (array_key_exists($item['description'], $descArr)) {
55-
$descArr[$item['description']]['count']++;
54+
if (array_key_exists((string)$item['description'], $descArr)) {
55+
$descArr[(string)$item['description']]['count']++;
5656
unset($actionsRow['items'][$key]);
5757
continue;
5858
}
5959
$item['count'] = 1;
60-
$descArr[$item['description']] = $item;
60+
$descArr[(string)$item['description']] = $item;
6161
}
6262
$actionsRow['items'] = array_values($descArr);
6363
}

Block/Adminhtml/Amazon/Marketplace/Edit/Form.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,6 @@ protected function addStaticMarketplaces(\Magento\Framework\Data\Form $form)
204204
'label' => $this->__('India'),
205205
'note' => 'amazon.in',
206206
],
207-
[
208-
'group_id' => 1,
209-
'label' => $this->__('Mexico'),
210-
'note' => 'amazon.com.mx',
211-
],
212207
];
213208

214209
foreach ($staticData as $marketplace) {
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
/*
4+
* @author M2E Pro Developers Team
5+
* @copyright M2E LTD
6+
* @license Commercial use is forbidden
7+
*/
8+
9+
namespace Ess\M2ePro\Block\Adminhtml\ControlPanel\Tabs\Database\Table\Column\Filter;
10+
11+
class Select extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select
12+
{
13+
//########################################
14+
15+
/** @var \Ess\M2ePro\Helper\Factory */
16+
protected $helperFactory;
17+
18+
/** @var \Ess\M2ePro\Model\Factory */
19+
protected $activeRecordFactory;
20+
21+
public function __construct(
22+
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Block $context,
23+
\Magento\Framework\DB\Helper $resourceHelper,
24+
array $data = []
25+
)
26+
{
27+
$this->helperFactory = $context->getHelperFactory();
28+
$this->activeRecordFactory = $context->getActiveRecordFactory();
29+
30+
parent::__construct($context, $resourceHelper, $data);
31+
}
32+
33+
protected function _getOptions()
34+
{
35+
$options = array();
36+
37+
$modelName = $this->getColumn()->getGrid()->getTableModel()->getModelName();
38+
$htmlName = $this->_getHtmlName();
39+
40+
$colOptions = $this->activeRecordFactory->getObject($modelName)
41+
->getCollection()
42+
->getSelect()
43+
->group($htmlName)
44+
->query();
45+
46+
if (!empty($colOptions)) {
47+
$options = array(array('value' => null, 'label' => ''));
48+
foreach ($colOptions as $colOption) {
49+
$options[] = array(
50+
'value' => $colOption[$htmlName],
51+
'label' => $colOption[$htmlName],
52+
);
53+
}
54+
}
55+
56+
return $options;
57+
}
58+
59+
//########################################
60+
}

Block/Adminhtml/ControlPanel/Tabs/Database/Table/Grid.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ protected function _prepareColumns()
122122
$params['format'] = \IntlDateFormatter::MEDIUM;
123123
}
124124

125+
if($this->tableModel->getTableName() == 'm2epro_operation_history' && $column['name'] == 'nick') {
126+
$params['filter'] = '\Ess\M2ePro\Block\Adminhtml\ControlPanel\Tabs\Database\Table\Column\Filter\Select';
127+
}
128+
125129
$this->addColumn($column['name'], $params);
126130
}
127131

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

411+
public function getTableModel()
412+
{
413+
return $this->tableModel;
414+
}
415+
407416
//########################################
408417

409418
private function getColumnType($columnData)

Block/Adminhtml/Ebay/Order/View/Form.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ protected function _beforeToHtml()
7676
if (!is_null($magentoOrder) && $magentoOrder->hasShipments()) {
7777
$url = $this->getUrl('*/order/resubmitShippingInfo', array('id' => $this->order->getId()));
7878
$data = array(
79+
'class' => 'primary',
7980
'label' => $this->__('Resend Shipping Information'),
8081
'onclick' => 'setLocation(\''.$url.'\');',
8182
);

Block/Adminhtml/Ebay/Template/Description/Edit/Form/Data.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,9 @@ protected function _prepareForm()
14191419
window.AttributeObj = new Attribute();
14201420
}
14211421
window.EbayTemplateDescriptionObj = new EbayTemplateDescription();
1422-
EbayTemplateDescriptionObj.initObservers();
1422+
setTimeout(function() {
1423+
EbayTemplateDescriptionObj.initObservers();
1424+
}, 50);
14231425
{$initWYSIWYG}
14241426
14251427
window.MagentoAttributeButtonObj = new MagentoAttributeButton();
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?php
2+
3+
/*
4+
* @author M2E Pro Developers Team
5+
* @copyright M2E LTD
6+
* @license Commercial use is forbidden
7+
*/
8+
9+
namespace Ess\M2ePro\Block\Adminhtml\Magento\Context;
10+
11+
use Magento\Backend\Block\Context;
12+
13+
class Block extends Context
14+
{
15+
/** @var \Ess\M2ePro\Helper\Factory */
16+
protected $helperFactory;
17+
18+
/** @var \Ess\M2ePro\Model\Factory */
19+
protected $modelFactory;
20+
21+
/** @var \Ess\M2ePro\Model\ActiveRecord\Factory */
22+
protected $activeRecordFactory;
23+
24+
/** @var \Ess\M2ePro\Model\ActiveRecord\Component\Parent\Factory */
25+
protected $parentFactory;
26+
27+
public function __construct(
28+
\Ess\M2ePro\Helper\Factory $helperFactory,
29+
\Ess\M2ePro\Model\Factory $modelFactory,
30+
\Ess\M2ePro\Model\ActiveRecord\Factory $activeRecordFactory,
31+
\Ess\M2ePro\Model\ActiveRecord\Component\Parent\Factory $parentFactory,
32+
\Magento\Framework\App\RequestInterface $request,
33+
\Magento\Framework\View\LayoutInterface $layout,
34+
\Magento\Framework\Event\ManagerInterface $eventManager,
35+
\Magento\Framework\UrlInterface $urlBuilder,
36+
\Magento\Framework\App\CacheInterface $cache,
37+
\Magento\Framework\View\DesignInterface $design,
38+
\Magento\Framework\Session\SessionManagerInterface $session,
39+
\Magento\Framework\Session\SidResolverInterface $sidResolver,
40+
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
41+
\Magento\Framework\View\Asset\Repository $assetRepo,
42+
\Magento\Framework\View\ConfigInterface $viewConfig,
43+
\Magento\Framework\App\Cache\StateInterface $cacheState,
44+
\Psr\Log\LoggerInterface $logger,
45+
\Magento\Framework\Escaper $escaper,
46+
\Magento\Framework\Filter\FilterManager $filterManager,
47+
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
48+
\Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
49+
\Magento\Framework\AuthorizationInterface $authorization
50+
)
51+
{
52+
$this->helperFactory = $helperFactory;
53+
$this->modelFactory = $modelFactory;
54+
$this->activeRecordFactory = $activeRecordFactory;
55+
$this->parentFactory = $parentFactory;
56+
57+
parent::__construct(
58+
$request,
59+
$layout,
60+
$eventManager,
61+
$urlBuilder,
62+
$cache,
63+
$design,
64+
$session,
65+
$sidResolver,
66+
$scopeConfig,
67+
$assetRepo,
68+
$viewConfig,
69+
$cacheState,
70+
$logger,
71+
$escaper,
72+
$filterManager,
73+
$localeDate,
74+
$inlineTranslation,
75+
$authorization
76+
);
77+
}
78+
79+
/**
80+
* @return \Ess\M2ePro\Helper\Factory
81+
*/
82+
public function getHelperFactory()
83+
{
84+
return $this->helperFactory;
85+
}
86+
87+
/**
88+
* @return \Ess\M2ePro\Model\Factory
89+
*/
90+
public function getModelFactory()
91+
{
92+
return $this->modelFactory;
93+
}
94+
95+
/**
96+
* @return \Ess\M2ePro\Model\ActiveRecord\Factory
97+
*/
98+
public function getActiveRecordFactory()
99+
{
100+
return $this->activeRecordFactory;
101+
}
102+
103+
/**
104+
* @return \Ess\M2ePro\Model\ActiveRecord\Component\Parent\Factory
105+
*/
106+
public function getParentFactory()
107+
{
108+
return $this->parentFactory;
109+
}
110+
}

Block/Adminhtml/Magento/Form/Renderer/Element.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@
77

88
class Element extends MagentoElement
99
{
10+
/** @var \Ess\M2ePro\Helper\Factory */
11+
protected $helperFactory;
12+
13+
//########################################
14+
15+
public function __construct(
16+
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context,
17+
array $data = []
18+
){
19+
$this->helperFactory = $context->getHelperFactory();
20+
parent::__construct($context, $data);
21+
}
22+
23+
//########################################
24+
1025
protected function getTooltipHtml($content)
1126
{
1227
return <<<HTML
@@ -44,4 +59,23 @@ public function render(AbstractElement $element)
4459

4560
return parent::render($element);
4661
}
62+
63+
//########################################
64+
65+
/**
66+
* @param array|string $data
67+
* @param null $allowedTags
68+
* @return array|string
69+
* @throws \Ess\M2ePro\Model\Exception\Logic
70+
*
71+
* Starting from version 2.2.3 Magento forcibly escapes content of tooltips. But we are using HTML there
72+
*/
73+
public function escapeHtml($data, $allowedTags = NULL)
74+
{
75+
return $this->helperFactory->getObject('Data')->escapeHtml(
76+
$data, ['div', 'a', 'strong', 'br', 'i', 'b', 'ul', 'li'], ENT_NOQUOTES
77+
);
78+
}
79+
80+
//########################################
4781
}

Block/Adminhtml/Magento/Form/Renderer/Fieldset.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@
77

88
class Fieldset extends MagentoFieldset
99
{
10+
/** @var \Ess\M2ePro\Helper\Factory */
11+
protected $helperFactory;
12+
13+
//########################################
14+
15+
public function __construct(
16+
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context,
17+
array $data = []
18+
){
19+
$this->helperFactory = $context->getHelperFactory();
20+
parent::__construct($context, $data);
21+
}
22+
23+
//########################################
24+
1025
protected function getTooltipHtml($content, $directionClass)
1126
{
1227
return <<<HTML
@@ -47,4 +62,23 @@ public function render(AbstractElement $element)
4762

4863
return parent::render($element);
4964
}
65+
66+
//########################################
67+
68+
/**
69+
* @param array|string $data
70+
* @param null $allowedTags
71+
* @return array|string
72+
* @throws \Ess\M2ePro\Model\Exception\Logic
73+
*
74+
* Starting from version 2.2.3 Magento forcibly escapes content of tooltips. But we are using HTML there
75+
*/
76+
public function escapeHtml($data, $allowedTags = NULL)
77+
{
78+
return $this->helperFactory->getObject('Data')->escapeHtml(
79+
$data, ['div', 'a', 'strong', 'br', 'i', 'b', 'ul', 'li'], ENT_NOQUOTES
80+
);
81+
}
82+
83+
//########################################
5084
}

0 commit comments

Comments
 (0)