Commit 5a75b9dd authored by mglaman's avatar mglaman Committed by Robert Rollins
Browse files

Issue #2342933: Added option to silence Indefinite COUNT replacement warning.

Thanks go to user mgalman for the patch!
parent 0e07183c
...@@ -85,6 +85,7 @@ class DateiCalFeedsParser extends FeedsParser { ...@@ -85,6 +85,7 @@ class DateiCalFeedsParser extends FeedsParser {
public function configDefaults() { public function configDefaults() {
return array( return array(
'indefinite_count' => '52', 'indefinite_count' => '52',
'indefinite_message_display' => TRUE,
'until_not_utc' => FALSE, 'until_not_utc' => FALSE,
'skip_days' => NULL, 'skip_days' => NULL,
); );
...@@ -107,6 +108,12 @@ class DateiCalFeedsParser extends FeedsParser { ...@@ -107,6 +108,12 @@ class DateiCalFeedsParser extends FeedsParser {
'#description' => t('Indefinitely repeating events are not supported. The repeat count will instead be set to this number.'), '#description' => t('Indefinitely repeating events are not supported. The repeat count will instead be set to this number.'),
'#default_value' => $this->config['indefinite_count'], '#default_value' => $this->config['indefinite_count'],
); );
$form['indefinite_message_display'] = array(
'#title' => t('Display message when RRULE is missing COUNT'),
'#type' => 'checkbox',
'#default_value' => $this->config['indefinite_message_display'],
'#description' => t('Display a message when an indefinitely repeating rule is adjusted by the "Indefinite COUNT" setting above.'),
);
$form['until_not_utc'] = array( $form['until_not_utc'] = array(
'#title' => t('RRULE UNTILs are not in UTC'), '#title' => t('RRULE UNTILs are not in UTC'),
'#type' => 'checkbox', '#type' => 'checkbox',
......
...@@ -448,10 +448,11 @@ class ParserVcalendar { ...@@ -448,10 +448,11 @@ class ParserVcalendar {
$rrule_data['value']['INTERVAL'] = '1'; $rrule_data['value']['INTERVAL'] = '1';
} }
if (!isset($rrule_data['value']['COUNT']) && !isset($rrule_data['value']['UNTIL'])) { if ((!isset($rrule_data['value']['COUNT']) && !isset($rrule_data['value']['UNTIL']))) {
$msg = "The event with UID %uid has an indefinitely repeating RRULE, which the Date Repeat module doesn't support. $msg = "The event with UID %uid has an indefinitely repeating RRULE, which the Date Repeat module doesn't support.
As a workaround, Date iCal set the repeat count to @count. This value can be customized in the iCal parser settings."; As a workaround, Date iCal set the repeat count to @count. This value can be customized in the iCal parser settings.";
watchdog('date_ical', $msg, array('%uid' => $uid, '@count' => $count), WATCHDOG_WARNING); watchdog('date_ical', $msg, array('%uid' => $uid, '@count' => $count), WATCHDOG_WARNING);
if ($this->config['indefinite_message_display']) {
drupal_set_message( drupal_set_message(
t("At least one of the events in this iCal feed has an indefinitely repeating RRULE, which the Date Repeat module doesn't support.<br> t("At least one of the events in this iCal feed has an indefinitely repeating RRULE, which the Date Repeat module doesn't support.<br>
As a workaround, Date iCal set the repeat count to @count. This value can be customized in the iCal parser settings.", As a workaround, Date iCal set the repeat count to @count. This value can be customized in the iCal parser settings.",
...@@ -459,6 +460,7 @@ class ParserVcalendar { ...@@ -459,6 +460,7 @@ class ParserVcalendar {
'warning', 'warning',
FALSE FALSE
); );
}
$rrule_data['value']['COUNT'] = $this->config['indefinite_count']; $rrule_data['value']['COUNT'] = $this->config['indefinite_count'];
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment