Skip to content

Commit 4ae6c9d

Browse files
author
rossbrandon
committed
Merge branch 'MAGETWO-84650-missing-periods-release-notification-2.2.2' into MAGETWO-84649-cloud-support-analytics-222
2 parents 2e14441 + ed6df7f commit 4ae6c9d

File tree

11 files changed

+119
-33
lines changed

11 files changed

+119
-33
lines changed

app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ protected function _applyConfigurableOption()
133133
['le' => $this->getTable('catalog_product_entity')],
134134
'le.' . $linkField . ' = l.parent_id',
135135
['parent_id' => 'entity_id']
136+
)->join(
137+
['i' => $this->_getDefaultFinalPriceTable()],
138+
'le.entity_id = i.entity_id',
139+
[]
136140
);
137141

138142
$select = $connection->select();

app/code/Magento/Cron/Model/ResourceModel/Schedule.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,14 @@ public function trySetJobUniqueStatusAtomic($scheduleId, $newStatus, $currentSta
6666
{
6767
$connection = $this->getConnection();
6868

69-
$match = $connection->quoteInto('existing.job_code = current.job_code AND existing.status = ?', $newStatus);
69+
// this condition added to avoid cron jobs locking after incorrect termination of running job
70+
$match = $connection->quoteInto(
71+
'existing.job_code = current.job_code ' .
72+
'AND (existing.executed_at > UTC_TIMESTAMP() - INTERVAL 1 DAY OR existing.executed_at IS NULL) ' .
73+
'AND existing.status = ?',
74+
$newStatus
75+
);
76+
7077
$selectIfUnlocked = $connection->select()
7178
->joinLeft(
7279
['existing' => $this->getTable('cron_schedule')],
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Cron\Setup;
8+
9+
use Magento\Framework\Setup\InstallSchemaInterface;
10+
use Magento\Framework\Setup\ModuleContextInterface;
11+
use Magento\Framework\Setup\SchemaSetupInterface;
12+
13+
/**
14+
* Cron recurring setup
15+
*/
16+
class Recurring implements InstallSchemaInterface
17+
{
18+
/**
19+
* @var \Magento\Cron\Model\ResourceModel\Schedule
20+
*/
21+
private $schedule;
22+
23+
/**
24+
* Recurring constructor.
25+
* @param \Magento\Cron\Model\ResourceModel\Schedule $schedule
26+
*/
27+
public function __construct(
28+
\Magento\Cron\Model\ResourceModel\Schedule $schedule
29+
) {
30+
$this->schedule = $schedule;
31+
}
32+
33+
/**
34+
* {@inheritdoc}
35+
*/
36+
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
37+
{
38+
$connection = $this->schedule->getConnection();
39+
$connection->update(
40+
$this->schedule->getMainTable(),
41+
[
42+
'status' => \Magento\Cron\Model\Schedule::STATUS_ERROR,
43+
'messages' => 'The job is terminated due to system upgrade'
44+
],
45+
$connection->quoteInto('status = ?', \Magento\Cron\Model\Schedule::STATUS_RUNNING)
46+
);
47+
}
48+
}

app/code/Magento/Customer/Block/Address/Edit.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ protected function _prepareLayout()
139139

140140
if ($postedData = $this->_customerSession->getAddressFormData(true)) {
141141
$postedData['region'] = [
142-
'region_id' => $postedData['region_id'],
143-
'region' => $postedData['region'],
142+
'region' => $postedData['region'] ?? null,
144143
];
144+
if (!empty($postedData['region_id'])) {
145+
$postedData['region']['region_id'] = $postedData['region_id'];
146+
}
145147
$this->dataObjectHelper->populateWithArray(
146148
$this->_address,
147149
$postedData,

app/code/Magento/Customer/Model/AttributeChecker.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Magento\Customer\Api\AddressMetadataInterface;
99
use Magento\Customer\Api\AddressMetadataManagementInterface;
1010
use Magento\Customer\Model\Metadata\AttributeResolver;
11-
use Magento\Framework\App\Helper\Context;
1211

1312
/**
1413
* Customer attribute checker.

app/code/Magento/Customer/Test/Unit/Block/Address/EditTest.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ protected function setUp()
101101
);
102102
}
103103

104-
public function testSetLayoutWithOwnAddressAndPostedData()
104+
/**
105+
* @param array $postedData
106+
* @dataProvider postedDataProvider
107+
*/
108+
public function testSetLayoutWithOwnAddressAndPostedData(array $postedData)
105109
{
106110
$addressId = 1;
107111
$customerId = 1;
108112
$title = __('Edit Address');
109-
$postedData = [
110-
'region_id' => 1,
111-
'region' => 'region',
112-
];
113113
$newPostedData = $postedData;
114114
$newPostedData['region'] = $postedData;
115115

@@ -169,6 +169,21 @@ public function testSetLayoutWithOwnAddressAndPostedData()
169169
$this->assertEquals($layoutMock, $this->model->getLayout());
170170
}
171171

172+
/**
173+
* @return array
174+
*/
175+
public function postedDataProvider()
176+
{
177+
return [
178+
[
179+
['region_id' => 1, 'region' => 'region']
180+
],
181+
[
182+
['region' => 'region without id']
183+
]
184+
];
185+
}
186+
172187
/**
173188
* @throws \Magento\Framework\Exception\LocalizedException
174189
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)

app/code/Magento/Customer/view/frontend/templates/widget/telephone.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<?php
2020
$_validationClass = $block->escapeHtmlAttr(
2121
$this->helper('Magento\Customer\Helper\Address')
22-
->getAttributeValidationClass('fax')
22+
->getAttributeValidationClass('telephone')
2323
);
2424
?>
2525
<input type="text"

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
payment and shipping information to skip tedious checkout steps.</p>
1616
</div>
1717
<div class=""email-marketing-highlight"">
18-
<h3>Email Marketing Automation</span></h3>
18+
<h3>Email Marketing Automation</h3>
1919
<p>Send smarter, faster email campaigns with marketing automation from dotmailer, powered by
2020
your Magento store's live data.</p>
2121
</div>
@@ -34,7 +34,7 @@
3434
payment and shipping information to skip tedious checkout steps.</p>
3535
</div>
3636
<div class=""email-marketing-highlight"">
37-
<h3>Email Marketing Automation</span></h3>
37+
<h3>Email Marketing Automation</h3>
3838
<p>Send smarter, faster email campaigns with marketing automation from dotmailer, powered by
3939
your Magento store's live data.</p>
4040
</div>
@@ -65,26 +65,26 @@
6565
features include:
6666
</p>
6767
<ul>
68-
<li><span>Configurable “Instant Purchase” button to place orders</span></li>
68+
<li><span>Configurable “Instant Purchase” button to place orders.</span></li>
6969
<li><span>Support for all payment solutions using Braintree Vault, including Braintree Credit
7070
Card, Braintree PayPal, and PayPal Payflow Pro.</span></li>
7171
<li><span>Shipping to the customer’s default address using the lowest cost, available shipping
72-
method</span></li>
72+
method.</span></li>
7373
<li><span>Ability for developers to customize the Instant Purchase business logic to meet
74-
merchant needs</span></li>
74+
merchant needs.</span></li>
7575
</ul>","<p>Now you can deliver an Amazon-like experience with a new, streamlined checkout option.
7676
Logged-in customers can use previously-stored payment credentials and shipping information
7777
to skip steps, making the process faster and easier, especially for mobile shoppers. Key
7878
features include:
7979
</p>
8080
<ul>
81-
<li><span>Configurable “Instant Purchase” button to place orders</span></li>
81+
<li><span>Configurable “Instant Purchase” button to place orders.</span></li>
8282
<li><span>Support for all payment solutions using Braintree Vault, including Braintree Credit
8383
Card, Braintree PayPal, and PayPal Payflow Pro.</span></li>
8484
<li><span>Shipping to the customer’s default address using the lowest cost, available shipping
85-
method</span></li>
85+
method.</span></li>
8686
<li><span>Ability for developers to customize the Instant Purchase business logic to meet
87-
merchant needs</span></li>
87+
merchant needs.</span></li>
8888
</ul>"
8989
"Email Marketing Automation","Email Marketing Automation"
9090
"<p>Unlock an unparalleled level of insight and control of your eCommerce marketing with

app/code/Magento/ReleaseNotification/view/adminhtml/ui_component/release_notification.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
payment and shipping information to skip tedious checkout steps.</p>
7474
</div>
7575
<div class="email-marketing-highlight">
76-
<h3>Email Marketing Automation</span></h3>
76+
<h3>Email Marketing Automation</h3>
7777
<p>Send smarter, faster email campaigns with marketing automation from dotmailer, powered by
7878
your Magento store's live data.</p>
7979
</div>
@@ -226,13 +226,13 @@
226226
features include:
227227
</p>
228228
<ul>
229-
<li><span>Configurable “Instant Purchase” button to place orders</span></li>
229+
<li><span>Configurable “Instant Purchase” button to place orders.</span></li>
230230
<li><span>Support for all payment solutions using Braintree Vault, including Braintree Credit
231231
Card, Braintree PayPal, and PayPal Payflow Pro.</span></li>
232232
<li><span>Shipping to the customer’s default address using the lowest cost, available shipping
233-
method</span></li>
233+
method.</span></li>
234234
<li><span>Ability for developers to customize the Instant Purchase business logic to meet
235-
merchant needs</span></li>
235+
merchant needs.</span></li>
236236
</ul>]]>
237237
</item>
238238
</item>

dev/tests/integration/testsuite/Magento/Cron/Model/ScheduleTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,27 @@ public function testTryLockJobAlreadyLockedFails()
5454
$this->assertFalse($schedule->tryLockJob());
5555
}
5656

57+
/**
58+
* If the job is already locked but lock time less than 1 day ago, attempting to lock it again should fail
59+
*/
60+
public function testTryLockJobAlreadyLockedSucceeds()
61+
{
62+
$offsetInThePast = 2*24*60*60;
63+
64+
$oldSchedule = $this->scheduleFactory->create()
65+
->setCronExpr("* * * * *")
66+
->setJobCode("test_job")
67+
->setStatus(Schedule::STATUS_RUNNING)
68+
->setCreatedAt(strftime('%Y-%m-%d %H:%M:%S', $this->dateTime->gmtTimestamp() - $offsetInThePast))
69+
->setScheduledAt(strftime('%Y-%m-%d %H:%M', $this->dateTime->gmtTimestamp() - $offsetInThePast + 60))
70+
->setExecutedAt(strftime('%Y-%m-%d %H:%M', $this->dateTime->gmtTimestamp() - $offsetInThePast + 61));
71+
$oldSchedule->save();
72+
73+
$schedule = $this->createSchedule("test_job", Schedule::STATUS_PENDING);
74+
75+
$this->assertTrue($schedule->tryLockJob());
76+
}
77+
5778
/**
5879
* If there's a job already locked, should not be able to lock another job
5980
*/

0 commit comments

Comments
 (0)