Skip to content

Commit c2a060b

Browse files
author
Oleksii Korshenko
committed
Merge remote-tracking branch 'origin/bug-fixes' into cart-price-rules
2 parents e8e983b + 45c6b82 commit c2a060b

File tree

21 files changed

+367
-25
lines changed

21 files changed

+367
-25
lines changed

app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
108108
);
109109
}
110110

111-
if (!$websiteModel->getIsDefault() && $websiteModel->getStoresCount()) {
111+
$hasOnlyDefaultStore = $websiteModel->getStoresCount() == 1 &&
112+
array_key_exists(\Magento\Store\Model\Store::DEFAULT_STORE_ID, $websiteModel->getStoreIds());
113+
if (!$websiteModel->getIsDefault() && $websiteModel->getStoresCount() && !$hasOnlyDefaultStore) {
112114
$fieldset->addField(
113115
'is_default',
114116
'checkbox',

app/code/Magento/Backend/Helper/Dashboard/Order.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,23 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard
1515
*/
1616
protected $_orderCollection;
1717

18+
/**
19+
* @var \Magento\Store\Model\StoreManagerInterface
20+
*/
21+
protected $_storeManager;
22+
1823
/**
1924
* @param \Magento\Framework\App\Helper\Context $context
2025
* @param \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
26+
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
2127
*/
2228
public function __construct(
2329
\Magento\Framework\App\Helper\Context $context,
24-
\Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
30+
\Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection,
31+
\Magento\Store\Model\StoreManagerInterface $storeManager
2532
) {
2633
$this->_orderCollection = $orderCollection;
34+
$this->_storeManager = $storeManager;
2735
parent::__construct(
2836
$context
2937
);

app/code/Magento/Sales/Setup/InstallSchema.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,6 +3216,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
32163216
'12,4',
32173217
[],
32183218
'Grand Total'
3219+
)->addColumn(
3220+
'base_grand_total',
3221+
\Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
3222+
'12,4',
3223+
[],
3224+
'Base Grand Total'
32193225
)->addColumn(
32203226
'created_at',
32213227
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
@@ -3234,6 +3240,9 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
32343240
)->addIndex(
32353241
$installer->getIdxName('sales_invoice_grid', ['grand_total']),
32363242
['grand_total']
3243+
)->addIndex(
3244+
$installer->getIdxName('sales_invoice_grid', ['base_grand_total']),
3245+
['base_grand_total']
32373246
)->addIndex(
32383247
$installer->getIdxName('sales_invoice_grid', ['order_id']),
32393248
['order_id']

app/code/Magento/Sales/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
<group id="dashboard" translate="label,comment" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0">
110110
<label>Dashboard</label>
111111
<field id="use_aggregated_data" translate="label" sortOrder="10" type="select" showInDefault="1" showInWebsite="0" showInStore="0">
112-
<label>Use Aggregated Data (beta)</label>
112+
<label>Use Aggregated Data</label>
113113
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
114114
<comment>Improves dashboard performance but provides non-realtime data.</comment>
115115
</field>

app/code/Magento/Sales/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@
634634
<item name="shipping_information" xsi:type="string">sales_order.shipping_description</item>
635635
<item name="subtotal" xsi:type="string">sales_order.base_subtotal</item>
636636
<item name="shipping_and_handling" xsi:type="string">sales_order.base_shipping_amount</item>
637+
<item name="base_grand_total" xsi:type="string">sales_invoice.base_grand_total</item>
637638
<item name="grand_total" xsi:type="string">sales_invoice.grand_total</item>
638639
<item name="created_at" xsi:type="string">sales_invoice.created_at</item>
639640
<item name="updated_at" xsi:type="string">sales_invoice.updated_at</item>

app/code/Magento/Sales/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ Comma-separated,Comma-separated
615615
"We'll use the default description above if you leave this empty.","We'll use the default description above if you leave this empty."
616616
"Multi-address Error to Show in Shopping Cart","Multi-address Error to Show in Shopping Cart"
617617
"We'll use the default error above if you leave this empty.","We'll use the default error above if you leave this empty."
618-
"Use Aggregated Data (beta)","Use Aggregated Data (beta)"
618+
"Use Aggregated Data","Use Aggregated Data"
619619
"Sales Emails","Sales Emails"
620620
"New Order Confirmation Email Sender","New Order Confirmation Email Sender"
621621
"New Order Confirmation Template","New Order Confirmation Template"

app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_invoice_grid.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,19 @@
141141
</item>
142142
</argument>
143143
</column>
144-
<column name="grand_total" class="Magento\Sales\Ui\Component\Listing\Column\Price">
144+
<column name="base_grand_total" class="Magento\Sales\Ui\Component\Listing\Column\Price">
145145
<argument name="data" xsi:type="array">
146146
<item name="config" xsi:type="array">
147147
<item name="filter" xsi:type="string">textRange</item>
148-
<item name="label" xsi:type="string" translate="true">Amount</item>
148+
<item name="label" xsi:type="string" translate="true">Grand Total (Base)</item>
149+
</item>
150+
</argument>
151+
</column>
152+
<column name="grand_total" class="Magento\Sales\Ui\Component\Listing\Column\PurchasedPrice">
153+
<argument name="data" xsi:type="array">
154+
<item name="config" xsi:type="array">
155+
<item name="filter" xsi:type="string">textRange</item>
156+
<item name="label" xsi:type="string" translate="true">Grand Total (Purchased)</item>
149157
</item>
150158
</argument>
151159
</column>

app/code/Magento/Translation/Controller/Ajax/Index.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ public function execute()
3636
$translate = (array)$this->getRequest()->getPost('translate');
3737

3838
try {
39-
$this->inlineParser->processAjaxPost($translate);
40-
$response = "{success:true}";
39+
$response = $this->inlineParser->processAjaxPost($translate);
4140
} catch (\Exception $e) {
4241
$response = "{error:true,message:'" . $e->getMessage() . "'}";
4342
}
44-
$this->getResponse()->representJson($response);
43+
$this->getResponse()->representJson(json_encode($response));
4544
$this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true);
4645
}
4746
}

app/code/Magento/Translation/Model/FileManager.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,13 @@ public function getTranslationFilePath()
8989
{
9090
return $this->assetRepo->getStaticViewFileContext()->getPath();
9191
}
92+
93+
/**
94+
* @param string $content
95+
* @return void
96+
*/
97+
public function updateTranslationFileContent($content)
98+
{
99+
$this->driverFile->filePutContents($this->getTranslationFileFullPath(), $content);
100+
}
92101
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Translation\Model\Inline;
8+
9+
/**
10+
* To manage translations cache
11+
*/
12+
class CacheManager
13+
{
14+
/**
15+
* @var \Magento\Framework\Event\ManagerInterface
16+
*/
17+
protected $eventManager;
18+
19+
/**
20+
* @var \Magento\Framework\Translate\ResourceInterface
21+
*/
22+
protected $translateResource;
23+
24+
/**
25+
* @var \Magento\Framework\Locale\ResolverInterface
26+
*/
27+
protected $localeResolver;
28+
29+
/**
30+
* @var \Magento\Translation\Model\FileManager
31+
*/
32+
protected $fileManager;
33+
34+
/**
35+
* Initialize dependencies
36+
*
37+
* @param \Magento\Framework\Event\ManagerInterface $eventManager
38+
* @param \Magento\Framework\Translate\ResourceInterface $translateResource
39+
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
40+
* @param \Magento\Translation\Model\FileManager $fileManager
41+
*/
42+
public function __construct(
43+
\Magento\Framework\Event\ManagerInterface $eventManager,
44+
\Magento\Framework\Translate\ResourceInterface $translateResource,
45+
\Magento\Framework\Locale\ResolverInterface $localeResolver,
46+
\Magento\Translation\Model\FileManager $fileManager
47+
) {
48+
$this->eventManager = $eventManager;
49+
$this->translateResource = $translateResource;
50+
$this->localeResolver = $localeResolver;
51+
$this->fileManager = $fileManager;
52+
}
53+
54+
/**
55+
* Clears cache and updates translations file
56+
*
57+
* @return array
58+
*/
59+
public function updateAndGetTranslations()
60+
{
61+
$this->eventManager->dispatch('adminhtml_cache_flush_system');
62+
$translations = $this->translateResource->getTranslationArray(null, $this->localeResolver->getLocale());
63+
$this->fileManager->updateTranslationFileContent(json_encode($translations));
64+
return $translations;
65+
}
66+
}

0 commit comments

Comments
 (0)