Skip to content

Commit b32bd91

Browse files
committed
Merge pull request #88 from magento-tango/MAGETWO-32571
[Tango] S46 Controller Refactoring, Exceptions, Bug Fixes
2 parents bc18e4c + dfa392b commit b32bd91

File tree

349 files changed

+3543
-1379
lines changed

Some content is hidden

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

349 files changed

+3543
-1379
lines changed

app/code/Magento/AdminNotification/Block/System/Messages/UnreadMessagePopup.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function getUnreadMessages()
6666
/**
6767
* Retrieve popup title
6868
*
69-
* @return string
69+
* @return \Magento\Framework\Phrase
7070
*/
7171
public function getPopupTitle()
7272
{

app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function isDisplayed()
114114
/**
115115
* Retrieve message text
116116
*
117-
* @return string
117+
* @return \Magento\Framework\Phrase
118118
*/
119119
public function getText()
120120
{

app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function _shouldBeDisplayed()
3131
/**
3232
* Retrieve message text
3333
*
34-
* @return string
34+
* @return \Magento\Framework\Phrase
3535
*/
3636
public function getText()
3737
{

app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function _shouldBeDisplayed()
3030
/**
3131
* Retrieve message text
3232
*
33-
* @return string
33+
* @return \Magento\Framework\Phrase
3434
*/
3535
public function getText()
3636
{

app/code/Magento/AdminNotification/Model/System/Message/Security.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function isDisplayed()
129129
/**
130130
* Retrieve message text
131131
*
132-
* @return string
132+
* @return \Magento\Framework\Phrase
133133
*/
134134
public function getText()
135135
{

app/code/Magento/Backend/Block/System/Account/Edit.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function _construct()
2727
}
2828

2929
/**
30-
* @return string
30+
* @return \Magento\Framework\Phrase
3131
*/
3232
public function getHeaderText()
3333
{

app/code/Magento/Backend/Block/System/Store/Delete.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function _construct()
4949
/**
5050
* Get edit form container header text
5151
*
52-
* @return string
52+
* @return \Magento\Framework\Phrase
5353
*/
5454
public function getHeaderText()
5555
{

app/code/Magento/Backend/Block/System/Variable/Edit.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function getFormHtml()
9797
/**
9898
* Return translated header text depending on creating/editing action
9999
*
100-
* @return string
100+
* @return \Magento\Framework\Phrase
101101
*/
102102
public function getHeaderText()
103103
{

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Store.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function _getShowEmptyStoresLabelFlag()
8383
* Render row store views
8484
*
8585
* @param \Magento\Framework\Object $row
86-
* @return string
86+
* @return \Magento\Framework\Phrase|string
8787
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
8888
* @SuppressWarnings(PHPMD.NPathComplexity)
8989
*/
@@ -135,7 +135,7 @@ public function render(\Magento\Framework\Object $row)
135135
* Render row store views for export
136136
*
137137
* @param \Magento\Framework\Object $row
138-
* @return string
138+
* @return \Magento\Framework\Phrase|string
139139
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
140140
*/
141141
public function renderExport(\Magento\Framework\Object $row)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Controller\Adminhtml\Dashboard;
8+
9+
class RefreshStatistics extends \Magento\Reports\Controller\Adminhtml\Report\Statistics
10+
{
11+
/**
12+
* @param \Magento\Backend\App\Action\Context $context
13+
* @param \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter
14+
* @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory
15+
* @param array $reportTypes
16+
* @param \Psr\Log\LoggerInterface $logger
17+
*/
18+
public function __construct(
19+
\Magento\Backend\App\Action\Context $context,
20+
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter,
21+
\Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory,
22+
array $reportTypes,
23+
\Psr\Log\LoggerInterface $logger
24+
) {
25+
parent::__construct($context, $dateFilter, $resultRedirectFactory, $reportTypes);
26+
$this->logger = $logger;
27+
}
28+
29+
/**
30+
* @return \Magento\Backend\Model\View\Result\Redirect
31+
*/
32+
public function execute()
33+
{
34+
try {
35+
$collectionsNames = array_values($this->reportTypes);
36+
foreach ($collectionsNames as $collectionName) {
37+
$this->_objectManager->create($collectionName)->aggregate();
38+
}
39+
$this->messageManager->addSuccess(__('We updated lifetime statistic.'));
40+
} catch (\Exception $e) {
41+
$this->messageManager->addError(__('We can\'t refresh lifetime statistics.'));
42+
$this->logger->critical($e);
43+
}
44+
return $this->resultRedirectFactory->create()->setPath('*/*');
45+
}
46+
}

app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStore.php

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public function execute()
1616
$itemId = $this->getRequest()->getParam('item_id', null);
1717
if (!($model = $this->_objectManager->create('Magento\Store\Model\Store')->load($itemId))) {
1818
$this->messageManager->addError(__('Unable to proceed. Please, try again.'));
19-
$this->_redirect('adminhtml/*/');
2019
/** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */
2120
$redirectResult = $this->resultRedirectFactory->create();
2221
return $redirectResult->setPath('adminhtml/*/');

app/code/Magento/Backend/Model/Config/Structure/AbstractElement.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(StoreManagerInterface $storeManager)
4242
* Translate element attribute
4343
*
4444
* @param string $code
45-
* @return string
45+
* @return \Magento\Framework\Phrase|string
4646
*/
4747
protected function _getTranslatedAttribute($code)
4848
{

app/code/Magento/Backend/Model/Config/Structure/Element/Field.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ protected function _getStaticOptions(array $options)
385385
* Translate a label
386386
*
387387
* @param string $label an option label that should be translated
388-
* @return string the translated version of the input label
388+
* @return \Magento\Framework\Phrase
389389
*/
390390
private function _translateLabel($label)
391391
{

app/code/Magento/Backend/view/adminhtml/layout/adminhtml_dashboard_index.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
</block>
1616
</referenceContainer>
1717
<referenceContainer name="content">
18-
<block class="Magento\Backend\Block\Dashboard" name="dashboard"/>
18+
<block class="Magento\Backend\Block\Dashboard" name="dashboard">
19+
<block class="Magento\Backend\Block\Template" name="refresh_statistics" template="Magento_Backend::dashboard/totalbar/refreshstatistics.phtml"/>
20+
</block>
1921
</referenceContainer>
2022
</body>
2123
</page>

app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ window.changeDiagramsPeriod = function(periodObj) {
8181
<div class="dashboard-store-stats">
8282
<?php echo $block->getChildHtml('grids') ?>
8383
<div id="grid_tab_content" class="dashboard-store-stats-content"></div>
84+
<?php echo $block->getChildHtml('refresh_statistics') ?>
8485
</div>
8586
</div>
8687
<div class="dashboard-secondary">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
?>
7+
<form action="<?php echo $block->getUrl('*/*/refreshStatistics'); ?>" method="post">
8+
<input name="form_key" type="hidden" value="<?php echo $block->getFormKey(); ?>" />
9+
<button type="submit" style="float:right; margin: 15px" title="Refresh data">
10+
<?php echo __('Refresh data') ?>
11+
</button>
12+
</form>

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ public function getProduct()
131131
}
132132

133133
/**
134-
* @return string
134+
* @return \Magento\Framework\Phrase
135135
*/
136136
public function getTabLabel()
137137
{
138138
return __('Bundle Items');
139139
}
140140

141141
/**
142-
* @return string
142+
* @return \Magento\Framework\Phrase
143143
*/
144144
public function getTabTitle()
145145
{

app/code/Magento/Bundle/Model/Product/Type.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ public function isSalable($product)
670670
* @param \Magento\Framework\Object $buyRequest
671671
* @param \Magento\Catalog\Model\Product $product
672672
* @param string $processMode
673-
* @return array|string
673+
* @return \Magento\Framework\Phrase|array|string
674674
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
675675
* @SuppressWarnings(PHPMD.NPathComplexity)
676676
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
@@ -852,7 +852,7 @@ private function multiToFlatArray(array $array)
852852
/**
853853
* Retrieve message for specify option(s)
854854
*
855-
* @return string
855+
* @return \Magento\Framework\Phrase
856856
*/
857857
public function getSpecifyOptionMessage()
858858
{

app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public function getTabsHtml()
237237
}
238238

239239
/**
240-
* @return string
240+
* @return \Magento\Framework\Phrase|string
241241
*/
242242
public function getHeader()
243243
{

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region
106106
/**
107107
* Retrieve header text
108108
*
109-
* @return string
109+
* @return \Magento\Framework\Phrase
110110
*/
111111
public function getHeaderText()
112112
{

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function getSetFormHtml()
183183
/**
184184
* Retrieve Block Header Text
185185
*
186-
* @return string
186+
* @return \Magento\Framework\Phrase
187187
*/
188188
protected function _getHeader()
189189
{

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function _prepareLayout()
5353
}
5454

5555
/**
56-
* @return string
56+
* @return \Magento\Framework\Phrase
5757
*/
5858
protected function _getHeader()
5959
{

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function getNewButtonHtml()
4444
}
4545

4646
/**
47-
* @return string
47+
* @return \Magento\Framework\Phrase
4848
*/
4949
protected function _getHeader()
5050
{

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ protected function _getAdditionalElementHtml($element)
154154
}
155155

156156
/**
157-
* @return string
157+
* @return \Magento\Framework\Phrase
158158
*/
159159
public function getTabLabel()
160160
{
161161
return __('Attributes');
162162
}
163163

164164
/**
165-
* @return string
165+
* @return \Magento\Framework\Phrase
166166
*/
167167
public function getTabTitle()
168168
{

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ public function getDefaultConfigValue($field)
8282
/**
8383
* Tab settings
8484
*
85-
* @return string
85+
* @return \Magento\Framework\Phrase
8686
*/
8787
public function getTabLabel()
8888
{
8989
return __('Advanced Inventory');
9090
}
9191

9292
/**
93-
* @return string
93+
* @return \Magento\Framework\Phrase
9494
*/
9595
public function getTabTitle()
9696
{

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Websites.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ public function getStoreCollection(Group $group)
4545
/**
4646
* Tab settings
4747
*
48-
* @return string
48+
* @return \Magento\Framework\Phrase
4949
*/
5050
public function getTabLabel()
5151
{
5252
return __('Websites');
5353
}
5454

5555
/**
56-
* @return string
56+
* @return \Magento\Framework\Phrase
5757
*/
5858
public function getTabTitle()
5959
{

app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function __construct(
7272
/**
7373
* Get label
7474
*
75-
* @return string
75+
* @return \Magento\Framework\Phrase
7676
*/
7777
public function getLabel()
7878
{

app/code/Magento/Catalog/Block/Adminhtml/Rss/Grid/Link.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getLink()
5252
}
5353

5454
/**
55-
* @return string
55+
* @return \Magento\Framework\Phrase
5656
*/
5757
public function getLabel()
5858
{

app/code/Magento/Catalog/Block/Category/Rss/Link.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function isRssAllowed()
5252
}
5353

5454
/**
55-
* @return string
55+
* @return \Magento\Framework\Phrase
5656
*/
5757
public function getLabel()
5858
{

app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public function getAttributes()
192192
*
193193
* @param Product $product
194194
* @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute
195-
* @return string
195+
* @return \Magento\Framework\Phrase|string
196196
*/
197197
public function getProductAttributeValue($product, $attribute)
198198
{

0 commit comments

Comments
 (0)