Skip to content

Commit 1dc8e71

Browse files
author
Michael Logvin
committed
Merge branch 'MAGETWO-39010' of github.corp.ebay.com:magento-firedrakes/magento2ce into MAGETWO-39010
2 parents cfb8502 + 3e23c69 commit 1dc8e71

File tree

28 files changed

+1273
-13
lines changed

28 files changed

+1273
-13
lines changed

app/code/Magento/Sales/Model/Resource/Order/Relation.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ public function __construct(
6565
public function processRelation(\Magento\Framework\Model\AbstractModel $object)
6666
{
6767
/** @var \Magento\Sales\Model\Order $object */
68-
$this->addressHandler->removeEmptyAddresses($object);
69-
$this->addressHandler->process($object);
68+
7069
if (null !== $object->getItems()) {
7170
/** @var \Magento\Sales\Model\Order\Item $item */
7271
foreach ($object->getItems() as $item) {
@@ -98,5 +97,7 @@ public function processRelation(\Magento\Framework\Model\AbstractModel $object)
9897
$relatedObject->save();
9998
}
10099
}
100+
$this->addressHandler->removeEmptyAddresses($object);
101+
$this->addressHandler->process($object);
101102
}
102103
}

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

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@
288288
<item name="origin_column" xsi:type="string">billing_address_id</item>
289289
<item name="target_column" xsi:type="string">entity_id</item>
290290
</item>
291+
<item name="sales_order_payment" xsi:type="array">
292+
<item name="table" xsi:type="string">sales_order_payment</item>
293+
<item name="origin_column" xsi:type="string">entity_id</item>
294+
<item name="target_column" xsi:type="string">parent_id</item>
295+
</item>
291296
</argument>
292297
<argument name="columns" xsi:type="array">
293298
<item name="entity_id" xsi:type="string">sales_order.entity_id</item>
@@ -314,7 +319,7 @@
314319
<item name="subtotal" xsi:type="string">sales_order.base_subtotal</item>
315320
<item name="shipping_and_handling" xsi:type="string">sales_order.base_shipping_amount</item>
316321
<item name="customer_name" xsi:type="object">CustomerNameAggregator</item>
317-
<item name="payment_method" xsi:type="object">PaymentMethodSubSelect</item>
322+
<item name="payment_method" xsi:type="string">sales_order_payment.method</item>
318323
<item name="total_refunded" xsi:type="string">sales_order.total_refunded</item>
319324
</argument>
320325
</arguments>
@@ -340,6 +345,11 @@
340345
<item name="origin_column" xsi:type="string">billing_address_id</item>
341346
<item name="target_column" xsi:type="string">entity_id</item>
342347
</item>
348+
<item name="sales_order_payment" xsi:type="array">
349+
<item name="table" xsi:type="string">sales_order_payment</item>
350+
<item name="origin_column" xsi:type="string">order_id</item>
351+
<item name="target_column" xsi:type="string">parent_id</item>
352+
</item>
343353
</argument>
344354
<argument name="columns" xsi:type="array">
345355
<item name="entity_id" xsi:type="string">sales_shipment.entity_id</item>
@@ -357,7 +367,7 @@
357367
<item name="shipping_name" xsi:type="object">ShippingNameAggregator</item>
358368
<item name="customer_email" xsi:type="string">sales_order.customer_email</item>
359369
<item name="customer_group_id" xsi:type="string">sales_order.customer_group_id</item>
360-
<item name="payment_method" xsi:type="object">PaymentMethodSubSelect</item>
370+
<item name="payment_method" xsi:type="string">sales_order_payment.method</item>
361371
<item name="created_at" xsi:type="string">sales_shipment.created_at</item>
362372
<item name="updated_at" xsi:type="string">sales_shipment.updated_at</item>
363373
<item name="order_id" xsi:type="string">sales_shipment.order_id</item>
@@ -386,6 +396,11 @@
386396
<item name="origin_column" xsi:type="string">order_id</item>
387397
<item name="target_column" xsi:type="string">entity_id</item>
388398
</item>
399+
<item name="sales_order_payment" xsi:type="array">
400+
<item name="table" xsi:type="string">sales_order_payment</item>
401+
<item name="origin_column" xsi:type="string">order_id</item>
402+
<item name="target_column" xsi:type="string">parent_id</item>
403+
</item>
389404
</argument>
390405
<argument name="columns" xsi:type="array">
391406
<item name="entity_id" xsi:type="string">sales_creditmemo.entity_id</item>
@@ -405,7 +420,7 @@
405420
<item name="customer_name" xsi:type="object">CustomerNameAggregator</item>
406421
<item name="customer_email" xsi:type="string">sales_order.customer_email</item>
407422
<item name="customer_group_id" xsi:type="string">sales_order.customer_group_id</item>
408-
<item name="payment_method" xsi:type="object">PaymentMethodSubSelect</item>
423+
<item name="payment_method" xsi:type="string">sales_order_payment.method</item>
409424
<item name="shipping_information" xsi:type="string">sales_order.shipping_description</item>
410425
<item name="subtotal" xsi:type="string">sales_creditmemo.subtotal</item>
411426
<item name="shipping_and_handling" xsi:type="string">sales_creditmemo.shipping_amount</item>
@@ -436,6 +451,11 @@
436451
<item name="origin_column" xsi:type="string">billing_address_id</item>
437452
<item name="target_column" xsi:type="string">entity_id</item>
438453
</item>
454+
<item name="sales_order_payment" xsi:type="array">
455+
<item name="table" xsi:type="string">sales_order_payment</item>
456+
<item name="origin_column" xsi:type="string">order_id</item>
457+
<item name="target_column" xsi:type="string">parent_id</item>
458+
</item>
439459
</argument>
440460
<argument name="columns" xsi:type="array">
441461
<item name="entity_id" xsi:type="string">sales_invoice.entity_id</item>
@@ -449,7 +469,7 @@
449469
<item name="customer_name" xsi:type="object">CustomerNameAggregator</item>
450470
<item name="customer_email" xsi:type="string">sales_order.customer_email</item>
451471
<item name="customer_group_id" xsi:type="string">sales_order.customer_group_id</item>
452-
<item name="payment_method" xsi:type="object">PaymentMethodSubSelect</item>
472+
<item name="payment_method" xsi:type="string">sales_order_payment.method</item>
453473
<item name="store_currency_code" xsi:type="string">sales_invoice.store_currency_code</item>
454474
<item name="order_currency_code" xsi:type="string">sales_invoice.order_currency_code</item>
455475
<item name="base_currency_code" xsi:type="string">sales_invoice.base_currency_code</item>

app/code/Magento/SalesRule/Model/Plugin/Resource/Rule.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Rule
1010
/**
1111
* @param \Magento\SalesRule\Model\Resource\Rule $subject
1212
* @param \Closure $proceed
13+
* @param \Magento\Framework\Model\AbstractModel $object
1314
* @return \Magento\Framework\Model\AbstractModel
1415
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
1516
*/
@@ -24,6 +25,7 @@ public function aroundLoadCustomerGroupIds(
2425
/**
2526
* @param \Magento\SalesRule\Model\Resource\Rule $subject
2627
* @param \Closure $proceed
28+
* @param \Magento\Framework\Model\AbstractModel $object
2729
* @return \Magento\Framework\Model\AbstractModel
2830
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2931
*/

app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ public function setValidationFilter($websiteId, $customerGroupId, $couponCode =
103103
),
104104
['code']
105105
);
106-
$select->where('main_table.coupon_type = ? ', \Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON);
106+
107+
$select->where(
108+
'main_table.coupon_type = ? ',
109+
\Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON
110+
);
111+
107112
$orWhereConditions = [
108113
$connection->quoteInto(
109114
'(main_table.coupon_type = ? AND rule_coupons.type = 0)',
@@ -118,8 +123,22 @@ public function setValidationFilter($websiteId, $customerGroupId, $couponCode =
118123
\Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC
119124
),
120125
];
126+
127+
$andWhereConditions = [
128+
$connection->quoteInto(
129+
'rule_coupons.code = ?',
130+
$couponCode
131+
),
132+
$connection->quoteInto(
133+
'(rule_coupons.expiration_date IS NULL OR rule_coupons.expiration_date >= ?)',
134+
$this->_date->date('Y-m-d')
135+
),
136+
];
137+
121138
$orWhereCondition = implode(' OR ', $orWhereConditions);
122-
$select->orWhere('(' . $orWhereCondition . ') AND rule_coupons.code = ?', $couponCode);
139+
$andWhereCondition = implode(' AND ', $andWhereConditions);
140+
141+
$select->orWhere('(' . $orWhereCondition . ') AND ' . $andWhereCondition);
123142
} else {
124143
$this->addFieldToFilter(
125144
'main_table.coupon_type',

app/code/Magento/SalesRule/Test/Unit/Model/Plugin/Resource/RuleTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ public function setUp()
3434
$this->ruleResource = $this->getMockBuilder('Magento\SalesRule\Model\Resource\Rule')
3535
->disableOriginalConstructor()
3636
->getMock();
37-
$this->genericClosure = function (){};
37+
$this->genericClosure = function () {
38+
return;
39+
};
3840
$this->abstractModel = $this->getMockBuilder('Magento\Framework\Model\AbstractModel')
3941
->disableOriginalConstructor()
4042
->getMockForAbstractClass();

app/code/Magento/SalesRule/Test/Unit/Model/Plugin/RuleTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public function setUp()
2929
$this->subject = $this->getMockBuilder('Magento\SalesRule\Model\Rule')
3030
->disableOriginalConstructor()
3131
->getMock();
32-
$this->genericClosure = function (){};
32+
$this->genericClosure = function () {
33+
return;
34+
};
3335

3436
$this->plugin = $objectManager->getObject('Magento\SalesRule\Model\Plugin\Rule');
3537
}

app/code/Magento/Ui/Block/Logger.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Ui\Block;
7+
8+
use Magento\Framework\View\Element\Template;
9+
use Magento\Ui\Model\Config;
10+
11+
class Logger extends Template
12+
{
13+
/**
14+
* @var Config
15+
*/
16+
protected $config;
17+
18+
/**
19+
* @param Template\Context $context
20+
* @param Config $config
21+
* @param array $data
22+
*/
23+
public function __construct(
24+
Template\Context $context,
25+
Config $config,
26+
array $data = []
27+
) {
28+
parent::__construct($context, $data);
29+
$this->config = $config;
30+
}
31+
32+
/**
33+
* Is session storage logging enabled
34+
*
35+
* @return bool
36+
*/
37+
public function isLoggingEnabled()
38+
{
39+
return $this->config->isLoggingEnabled();
40+
}
41+
42+
/**
43+
* Get session storage key
44+
*
45+
* @return string
46+
*/
47+
public function getSessionStorageKey()
48+
{
49+
return $this->config->getSessionStorageKey();
50+
}
51+
}

app/code/Magento/Ui/Model/Config.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Ui\Model;
7+
8+
use Magento\Framework\App\Config\ScopeConfigInterface;
9+
use Magento\Framework\View\Element\Template;
10+
11+
class Config
12+
{
13+
/**
14+
* Configuration path to session storage logging setting
15+
*/
16+
const XML_PATH_LOGGING = 'dev/js/session_storage_logging';
17+
18+
/**
19+
* Configuration path to session storage key setting
20+
*/
21+
const XML_PATH_KEY = 'dev/js/session_storage_key';
22+
23+
/**
24+
* @var ScopeConfigInterface
25+
*/
26+
protected $scopeConfig;
27+
28+
/**
29+
* @param ScopeConfigInterface $scopeConfig
30+
*/
31+
public function __construct(ScopeConfigInterface $scopeConfig)
32+
{
33+
$this->scopeConfig = $scopeConfig;
34+
}
35+
36+
/**
37+
* Is session storage logging enabled
38+
*
39+
* @return bool
40+
*/
41+
public function isLoggingEnabled()
42+
{
43+
return $this->scopeConfig->getValue(self::XML_PATH_LOGGING);
44+
}
45+
46+
/**
47+
* Get session storage key
48+
*
49+
* @return string
50+
*/
51+
public function getSessionStorageKey()
52+
{
53+
return $this->scopeConfig->getValue(self::XML_PATH_KEY);
54+
}
55+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Config/etc/system_file.xsd">
9+
<system>
10+
<section id="dev">
11+
<group id="js">
12+
<field id="session_storage_logging" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0">
13+
<label>Log JS Errors to Session Storage</label>
14+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
15+
<comment>If enabled, can be used by functional tests for extended reporting</comment>
16+
</field>
17+
<field id="session_storage_key" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="0" showInStore="0">
18+
<label>Log JS Errors to Session Storage Key</label>
19+
<comment>Use this key to retrieve collected js errors</comment>
20+
</field>
21+
</group>
22+
</section>
23+
</system>
24+
</config>

app/code/Magento/Ui/etc/config.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd">
9+
<default>
10+
<dev>
11+
<js>
12+
<session_storage_logging>0</session_storage_logging>
13+
<session_storage_key>collected_errors</session_storage_key>
14+
</js>
15+
</dev>
16+
</default>
17+
</config>

0 commit comments

Comments
 (0)