Skip to content

Commit f7dc06d

Browse files
author
Mike Weis
committed
Merge branch 'cart-price-rules' into FearlessKiwis-MAGETWO-43124-Cart-Price-Rules-staging-dashboard
2 parents aeaa85e + 016a85a commit f7dc06d

File tree

23 files changed

+402
-31
lines changed

23 files changed

+402
-31
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/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab;
77

8+
use Magento\Framework\App\ObjectManager;
9+
810
class Actions extends \Magento\Backend\Block\Widget\Form\Generic implements
911
\Magento\Ui\Component\Layout\Tabs\TabInterface
1012
{
@@ -20,6 +22,12 @@ class Actions extends \Magento\Backend\Block\Widget\Form\Generic implements
2022
*/
2123
protected $_ruleActions;
2224

25+
/**
26+
* @var \Magento\Config\Model\Config\Source\Yesno
27+
* @deprecated
28+
*/
29+
protected $_sourceYesno;
30+
2331
/**
2432
* @var string
2533
*/
@@ -36,26 +44,37 @@ class Actions extends \Magento\Backend\Block\Widget\Form\Generic implements
3644
* @param \Magento\Backend\Block\Template\Context $context
3745
* @param \Magento\Framework\Registry $registry
3846
* @param \Magento\Framework\Data\FormFactory $formFactory
47+
* @param \Magento\Config\Model\Config\Source\Yesno $sourceYesno
3948
* @param \Magento\Rule\Block\Actions $ruleActions
4049
* @param \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset
41-
* @param \Magento\SalesRule\Model\RuleFactory $ruleFactory
4250
* @param array $data
4351
*/
4452
public function __construct(
4553
\Magento\Backend\Block\Template\Context $context,
4654
\Magento\Framework\Registry $registry,
4755
\Magento\Framework\Data\FormFactory $formFactory,
56+
\Magento\Config\Model\Config\Source\Yesno $sourceYesno,
4857
\Magento\Rule\Block\Actions $ruleActions,
4958
\Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset,
50-
\Magento\SalesRule\Model\RuleFactory $ruleFactory,
5159
array $data = []
5260
) {
53-
$this->ruleFactory = $ruleFactory;
5461
$this->_rendererFieldset = $rendererFieldset;
5562
$this->_ruleActions = $ruleActions;
63+
$this->_sourceYesno = $sourceYesno;
5664
parent::__construct($context, $registry, $formFactory, $data);
5765
}
5866

67+
/**
68+
* @return \Magento\SalesRule\Model\RuleFactory
69+
* @deprecated
70+
*/
71+
public function getRuleFactory()
72+
{
73+
if ($this->ruleFactory instanceof \Magento\SalesRule\Model\RuleFactory) {
74+
$this->ruleFactory = ObjectManager::getInstance()->get('\Magento\SalesRule\Model\RuleFactory');
75+
}
76+
}
77+
5978
/**
6079
* {@inheritdoc}
6180
* @codeCoverageIgnore

app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab;
77

8+
use Magento\Framework\App\ObjectManager;
9+
810
class Conditions extends \Magento\Backend\Block\Widget\Form\Generic implements
911
\Magento\Ui\Component\Layout\Tabs\TabInterface
1012
{
@@ -38,7 +40,6 @@ class Conditions extends \Magento\Backend\Block\Widget\Form\Generic implements
3840
* @param \Magento\Framework\Data\FormFactory $formFactory
3941
* @param \Magento\Rule\Block\Conditions $conditions
4042
* @param \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset
41-
* @param \Magento\SalesRule\Model\RuleFactory $ruleFactory
4243
* @param array $data
4344
*/
4445
public function __construct(
@@ -47,15 +48,24 @@ public function __construct(
4748
\Magento\Framework\Data\FormFactory $formFactory,
4849
\Magento\Rule\Block\Conditions $conditions,
4950
\Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset,
50-
\Magento\SalesRule\Model\RuleFactory $ruleFactory,
5151
array $data = []
5252
) {
53-
$this->ruleFactory = $ruleFactory;
5453
$this->_rendererFieldset = $rendererFieldset;
5554
$this->_conditions = $conditions;
5655
parent::__construct($context, $registry, $formFactory, $data);
5756
}
5857

58+
/**
59+
* @return \Magento\SalesRule\Model\RuleFactory
60+
* @deprecated
61+
*/
62+
public function getRuleFactory()
63+
{
64+
if ($this->ruleFactory instanceof \Magento\SalesRule\Model\RuleFactory) {
65+
$this->ruleFactory = ObjectManager::getInstance()->get('\Magento\SalesRule\Model\RuleFactory');
66+
}
67+
}
68+
5969
/**
6070
* {@inheritdoc}
6171
* @codeCoverageIgnore

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
}

0 commit comments

Comments
 (0)