Skip to content

Commit 53e270e

Browse files
authored
Merge pull request #124 from magento-tango/MAGETWO-54731
[Tango] P2 Bug fixes
2 parents 6af1543 + 7336d15 commit 53e270e

File tree

27 files changed

+761
-65
lines changed

27 files changed

+761
-65
lines changed

app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ public function getAttributeRawValue($entityId, $attribute, $store)
502502
$staticTable,
503503
$staticAttributes
504504
)->join(
505-
['e' => $this->getTable('catalog_product_entity')],
505+
['e' => $this->getTable($this->getEntityTable())],
506506
'e.' . $this->getLinkField() . ' = ' . $staticTable . '.' . $this->getLinkField()
507507
)->where(
508508
'e.entity_id = :entity_id'
@@ -523,7 +523,7 @@ public function getAttributeRawValue($entityId, $attribute, $store)
523523
$select = $connection->select()
524524
->from(['default_value' => $table], ['attribute_id'])
525525
->join(
526-
['e' => $this->getTable('catalog_product_entity')],
526+
['e' => $this->getTable($this->getEntityTable())],
527527
'e.' . $this->getLinkField() . ' = ' . 'default_value.' . $this->getLinkField(),
528528
''
529529
)->where('default_value.attribute_id IN (?)', array_keys($_attributes))

app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php

-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ private function prepareMeta()
213213
'dataScope' => 'qty',
214214
'validation' => [
215215
'validate-number' => true,
216-
'validate-digits' => true,
217216
'less-than-equals-to' => StockDataFilter::MAX_QTY_VALUE,
218217
],
219218
'imports' => [

app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
<item name="dataScope" xsi:type="string">quantity_and_stock_status.qty</item>
9696
<item name="validation" xsi:type="array">
9797
<item name="validate-number" xsi:type="boolean">true</item>
98-
<item name="validate-digits" xsi:type="boolean">true</item>
9998
<item name="less-than-equals-to" xsi:type="number">99999999</item>
10099
</item>
101100
<item name="sortOrder" xsi:type="number">200</item>

app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ define([
1919
handleChanges: function (value) {
2020
var isDigits = value !== 1;
2121

22-
this.validation['validate-number'] = !isDigits;
23-
this.validation['validate-digits'] = isDigits;
22+
this.validation['validate-integer'] = isDigits;
2423
this.validation['less-than-equals-to'] = isDigits ? 99999999 : 99999999.9999;
2524
this.validate();
2625
}

app/code/Magento/Cms/Controller/Adminhtml/Page/MassDelete.php

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
*/
1616
class MassDelete extends \Magento\Backend\App\Action
1717
{
18+
/**
19+
* Authorization level of a basic admin session
20+
*
21+
* @see _isAllowed()
22+
*/
23+
const ADMIN_RESOURCE = 'Magento_Cms::page_delete';
24+
1825
/**
1926
* @var Filter
2027
*/

app/code/Magento/Cms/etc/frontend/page_types.xml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<type id="cms_index_defaultindex" label="CMS Home Default Page"/>
1010
<type id="cms_index_defaultnoroute" label="CMS No-Route Default Page"/>
1111
<type id="cms_index_index" label="CMS Home Page"/>
12-
<type id="cms_index_test" label="CMS Home Page"/>
1312
<type id="cms_index_nocookies" label="CMS No-Cookies Page"/>
1413
<type id="cms_index_noroute" label="CMS No-Route Page"/>
1514
<type id="cms_page_view" label="CMS Pages (All)"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Developer\Model\Logger\Handler;
7+
8+
use Magento\Framework\App\Config\ScopeConfigInterface;
9+
use Magento\Framework\App\State;
10+
use Magento\Framework\Filesystem\DriverInterface;
11+
use Magento\Store\Model\ScopeInterface;
12+
13+
/**
14+
* Class Debug
15+
*/
16+
class Debug extends \Magento\Framework\Logger\Handler\Debug
17+
{
18+
/**
19+
* @var State
20+
*/
21+
private $state;
22+
23+
/**
24+
* @var ScopeConfigInterface
25+
*/
26+
private $scopeConfig;
27+
28+
/**
29+
* @param DriverInterface $filesystem
30+
* @param State $state
31+
* @param ScopeConfigInterface $scopeConfig
32+
* @param string $filePath
33+
*/
34+
public function __construct(
35+
DriverInterface $filesystem,
36+
State $state,
37+
ScopeConfigInterface $scopeConfig,
38+
$filePath = null
39+
) {
40+
parent::__construct($filesystem, $filePath);
41+
42+
$this->state = $state;
43+
$this->scopeConfig = $scopeConfig;
44+
}
45+
46+
/**
47+
* {@inheritdoc}
48+
*/
49+
public function isHandling(array $record)
50+
{
51+
return
52+
parent::isHandling($record)
53+
&& $this->state->getMode() !== State::MODE_PRODUCTION
54+
&& $this->scopeConfig->getValue('dev/debug/debug_logging', ScopeInterface::SCOPE_STORE);
55+
}
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Developer\Test\Unit\Model\Logger\Handler;
7+
8+
use Magento\Developer\Model\Logger\Handler\Debug;
9+
use Magento\Framework\App\Config\ScopeConfigInterface;
10+
use Magento\Framework\App\State;
11+
use Magento\Framework\Filesystem\DriverInterface;
12+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
13+
use Magento\Store\Model\ScopeInterface;
14+
use Monolog\Formatter\FormatterInterface;
15+
use Monolog\Logger;
16+
17+
/**
18+
* Class DebugTest
19+
*/
20+
class DebugTest extends \PHPUnit_Framework_TestCase
21+
{
22+
/**
23+
* @var Debug
24+
*/
25+
private $model;
26+
27+
/**
28+
* @var DriverInterface|\PHPUnit_Framework_MockObject_MockObject
29+
*/
30+
private $filesystemMock;
31+
32+
/**
33+
* @var State|\PHPUnit_Framework_MockObject_MockObject
34+
*/
35+
private $stateMock;
36+
37+
/**
38+
* @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
39+
*/
40+
private $scopeConfigMock;
41+
42+
/**
43+
* @var FormatterInterface|\PHPUnit_Framework_MockObject_MockObject
44+
*/
45+
private $formatterMock;
46+
47+
protected function setUp()
48+
{
49+
$this->filesystemMock = $this->getMockBuilder(DriverInterface::class)
50+
->getMockForAbstractClass();
51+
$this->stateMock = $this->getMockBuilder(State::class)
52+
->disableOriginalConstructor()
53+
->getMock();
54+
$this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)
55+
->getMockForAbstractClass();
56+
$this->formatterMock = $this->getMockBuilder(FormatterInterface::class)
57+
->getMockForAbstractClass();
58+
59+
$this->formatterMock->expects($this->any())
60+
->method('format')
61+
->willReturn(null);
62+
63+
$this->model = (new ObjectManager($this))->getObject(Debug::class, [
64+
'filesystem' => $this->filesystemMock,
65+
'state' => $this->stateMock,
66+
'scopeConfig' => $this->scopeConfigMock,
67+
]);
68+
$this->model->setFormatter($this->formatterMock);
69+
}
70+
71+
public function testHandle()
72+
{
73+
$this->stateMock->expects($this->once())
74+
->method('getMode')
75+
->willReturn(State::MODE_DEVELOPER);
76+
$this->scopeConfigMock->expects($this->once())
77+
->method('getValue')
78+
->with('dev/debug/debug_logging', ScopeInterface::SCOPE_STORE, null)
79+
->willReturn(true);
80+
81+
$this->model->handle(['formatted' => false, 'level' => Logger::DEBUG]);
82+
}
83+
84+
public function testHandleDisabledByProduction()
85+
{
86+
$this->stateMock->expects($this->once())
87+
->method('getMode')
88+
->willReturn(State::MODE_PRODUCTION);
89+
$this->scopeConfigMock->expects($this->never())
90+
->method('getValue');
91+
92+
$this->model->handle(['formatted' => false, 'level' => Logger::DEBUG]);
93+
}
94+
95+
public function testHandleDisabledByConfig()
96+
{
97+
$this->stateMock->expects($this->once())
98+
->method('getMode')
99+
->willReturn(State::MODE_DEVELOPER);
100+
$this->scopeConfigMock->expects($this->once())
101+
->method('getValue')
102+
->with('dev/debug/debug_logging', ScopeInterface::SCOPE_STORE, null)
103+
->willReturn(false);
104+
105+
$this->model->handle(['formatted' => false, 'level' => Logger::DEBUG]);
106+
}
107+
108+
public function testHandleDisabledByLevel()
109+
{
110+
$this->stateMock->expects($this->never())
111+
->method('getMode');
112+
$this->scopeConfigMock->expects($this->never())
113+
->method('getValue');
114+
115+
$this->model->handle(['formatted' => false, 'level' => Logger::API]);
116+
}
117+
}

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

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
<backend_model>Magento\Developer\Model\Config\Backend\AllowedIps</backend_model>
2424
</field>
2525
</group>
26+
<group id="debug" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
27+
<field id="debug_logging" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
28+
<label>Log to File</label>
29+
<comment>Not available in production mode.</comment>
30+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
31+
</field>
32+
</group>
2633
</section>
2734
</system>
2835
</config>

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

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<preference for="Magento\Framework\View\Asset\PreProcessor\ChainFactoryInterface" type="Magento\Framework\View\Asset\PreProcessor\ChainFactory"/>
1010
<preference for="Magento\Framework\Css\PreProcessor\ErrorHandlerInterface" type="Magento\Framework\Css\PreProcessor\ErrorHandler" />
1111
<preference for="Magento\Framework\View\Asset\PreProcessor\Helper\SortInterface" type="Magento\Framework\View\Asset\PreProcessor\Helper\Sort"/>
12+
<preference for="Magento\Framework\Logger\Handler\Debug" type="Magento\Developer\Model\Logger\Handler\Debug"/>
1213

1314
<type name="Magento\Framework\View\Result\Page">
1415
<arguments>

app/code/Magento/Paypal/etc/frontend/page_types.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_types.xsd">
9-
<type id="paypal_billing_agreement_index" label="Billing Agreement"/>
9+
<type id="paypal_billing_agreement_index" label="Billing Agreements"/>
1010
<type id="paypal_billing_agreement_view" label="Billing Agreement View"/>
1111
<type id="paypal_express_review" label="PayPal Express Order Review Form"/>
1212
<type id="paypal_hostedpro_cancel" label="Paypal Hosted Pro Frame"/>
@@ -18,5 +18,5 @@
1818
<type id="paypal_payflowadvanced_cancelpayment" label="Paypal Payflow Advanced Cancel Payment"/>
1919
<type id="paypal_payflowadvanced_form" label="Paypal Payflow Advanced Form"/>
2020
<type id="paypal_payflowadvanced_returnurl" label="Paypal Payflow Advanced Return URL"/>
21-
<type id="paypal_payflowexpress_review" label="PayPal Express Order Review Form"/>
21+
<type id="paypal_payflowexpress_review" label="PayPal Payflow Express Order Review Form"/>
2222
</page_types>

app/code/Magento/Sales/etc/frontend/page_types.xml

+14-14
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
*/
77
-->
88
<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_types.xsd">
9-
<type id="sales_guest_creditmemo" label="Guest Order Creditmemo View"/>
10-
<type id="sales_guest_form" label="Returns"/>
11-
<type id="sales_guest_invoice" label="Guest Order Invoice View"/>
12-
<type id="sales_guest_print" label="Sales Order Print View"/>
13-
<type id="sales_guest_printcreditmemo" label="Sales Creditmemo Print View"/>
14-
<type id="sales_guest_printinvoice" label="Sales Invoice Print View"/>
15-
<type id="sales_guest_printshipment" label="Sales Shipment Print View"/>
9+
<type id="sales_guest_creditmemo" label="Sales Guest Order Creditmemo View"/>
10+
<type id="sales_guest_form" label="Sales Returns"/>
11+
<type id="sales_guest_invoice" label="Sales Guest Order Invoice View"/>
12+
<type id="sales_guest_print" label="Sales Guest Order Print View"/>
13+
<type id="sales_guest_printcreditmemo" label="Sales Guest Creditmemo Print View"/>
14+
<type id="sales_guest_printinvoice" label="Sales Guest Invoice Print View"/>
15+
<type id="sales_guest_printshipment" label="Sales Guest Shipment Print View"/>
1616
<type id="sales_guest_reorder" label="Sales Guest Reorder"/>
17-
<type id="sales_guest_shipment" label="Guest Order Shipment View"/>
18-
<type id="sales_guest_view" label="Guest Order View"/>
19-
<type id="sales_order_creditmemo" label="Customer My Account Order Creditmemo View"/>
20-
<type id="sales_order_history" label="Customer My Account Order History"/>
21-
<type id="sales_order_invoice" label="Customer My Account Order Invoice View"/>
17+
<type id="sales_guest_shipment" label="Sales Guest Shipment View"/>
18+
<type id="sales_guest_view" label="Sales Guest Order View"/>
19+
<type id="sales_order_creditmemo" label="Sales Customer My Account Order Creditmemo View"/>
20+
<type id="sales_order_history" label="Sales Customer My Account Order History"/>
21+
<type id="sales_order_invoice" label="Sales Customer My Account Order Invoice View"/>
2222
<type id="sales_order_print" label="Sales Order Print View"/>
2323
<type id="sales_order_printcreditmemo" label="Sales Creditmemo Print View"/>
2424
<type id="sales_order_printinvoice" label="Sales Invoice Print View"/>
2525
<type id="sales_order_printshipment" label="Sales Shipment Print View"/>
2626
<type id="sales_order_reorder" label="Sales Reorder"/>
27-
<type id="sales_order_shipment" label="Customer My Account Order Shipment View"/>
28-
<type id="sales_order_view" label="Customer My Account Order View"/>
27+
<type id="sales_order_shipment" label="Sales Customer My Account Order Shipment View"/>
28+
<type id="sales_order_view" label="Sales Customer My Account Order View"/>
2929
</page_types>

0 commit comments

Comments
 (0)