Zeiterfassung Update
* Nicht freigegebene Abwesenheiten werden nun in der Kalenderübersicht strichliert dargestellt * Anpassungen in den Genehmigungsemails
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)) {
|
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
|
$sqlLinked = "SELECT ce.id, ce.calendar_id, cc.ms_user_id microsoft_id
|
||||||
FROM cal_events ce
|
FROM cal_events ce
|
||||||
LEFT JOIN cal_calendars cc ON ce.calendar_id = cc.id
|
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']))
|
if (isset($updateArray['start_time']))
|
||||||
$linkedUpdateArray['start_time'] = $updateArray['start_time'];
|
$linkedUpdateArray['start_time'] = $updateArray['start_time'];
|
||||||
if (isset($updateArray['end_time']))
|
if (isset($updateArray['end_time']))
|
||||||
$linkedUpdateArray['end_time'] = $updateArray['end_time'];
|
$linkedUpdateArray['end_time'] = $end;
|
||||||
if (isset($updateArray['name']))
|
if (isset($updateArray['name']))
|
||||||
$linkedUpdateArray['name'] = $updateArray['name'];
|
$linkedUpdateArray['name'] = $updateArray['name'];
|
||||||
if (isset($updateArray['description']))
|
if (isset($updateArray['description']))
|
||||||
@@ -931,8 +932,15 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
|||||||
$orgName = '';
|
$orgName = '';
|
||||||
$orgEmail = '';
|
$orgEmail = '';
|
||||||
if ($organizerCalendar[0]->user_id) {
|
if ($organizerCalendar[0]->user_id) {
|
||||||
$orgName = $organizerCalendar[0]->user->name;
|
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||||
$orgEmail = $organizerCalendar[0]->user->email;
|
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) {
|
} elseif ($organizerCalendar[0]->calendar_name) {
|
||||||
$orgName = $organizerCalendar[0]->calendar_name;
|
$orgName = $organizerCalendar[0]->calendar_name;
|
||||||
$orgEmail = $organizerCalendar[0]->calendar_email ?: '';
|
$orgEmail = $organizerCalendar[0]->calendar_email ?: '';
|
||||||
@@ -953,18 +961,29 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
|||||||
$attName = '';
|
$attName = '';
|
||||||
$attEmail = '';
|
$attEmail = '';
|
||||||
if ($attCal[0]->user_id) {
|
if ($attCal[0]->user_id) {
|
||||||
$attName = $attCal[0]->user->name;
|
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||||
$attEmail = $attCal[0]->user->email;
|
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) {
|
} elseif ($attCal[0]->calendar_name) {
|
||||||
$attName = $attCal[0]->calendar_name;
|
$attName = $attCal[0]->calendar_name;
|
||||||
$attEmail = $attCal[0]->calendar_email ?: '';
|
$attEmail = $attCal[0]->calendar_email ?: '';
|
||||||
}
|
}
|
||||||
$attendeesForLinkedEvent['required'][] = array(
|
|
||||||
'name' => $attName,
|
if ($attName && $attEmail) {
|
||||||
'email' => $attEmail,
|
$attendeesForLinkedEvent['required'][] = array(
|
||||||
'response' => 'none',
|
'name' => $attName,
|
||||||
'time' => '0001-01-01 00:00:00.000000'
|
'email' => $attEmail,
|
||||||
);
|
'response' => 'none',
|
||||||
|
'time' => '0001-01-01 00:00:00.000000'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} elseif (!is_numeric($att)) {
|
} elseif (!is_numeric($att)) {
|
||||||
$attendeesForLinkedEvent['required'][] = array(
|
$attendeesForLinkedEvent['required'][] = array(
|
||||||
@@ -1018,19 +1037,18 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
|||||||
$newAttendeeCalId = intval($emailCalData->go_calendar_id);
|
$newAttendeeCalId = intval($emailCalData->go_calendar_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error_log("=== NEUER TEILNEHMER CHECK ===");
|
// error_log("=== NEUER TEILNEHMER CHECK ===");
|
||||||
error_log("newAttendee Wert: " . print_r($newAttendee, true));
|
// error_log("newAttendee Wert: " . print_r($newAttendee, true));
|
||||||
error_log("newAttendeeCalId: " . ($newAttendeeCalId ?: 'NULL'));
|
// error_log("newAttendeeCalId: " . ($newAttendeeCalId ?: 'NULL'));
|
||||||
error_log("currentAttendeeCalendarIds: " . print_r($currentAttendeeCalendarIds, true));
|
// error_log("currentAttendeeCalendarIds: " . print_r($currentAttendeeCalendarIds, true));
|
||||||
error_log("Ist in currentAttendeeCalendarIds? " . (in_array($newAttendeeCalId, $currentAttendeeCalendarIds) ? "JA" : "NEIN"));
|
// error_log("Ist in currentAttendeeCalendarIds? " . (in_array($newAttendeeCalId, $currentAttendeeCalendarIds) ? "JA" : "NEIN"));
|
||||||
// DEBUG ENDE
|
//
|
||||||
|
|
||||||
|
|
||||||
if ($newAttendeeCalId) {
|
if ($newAttendeeCalId) {
|
||||||
if (!in_array($newAttendeeCalId, $currentAttendeeCalendarIds)) {
|
if (!in_array($newAttendeeCalId, $currentAttendeeCalendarIds)) {
|
||||||
$newAttCal = self::search(array("go_calendar_id" => $newAttendeeCalId));
|
$newAttCal = self::search(array("go_calendar_id" => $newAttendeeCalId));
|
||||||
if (count($newAttCal) > 0) {
|
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");
|
$resCheckNewAttMs = $db->select("cal_calendars", "ms_user_id", "id = '" . $newAttendeeCalId . "' LIMIT 1");
|
||||||
$hasMsId = false;
|
$hasMsId = false;
|
||||||
if ($db->num_rows($resCheckNewAttMs)) {
|
if ($db->num_rows($resCheckNewAttMs)) {
|
||||||
@@ -1045,8 +1063,15 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
|||||||
$organizerEmail = '';
|
$organizerEmail = '';
|
||||||
if ($organizerCalendar && count($organizerCalendar) > 0) {
|
if ($organizerCalendar && count($organizerCalendar) > 0) {
|
||||||
if ($organizerCalendar[0]->user_id) {
|
if ($organizerCalendar[0]->user_id) {
|
||||||
$organizerName = $organizerCalendar[0]->user->name;
|
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||||
$organizerEmail = $organizerCalendar[0]->user->email;
|
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) {
|
} elseif ($organizerCalendar[0]->calendar_name) {
|
||||||
$organizerName = $organizerCalendar[0]->calendar_name;
|
$organizerName = $organizerCalendar[0]->calendar_name;
|
||||||
$organizerEmail = $organizerCalendar[0]->calendar_email ?: '';
|
$organizerEmail = $organizerCalendar[0]->calendar_email ?: '';
|
||||||
@@ -1076,18 +1101,28 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
|||||||
$otherName = '';
|
$otherName = '';
|
||||||
$otherEmail = '';
|
$otherEmail = '';
|
||||||
if ($otherCal[0]->user_id) {
|
if ($otherCal[0]->user_id) {
|
||||||
$otherName = $otherCal[0]->user->name;
|
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||||
$otherEmail = $otherCal[0]->user->email;
|
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) {
|
} elseif ($otherCal[0]->calendar_name) {
|
||||||
$otherName = $otherCal[0]->calendar_name;
|
$otherName = $otherCal[0]->calendar_name;
|
||||||
$otherEmail = $otherCal[0]->calendar_email ?: '';
|
$otherEmail = $otherCal[0]->calendar_email ?: '';
|
||||||
}
|
}
|
||||||
$newAttendeesForEvent['required'][] = array(
|
|
||||||
'name' => $otherName,
|
if ($otherName && $otherEmail) {
|
||||||
'email' => $otherEmail,
|
$newAttendeesForEvent['required'][] = array(
|
||||||
'response' => 'none',
|
'name' => $otherName,
|
||||||
'time' => '0001-01-01 00:00:00.000000'
|
'email' => $otherEmail,
|
||||||
);
|
'response' => 'none',
|
||||||
|
'time' => '0001-01-01 00:00:00.000000'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$newAttendeesForEvent['required'][] = array(
|
$newAttendeesForEvent['required'][] = array(
|
||||||
@@ -1103,7 +1138,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
|||||||
$newAttendeesJson = json_encode($newAttendeesForEvent);
|
$newAttendeesJson = json_encode($newAttendeesForEvent);
|
||||||
$newAttendeeDataarray = array(
|
$newAttendeeDataarray = array(
|
||||||
"start_time" => $updateArray['start_time'],
|
"start_time" => $updateArray['start_time'],
|
||||||
'end_time' => $updateArray['end_time'],
|
'end_time' => $end,
|
||||||
'name' => $updateArray['name'],
|
'name' => $updateArray['name'],
|
||||||
'description' => $updateArray['description'] ?? '',
|
'description' => $updateArray['description'] ?? '',
|
||||||
'location' => $updateArray['location'] ?? '',
|
'location' => $updateArray['location'] ?? '',
|
||||||
@@ -1364,14 +1399,23 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
|||||||
$db->insert("TheTool_CalendarQueue", $data);
|
$db->insert("TheTool_CalendarQueue", $data);
|
||||||
}
|
}
|
||||||
if ($attendees) {
|
if ($attendees) {
|
||||||
|
$dbCore =self::dbKalender();;
|
||||||
|
|
||||||
$organizerCalendar = self::search(array("go_calendar_id" => $user_id));
|
$organizerCalendar = self::search(array("go_calendar_id" => $user_id));
|
||||||
$organizerName = '';
|
$organizerName = '';
|
||||||
$organizerEmail = '';
|
$organizerEmail = '';
|
||||||
|
|
||||||
if ($organizerCalendar && count($organizerCalendar) > 0) {
|
if ($organizerCalendar && count($organizerCalendar) > 0) {
|
||||||
if ($organizerCalendar[0]->user_id) {
|
if ($organizerCalendar[0]->user_id) {
|
||||||
$organizerName = $organizerCalendar[0]->user->name;
|
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||||
$organizerEmail = $organizerCalendar[0]->user->email;
|
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) {
|
} elseif ($organizerCalendar[0]->calendar_name) {
|
||||||
$organizerName = $organizerCalendar[0]->calendar_name;
|
$organizerName = $organizerCalendar[0]->calendar_name;
|
||||||
$organizerEmail = $organizerCalendar[0]->calendar_email ?: '';
|
$organizerEmail = $organizerCalendar[0]->calendar_email ?: '';
|
||||||
@@ -1401,8 +1445,15 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
|||||||
$attendeeEmail = '';
|
$attendeeEmail = '';
|
||||||
|
|
||||||
if ($attendeeCalendar[0]->user_id) {
|
if ($attendeeCalendar[0]->user_id) {
|
||||||
$attendeeName = $attendeeCalendar[0]->user->name;
|
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||||
$attendeeEmail = $attendeeCalendar[0]->user->email;
|
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) {
|
} elseif ($attendeeCalendar[0]->calendar_name) {
|
||||||
$attendeeName = $attendeeCalendar[0]->calendar_name;
|
$attendeeName = $attendeeCalendar[0]->calendar_name;
|
||||||
$attendeeEmail = $attendeeCalendar[0]->calendar_email ?: '';
|
$attendeeEmail = $attendeeCalendar[0]->calendar_email ?: '';
|
||||||
@@ -1415,26 +1466,54 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
|
|||||||
'response' => 'none',
|
'response' => 'none',
|
||||||
'time' => '0001-01-01 00:00:00.000000'
|
'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) {
|
foreach ($attendees as $otherAttendee) {
|
||||||
if ($otherAttendee != $attendeeValue) {
|
if ($otherAttendee != $attendeeValue) {
|
||||||
if (is_numeric($otherAttendee) && !filter_var($otherAttendee, FILTER_VALIDATE_EMAIL)) {
|
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)));
|
$otherCalendar = self::search(array("go_calendar_id" => intval($otherAttendee)));
|
||||||
if ($otherCalendar && count($otherCalendar) > 0) {
|
if ($otherCalendar && count($otherCalendar) > 0) {
|
||||||
$otherName = '';
|
$otherName = '';
|
||||||
$otherEmail = '';
|
$otherEmail = '';
|
||||||
|
|
||||||
if ($otherCalendar[0]->user_id) {
|
if ($otherCalendar[0]->user_id) {
|
||||||
$otherName = $otherCalendar[0]->user->name;
|
$sql = "SELECT `cal_calendars`.`id`, `name`,`email` FROM `cal_calendars`
|
||||||
$otherEmail = $otherCalendar[0]->user->email;
|
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) {
|
} elseif ($otherCalendar[0]->calendar_name) {
|
||||||
$otherName = $otherCalendar[0]->calendar_name;
|
$otherName = $otherCalendar[0]->calendar_name;
|
||||||
$otherEmail = $otherCalendar[0]->calendar_email ?: '';
|
$otherEmail = $otherCalendar[0]->calendar_email ?: '';
|
||||||
}
|
}
|
||||||
$attendeesForEvent['required'][] = array(
|
|
||||||
'name' => $otherName,
|
if ($otherName && $otherEmail) {
|
||||||
'email' => $otherEmail,
|
$attendeesForEvent['required'][] = array(
|
||||||
'response' => 'none',
|
'name' => $otherName,
|
||||||
'time' => '0001-01-01 00:00:00.000000'
|
'email' => $otherEmail,
|
||||||
);
|
'response' => 'none',
|
||||||
|
'time' => '0001-01-01 00:00:00.000000'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$attendeesForEvent['required'][] = array(
|
$attendeesForEvent['required'][] = array(
|
||||||
|
|||||||
Reference in New Issue
Block a user