fix adding and deleting of explicit recurrences / rdates (also disable recur-enddate in UI for RDates)

This commit is contained in:
ralf 2024-07-01 11:39:28 +02:00
parent 2a87ebdbe6
commit b7c144423c
5 changed files with 19 additions and 5 deletions

View File

@ -1577,8 +1577,10 @@ class calendar_boupdate extends calendar_bo
$event['created'] = $save_event['created'] = $this->now;
$event['creator'] = $save_event['creator'] = $this->user;
}
$set_recurrences = $old_event ? abs(Api\DateTime::to($event['recur_enddate'] ?? null, 'utc') - Api\DateTime::to($old_event['recur_enddate'] ?? null, 'utc')) > 1 ||
count($old_event['recur_exception'] ?? []) != count($event['recur_exception'] ?? []) : false;
$set_recurrences = !$old_event ? false :
abs(Api\DateTime::to($event['recur_enddate'] ?? null, 'utc') - Api\DateTime::to($old_event['recur_enddate'] ?? null, 'utc')) > 1 ||
count($old_event['recur_exception'] ?? []) != count($event['recur_exception'] ?? []) ||
count($old_event['recur_rdates'] ?? []) != count($event['recur_rdates'] ?? []);
$set_recurrences_start = 0;
if (($cal_id = $this->so->save($event,$set_recurrences,$set_recurrences_start,0,$event['etag'])) && $set_recurrences && !empty($event['recur_type']))
{

View File

@ -344,8 +344,17 @@ class calendar_uiforms extends calendar_ui
unset($content['recur_rdates']['delete_rdate']);
if (($key = array_search($date, $content['recur_rdates'])) !== false)
{
unset($content['recur_rdates'][$key]);
$content['recur_rdates'] = array_values($content['recur_rdates']);
// if this is an initial edit, simply remove the rdate
if (empty($content['id']))
{
unset($content['recur_rdates'][$key]);
$content['recur_rdates'] = array_values($content['recur_rdates']);
}
// otherwise add the recurrence as (deleted) exception
elseif (!in_array($date, $content['recur_exception']))
{
$content['recur_exception'][] = $date;
}
}
}
// delete an alarm

View File

@ -317,7 +317,7 @@ export class CalendarApp extends EgwApp
{
this.freetime_search();
}
//send Syncronus ajax request to the server to unlock the on close entry
//send synchronous ajax request to the server to unlock the on close entry
//set onbeforeunload with json request to send request when the window gets close by X button
if (content.data.lock_token)
{
@ -1421,6 +1421,7 @@ export class CalendarApp extends EgwApp
{
addRdate.set_disabled(recurType.value != 9);
recurRdate.set_disabled(recurType.value != 9);
this.et2.getWidgetById('recur_enddate')?.set_disabled(recurType.value == 9);
}
}

View File

@ -36,6 +36,7 @@ add recurrence calendar de Wiederholung hinzufügen
add timesheet entry calendar de Stundenzettel hinzufügen
added calendar de Neuer Termin
added by synchronization calendar de Durch Synchronisation hinzugefügt
added recurrence on %1. calendar de Wiederholung am %1 hinzugefügt.
after calendar de Nach
after %1 calendar de Nach dem %1
after current date calendar de Nach dem aktuellen Datum

View File

@ -36,6 +36,7 @@ add recurrence calendar en Add recurrence
add timesheet entry calendar en Add timesheet entry
added calendar en Added
added by synchronization calendar en Added by synchronization
added recurrence on %1. calendar en Added recurrence on %1.
after calendar en After
after %1 calendar en After %1
after current date calendar en After current date