* 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:50:33 +00:00
parent d7b0414a49
commit c90fc65566
4 changed files with 48 additions and 8 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
*

View File

@ -507,6 +507,12 @@ class calendar_uiforms extends calendar_ui
$button = '';
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'])
{
$msg = lang('Error: no participants selected !!!');

View File

@ -128,10 +128,12 @@ enddate / -time of the meeting, eg. for more then one day calendar de Enddatum u
enddate of the export calendar de Enddatum des Exports
ends calendar de endet
error adding the alarm calendar de Fehler beim Zufügen des Alarms
error: importing the ical calendar de Fehler: beim Importieren des iCal
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: saving the event !!! calendar de Fehler: beim Speichern des Termins !!!
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: 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: saving the event !!! calendar de Fehler beim Speichern des Termins !!!
error: starttime has to be before the endtime !!! calendar de Fehler: Startzeit muss vor Endzeit liegen !!!
error: the entry has been updated since you opened it for editing! calendar de Fehler: der Eintrag wurde geändert seit Sie ihn zum Bearbeiten geöffnet haben!
event copied - the copy can now be edited calendar de Termin kopiert - die Kopie kann jetzt bearbeitet werden

View File

@ -120,10 +120,12 @@ enddate / -time of the meeting, eg. for more then one day calendar en End date /
enddate of the export calendar en End date of the export
ends calendar en ends
error adding the alarm calendar en Error adding the alarm
error: importing the ical calendar en Error: importing the iCal
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: saving the event !!! calendar en Error: saving the event !!!
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: 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: saving the event !!! calendar en Error saving the event!
error: starttime has to be before the endtime !!! calendar en Error: Start time has to be before the end time !!!
error: the entry has been updated since you opened it for editing! calendar en Error: The entry has been updated since you opened it for editing!
event copied - the copy can now be edited calendar en Event copied - the copy can now be edited