* Calendar: deny creating of recurring events, if duration of a single recurrence is longer then the recurrence interval

This commit is contained in:
Ralf Becker 2012-10-22 15:47:06 +00:00
parent f8a007bad4
commit 7d5c44ac61
4 changed files with 38 additions and 0 deletions

View File

@ -311,6 +311,36 @@ class calendar_rrule implements Iterator
} }
} }
/**
* Get recurrence interval duration in seconds
*
* @param int $type self::(DAILY|WEEKLY|MONTHLY_(M|W)DAY|YEARLY)
* @param int $interval=1
* @return int
*/
public static function recurrence_interval($type, $interval=1)
{
switch($type)
{
case self::DAILY:
$duration = 24*3600;
break;
case self::WEEKLY:
$duration = 7*24*3600;
break;
case self::MONTHLY_MDAY:
case self::MONTHLY_WDAY:
$duration = 31*24*3600;
break;
case self::YEARLY:
$duration = 366*24*3600;
break;
}
if ($interval > 1) $duration *= $interval;
return $duration;
}
/** /**
* Get number of days in month of given date * Get number of days in month of given date
* *

View File

@ -537,6 +537,12 @@ class calendar_uiforms extends calendar_ui
$button = ''; $button = '';
break; break;
} }
if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval']))
{
$msg = lang('Error: Duration of event longer then recurrence interval!');
$button = '';
break;
}
if (!$event['participants']) if (!$event['participants'])
{ {
$msg = lang('Error: no participants selected !!!'); $msg = lang('Error: no participants selected !!!');

View File

@ -167,6 +167,7 @@ enddate of the export calendar de Enddatum des Exports
ends calendar de endet ends calendar de endet
error adding the alarm calendar de Fehler beim Zufügen des Alarms error adding the alarm calendar de Fehler beim Zufügen des Alarms
error: can't delete original series! calendar de Fehler beim Löschen der bestehenden Serie error: can't delete original series! calendar de Fehler beim Löschen der bestehenden Serie
error: duration of event longer then recurrence interval! calendar de Fehler: Termindauer ist länger als das Intervall der Wiederholung!
error: importing the ical calendar de Fehler beim Importieren des iCal error: importing the ical calendar de Fehler beim Importieren des iCal
error: no participants selected !!! calendar de Fehler: Keine Teilnehmer ausgewählt !!! error: no participants selected !!! calendar de Fehler: Keine Teilnehmer ausgewählt !!!
error: ressources reservation in private events is not allowed!!! calendar de Fehler: Die Reservierung von Ressourcen für private Termine ist nicht erlaubt !!! error: ressources reservation in private events is not allowed!!! calendar de Fehler: Die Reservierung von Ressourcen für private Termine ist nicht erlaubt !!!

View File

@ -167,6 +167,7 @@ enddate of the export calendar en End date of the export
ends calendar en Ends ends calendar en Ends
error adding the alarm calendar en Error adding the alarm error adding the alarm calendar en Error adding the alarm
error: can't delete original series! calendar en Error: Can't delete original series! error: can't delete original series! calendar en Error: Can't delete original series!
error: duration of event longer then recurrence interval! calendar en Error: Duration of event longer then recurrence interval!
error: importing the ical calendar en Error: importing the iCal! error: importing the ical calendar en Error: importing the iCal!
error: no participants selected !!! calendar en Error: no participants selected! error: no participants selected !!! calendar en Error: no participants selected!
error: ressources reservation in private events is not allowed!!! calendar en Error: Resources reservation in private events is not allowed! error: ressources reservation in private events is not allowed!!! calendar en Error: Resources reservation in private events is not allowed!