Merge branch 'spidev' into 'master'
Kalander Update See merge request fronk/thetool!1829
This commit is contained in:
@@ -879,6 +879,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
}
|
||||
|
||||
if ($mainEvent->is_organizer == 1 && ($mainEvent->linked_event_uid)) {
|
||||
$dbCore = self::dbKalender();
|
||||
$sqlLinked = "SELECT ce.id, ce.calendar_id, cc.ms_user_id microsoft_id
|
||||
FROM cal_events ce
|
||||
LEFT JOIN cal_calendars cc ON ce.calendar_id = cc.id
|
||||
@@ -894,7 +895,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
if (isset($updateArray['start_time']))
|
||||
$linkedUpdateArray['start_time'] = $updateArray['start_time'];
|
||||
if (isset($updateArray['end_time']))
|
||||
$linkedUpdateArray['end_time'] = $updateArray['end_time'];
|
||||
$linkedUpdateArray['end_time'] = $end;
|
||||
if (isset($updateArray['name']))
|
||||
$linkedUpdateArray['name'] = $updateArray['name'];
|
||||
if (isset($updateArray['description']))
|
||||
@@ -931,8 +932,15 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
$orgName = '';
|
||||
$orgEmail = '';
|
||||
if ($organizerCalendar[0]->user_id) {
|
||||
$orgName = $organizerCalendar[0]->user->name;
|
||||
$orgEmail = $organizerCalendar[0]->user->email;
|
||||
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||
INNER JOIN `core_user` ON `cal_calendars`.`user_id`=`core_user`.`id` WHERE `cal_calendars`.id = '" . $user_id . "' LIMIT 1";
|
||||
|
||||
$resOrgUser = $dbCore->query($sql);
|
||||
if ($dbCore->num_rows($resOrgUser)) {
|
||||
$orgUserData = $dbCore->fetch_object($resOrgUser);
|
||||
$orgName = $orgUserData->name;
|
||||
$orgEmail = $orgUserData->email;
|
||||
}
|
||||
} elseif ($organizerCalendar[0]->calendar_name) {
|
||||
$orgName = $organizerCalendar[0]->calendar_name;
|
||||
$orgEmail = $organizerCalendar[0]->calendar_email ?: '';
|
||||
@@ -953,18 +961,29 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
$attName = '';
|
||||
$attEmail = '';
|
||||
if ($attCal[0]->user_id) {
|
||||
$attName = $attCal[0]->user->name;
|
||||
$attEmail = $attCal[0]->user->email;
|
||||
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||
INNER JOIN `core_user` ON `cal_calendars`.`user_id`=`core_user`.`id` WHERE `cal_calendars`.id = '" . intval($att) . "' LIMIT 1";
|
||||
|
||||
$resAttUser = $dbCore->query($sql);
|
||||
|
||||
if ($dbCore->num_rows($resAttUser)) {
|
||||
$attUserData = $dbCore->fetch_object($resAttUser);
|
||||
$attName = $attUserData->name;
|
||||
$attEmail = $attUserData->email;
|
||||
}
|
||||
} elseif ($attCal[0]->calendar_name) {
|
||||
$attName = $attCal[0]->calendar_name;
|
||||
$attEmail = $attCal[0]->calendar_email ?: '';
|
||||
}
|
||||
$attendeesForLinkedEvent['required'][] = array(
|
||||
'name' => $attName,
|
||||
'email' => $attEmail,
|
||||
'response' => 'none',
|
||||
'time' => '0001-01-01 00:00:00.000000'
|
||||
);
|
||||
|
||||
if ($attName && $attEmail) {
|
||||
$attendeesForLinkedEvent['required'][] = array(
|
||||
'name' => $attName,
|
||||
'email' => $attEmail,
|
||||
'response' => 'none',
|
||||
'time' => '0001-01-01 00:00:00.000000'
|
||||
);
|
||||
}
|
||||
}
|
||||
} elseif (!is_numeric($att)) {
|
||||
$attendeesForLinkedEvent['required'][] = array(
|
||||
@@ -1018,19 +1037,18 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
$newAttendeeCalId = intval($emailCalData->go_calendar_id);
|
||||
}
|
||||
}
|
||||
error_log("=== NEUER TEILNEHMER CHECK ===");
|
||||
error_log("newAttendee Wert: " . print_r($newAttendee, true));
|
||||
error_log("newAttendeeCalId: " . ($newAttendeeCalId ?: 'NULL'));
|
||||
error_log("currentAttendeeCalendarIds: " . print_r($currentAttendeeCalendarIds, true));
|
||||
error_log("Ist in currentAttendeeCalendarIds? " . (in_array($newAttendeeCalId, $currentAttendeeCalendarIds) ? "JA" : "NEIN"));
|
||||
// DEBUG ENDE
|
||||
// error_log("=== NEUER TEILNEHMER CHECK ===");
|
||||
// error_log("newAttendee Wert: " . print_r($newAttendee, true));
|
||||
// error_log("newAttendeeCalId: " . ($newAttendeeCalId ?: 'NULL'));
|
||||
// error_log("currentAttendeeCalendarIds: " . print_r($currentAttendeeCalendarIds, true));
|
||||
// error_log("Ist in currentAttendeeCalendarIds? " . (in_array($newAttendeeCalId, $currentAttendeeCalendarIds) ? "JA" : "NEIN"));
|
||||
//
|
||||
|
||||
|
||||
if ($newAttendeeCalId) {
|
||||
if (!in_array($newAttendeeCalId, $currentAttendeeCalendarIds)) {
|
||||
$newAttCal = self::search(array("go_calendar_id" => $newAttendeeCalId));
|
||||
if (count($newAttCal) > 0) {
|
||||
// ÄNDERUNG: Prüfe ms_user_id in cal_calendars statt microsoft_id in Calendar
|
||||
$resCheckNewAttMs = $db->select("cal_calendars", "ms_user_id", "id = '" . $newAttendeeCalId . "' LIMIT 1");
|
||||
$hasMsId = false;
|
||||
if ($db->num_rows($resCheckNewAttMs)) {
|
||||
@@ -1045,8 +1063,15 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
$organizerEmail = '';
|
||||
if ($organizerCalendar && count($organizerCalendar) > 0) {
|
||||
if ($organizerCalendar[0]->user_id) {
|
||||
$organizerName = $organizerCalendar[0]->user->name;
|
||||
$organizerEmail = $organizerCalendar[0]->user->email;
|
||||
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||
INNER JOIN `core_user` ON `cal_calendars`.`user_id`=`core_user`.`id` WHERE `cal_calendars`.id = '" . $user_id . "' LIMIT 1";
|
||||
error_log('new Calendar resOrgUser2: '.$sql);
|
||||
$resOrgUser2 = $dbCore->query($sql);
|
||||
if ($dbCore->num_rows($resOrgUser2)) {
|
||||
$orgUserData2 = $dbCore->fetch_object($resOrgUser2);
|
||||
$organizerName = $orgUserData2->name;
|
||||
$organizerEmail = $orgUserData2->email;
|
||||
}
|
||||
} elseif ($organizerCalendar[0]->calendar_name) {
|
||||
$organizerName = $organizerCalendar[0]->calendar_name;
|
||||
$organizerEmail = $organizerCalendar[0]->calendar_email ?: '';
|
||||
@@ -1076,18 +1101,28 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
$otherName = '';
|
||||
$otherEmail = '';
|
||||
if ($otherCal[0]->user_id) {
|
||||
$otherName = $otherCal[0]->user->name;
|
||||
$otherEmail = $otherCal[0]->user->email;
|
||||
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||
INNER JOIN `core_user` ON `cal_calendars`.`user_id`=`core_user`.`id` WHERE `cal_calendars`.id = '" . intval($otherAtt) . "' LIMIT 1";
|
||||
error_log('new Calendar resOtherUser: '.$sql);
|
||||
$resOtherUser = $dbCore->query($sql);
|
||||
if ($dbCore->num_rows($resOtherUser)) {
|
||||
$otherUserData = $dbCore->fetch_object($resOtherUser);
|
||||
$otherName = $otherUserData->name;
|
||||
$otherEmail = $otherUserData->email;
|
||||
}
|
||||
} elseif ($otherCal[0]->calendar_name) {
|
||||
$otherName = $otherCal[0]->calendar_name;
|
||||
$otherEmail = $otherCal[0]->calendar_email ?: '';
|
||||
}
|
||||
$newAttendeesForEvent['required'][] = array(
|
||||
'name' => $otherName,
|
||||
'email' => $otherEmail,
|
||||
'response' => 'none',
|
||||
'time' => '0001-01-01 00:00:00.000000'
|
||||
);
|
||||
|
||||
if ($otherName && $otherEmail) {
|
||||
$newAttendeesForEvent['required'][] = array(
|
||||
'name' => $otherName,
|
||||
'email' => $otherEmail,
|
||||
'response' => 'none',
|
||||
'time' => '0001-01-01 00:00:00.000000'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$newAttendeesForEvent['required'][] = array(
|
||||
@@ -1103,7 +1138,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
$newAttendeesJson = json_encode($newAttendeesForEvent);
|
||||
$newAttendeeDataarray = array(
|
||||
"start_time" => $updateArray['start_time'],
|
||||
'end_time' => $updateArray['end_time'],
|
||||
'end_time' => $end,
|
||||
'name' => $updateArray['name'],
|
||||
'description' => $updateArray['description'] ?? '',
|
||||
'location' => $updateArray['location'] ?? '',
|
||||
@@ -1364,14 +1399,23 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
$db->insert("TheTool_CalendarQueue", $data);
|
||||
}
|
||||
if ($attendees) {
|
||||
$dbCore =self::dbKalender();;
|
||||
|
||||
$organizerCalendar = self::search(array("go_calendar_id" => $user_id));
|
||||
$organizerName = '';
|
||||
$organizerEmail = '';
|
||||
|
||||
if ($organizerCalendar && count($organizerCalendar) > 0) {
|
||||
if ($organizerCalendar[0]->user_id) {
|
||||
$organizerName = $organizerCalendar[0]->user->name;
|
||||
$organizerEmail = $organizerCalendar[0]->user->email;
|
||||
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||
INNER JOIN `core_user` ON `cal_calendars`.`user_id`=`core_user`.`id` WHERE `cal_calendars`.id = '" . $user_id . "' LIMIT 1";
|
||||
error_log($sql);
|
||||
$resOrgUser = $db->query($sql);
|
||||
if ($dbCore->num_rows($resOrgUser)) {
|
||||
$orgUserData = $dbCore->fetch_object($resOrgUser);
|
||||
$organizerName = $orgUserData->name;
|
||||
$organizerEmail = $orgUserData->email;
|
||||
}
|
||||
} elseif ($organizerCalendar[0]->calendar_name) {
|
||||
$organizerName = $organizerCalendar[0]->calendar_name;
|
||||
$organizerEmail = $organizerCalendar[0]->calendar_email ?: '';
|
||||
@@ -1401,8 +1445,15 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
$attendeeEmail = '';
|
||||
|
||||
if ($attendeeCalendar[0]->user_id) {
|
||||
$attendeeName = $attendeeCalendar[0]->user->name;
|
||||
$attendeeEmail = $attendeeCalendar[0]->user->email;
|
||||
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||
INNER JOIN `core_user` ON `cal_calendars`.`user_id`=`core_user`.`id` WHERE `cal_calendars`.id = '" . $attendeeCalendarId . "' LIMIT 1";
|
||||
error_log('Debug attendee '.$sql);
|
||||
$resAttUser = $db->query($sql);
|
||||
if ($dbCore->num_rows($resAttUser)) {
|
||||
$attUserData = $dbCore->fetch_object($resAttUser);
|
||||
$attendeeName = $attUserData->name;
|
||||
$attendeeEmail = $attUserData->email;
|
||||
}
|
||||
} elseif ($attendeeCalendar[0]->calendar_name) {
|
||||
$attendeeName = $attendeeCalendar[0]->calendar_name;
|
||||
$attendeeEmail = $attendeeCalendar[0]->calendar_email ?: '';
|
||||
@@ -1415,26 +1466,54 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
||||
'response' => 'none',
|
||||
'time' => '0001-01-01 00:00:00.000000'
|
||||
);
|
||||
$attendeesForEvent = array();
|
||||
$attendeesForEvent['required'] = array();
|
||||
|
||||
$attendeesForEvent['required'][] = array(
|
||||
'name' => $organizerName,
|
||||
'email' => $organizerEmail,
|
||||
'response' => 'none',
|
||||
'time' => '0001-01-01 00:00:00.000000'
|
||||
);
|
||||
|
||||
foreach ($attendees as $otherAttendee) {
|
||||
if ($otherAttendee != $attendeeValue) {
|
||||
if (is_numeric($otherAttendee) && !filter_var($otherAttendee, FILTER_VALIDATE_EMAIL)) {
|
||||
$resCheckOtherMs = $db->select("cal_calendars", "ms_user_id", "id = '" . intval($otherAttendee) . "' LIMIT 1");
|
||||
$otherHasMicrosoftId = false;
|
||||
if ($db->num_rows($resCheckOtherMs)) {
|
||||
$otherMsData = $db->fetch_object($resCheckOtherMs);
|
||||
$otherHasMicrosoftId = !empty($otherMsData->ms_user_id);
|
||||
}
|
||||
|
||||
$otherCalendar = self::search(array("go_calendar_id" => intval($otherAttendee)));
|
||||
if ($otherCalendar && count($otherCalendar) > 0) {
|
||||
$otherName = '';
|
||||
$otherEmail = '';
|
||||
|
||||
if ($otherCalendar[0]->user_id) {
|
||||
$otherName = $otherCalendar[0]->user->name;
|
||||
$otherEmail = $otherCalendar[0]->user->email;
|
||||
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||
INNER JOIN `core_user` ON `cal_calendars`.`user_id`=`core_user`.`id`
|
||||
WHERE `cal_calendars`.id = '" . intval($otherAttendee) . "' LIMIT 1";
|
||||
$resOtherUser = $db->query($sql);
|
||||
if ($dbCore->num_rows($resOtherUser)) {
|
||||
$otherUserData = $dbCore->fetch_object($resOtherUser);
|
||||
$otherName = $otherUserData->name;
|
||||
$otherEmail = $otherUserData->email;
|
||||
}
|
||||
} elseif ($otherCalendar[0]->calendar_name) {
|
||||
$otherName = $otherCalendar[0]->calendar_name;
|
||||
$otherEmail = $otherCalendar[0]->calendar_email ?: '';
|
||||
}
|
||||
$attendeesForEvent['required'][] = array(
|
||||
'name' => $otherName,
|
||||
'email' => $otherEmail,
|
||||
'response' => 'none',
|
||||
'time' => '0001-01-01 00:00:00.000000'
|
||||
);
|
||||
|
||||
if ($otherName && $otherEmail) {
|
||||
$attendeesForEvent['required'][] = array(
|
||||
'name' => $otherName,
|
||||
'email' => $otherEmail,
|
||||
'response' => 'none',
|
||||
'time' => '0001-01-01 00:00:00.000000'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$attendeesForEvent['required'][] = array(
|
||||
|
||||
Reference in New Issue
Block a user