Skip to content
Snippets Groups Projects
Commit 991b0d8f authored by Ivan Doroshenko's avatar Ivan Doroshenko :flag_ua:
Browse files

Fixed migration of recurring dates into smart date fields.

parent 648a11dd
No related branches found
No related tags found
1 merge request!36Fixed migration of recurring dates into smart date fields.
......@@ -66,6 +66,13 @@ class UwSmartDate extends ProcessPluginBase {
'repeat-advanced' => $rule->getParametersArray(),
];
// Duplicate interval value as parent array key because this is where
// smart_date expects it to be since:
// https://www.drupal.org/project/smart_date/issues/3176366
if (isset($new_item['repeat-advanced']['interval'])) {
$new_item['interval'] = $new_item['repeat-advanced']['interval'];
}
if (!empty($rule_values['limit'])) {
[$limit_type, $limit_value] = explode('=', $rule_values['limit']);
$new_item['repeat-end'] = $limit_type;
......
......@@ -140,6 +140,7 @@ class UwSmartDateTest extends KernelTestBase {
'byhour' => [],
'byminute' => [],
],
'interval' => 1,
'repeat-end' => 'COUNT',
'repeat-end-count' => '2',
'repeat-end-date' => '',
......@@ -161,6 +162,7 @@ class UwSmartDateTest extends KernelTestBase {
'byhour' => [],
'byminute' => [],
],
'interval' => 1,
'repeat-end' => 'COUNT',
'repeat-end-count' => '2',
'repeat-end-date' => '',
......@@ -196,6 +198,7 @@ RDATE:20120320T040000Z,20120417T040000Z,20120524T040000Z,20120621T040000Z',
'byhour' => [],
'byminute' => [],
],
'interval' => 4,
'repeat-end' => 'UNTIL',
'repeat-end-count' => '',
'repeat-end-date' => '20120622T035959Z',
......@@ -217,6 +220,7 @@ RDATE:20120320T040000Z,20120417T040000Z,20120524T040000Z,20120621T040000Z',
'byhour' => [],
'byminute' => [],
],
'interval' => 4,
'repeat-end' => 'UNTIL',
'repeat-end-count' => '',
'repeat-end-date' => '20120622T035959Z',
......@@ -238,6 +242,7 @@ RDATE:20120320T040000Z,20120417T040000Z,20120524T040000Z,20120621T040000Z',
'byhour' => [],
'byminute' => [],
],
'interval' => 4,
'repeat-end' => 'UNTIL',
'repeat-end-count' => '',
'repeat-end-date' => '20120622T035959Z',
......@@ -259,6 +264,7 @@ RDATE:20120320T040000Z,20120417T040000Z,20120524T040000Z,20120621T040000Z',
'byhour' => [],
'byminute' => [],
],
'interval' => 4,
'repeat-end' => 'UNTIL',
'repeat-end-count' => '',
'repeat-end-date' => '20120622T035959Z',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment