summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Stevenson2012-01-18 20:47:17 (GMT)
committer Karen Stevenson2012-01-18 20:47:17 (GMT)
commitf77e6897ff97364869960c103407233360c4b9fb (patch)
treefe32940a02ca8222d013c10a23e56165fde9e0b0
parent686a4658b80e4c8f9ea7c38f364308cd8d66d4f1 (diff)
Issue #1359464, Temporary fix for broken handling of repeating dates on users with a TODO to figure out where it's coming from.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--date_repeat_field/date_repeat_field.module22
2 files changed, 20 insertions, 3 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 2ed2278..5a75c0b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -5,6 +5,7 @@ Date Module 7.x
Version 7.x-2.x-dev
===================
+- Issue #1359464, Temporary fix for broken handling of repeating dates on users with a TODO to figure out where it's coming from.
- Issue #1404494 by byrond, Make sure hidden formatters don't get switched to date_default in update hook.
- Issue #1386012, Order weekdays in Date Repeat form to match the site first day of week settings.
- Issue #1376476 by pbfleetwood, Add commas to default formatting of week and day headers.
diff --git a/date_repeat_field/date_repeat_field.module b/date_repeat_field/date_repeat_field.module
index 88dd5b3..787fa07 100644
--- a/date_repeat_field/date_repeat_field.module
+++ b/date_repeat_field/date_repeat_field.module
@@ -202,6 +202,20 @@ function date_repeat_field_date_field_insert_alter(&$items, $context) {
date_repeat_field_date_field_insert($items, $context);
}
+/*
+ * Implements hook_date_field_update_alter().
+ */
+function date_repeat_field_date_field_update_alter(&$items, $context) {
+
+ // If you have a repeating date field on a user and don't check the box to repeat it,
+ // we end up with $items[0]['rrule'] = array('additions' => '', 'exceptions' => ''));
+ // This will clean it up by getting rid of those bogus values.
+ // @TODO Figure out where that's coming from. It doesn't happen on nodes.
+ if (!empty($items[0]['rrule']) && is_array($items[0]['rrule'])) {
+ $items[0]['rrule'] = NULL;
+ }
+}
+
/**
* Implements hook_field_widget_form_alter().
*/
@@ -268,13 +282,15 @@ function date_repeat_field_widget_validate($element, &$form_state) {
$rrule_values = date_repeat_merge($input['rrule'], $element['rrule']);
// If no repeat information was set, treat this as a normal, non-repeating value.
- if ($rrule_values['FREQ'] == 'NONE') {
+ if ($rrule_values['FREQ'] == 'NONE' || empty($input['show_repeat_settings'])) {
$item['rrule'] = NULL;
+ form_set_value($element, $item, $form_state);
+ return;
}
// If no start date was set, clean up the form and return.
if (empty($item['value'])) {
- form_set_value($element, array($item), $form_state);
+ form_set_value($element, NULL, $form_state);
return;
}
@@ -467,7 +483,7 @@ function date_repeat_field_date_combo_process_alter(&$element, &$form_state, $co
// Add a date repeat form element, if needed.
// We delayed until this point so we don't bother adding it to hidden fields.
if (date_is_repeat_field($field, $instance)) {
-
+
$item = $element['#value'];
$element['rrule'] = array(
'#type' => 'date_repeat_rrule',