Resolve merge conflicts in multiple files and clean up integration logic

This commit is contained in:
2026-09-09 16:22:59 +02:00
parent 8f191f5123
commit 4cb94d3897
6 changed files with 5 additions and 100 deletions
+4 -57
View File
@@ -38,13 +38,8 @@ try {
$title = trim($data['title'] ?? '');
$priority = in_array($data['priority'] ?? '', ['P1', 'P2', 'P3']) ? $data['priority'] : 'P2';
$timeBlockStart = !empty($data['time_block_start']) ? trim($data['time_block_start']) : null;
<<<<<<< HEAD
$timeBlockEnd = !empty($data['time_block_end']) ? trim($data['time_block_end']) : null;
$durationMinutes = (int)($data['duration_minutes'] ?? 0);
=======
$durationMinutes = (int)($data['duration_minutes'] ?? 30);
if ($durationMinutes <= 0) $durationMinutes = 30;
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
$date = !empty($data['date']) ? trim($data['date']) : $today;
$syncOutlook = !empty($data['sync_to_outlook']);
@@ -53,7 +48,6 @@ try {
exit;
}
<<<<<<< HEAD
// Als zowel start- als eindtijd zijn opgegeven, bereken exact de minuten
if (!empty($timeBlockStart) && !empty($timeBlockEnd)) {
$t1 = strtotime("2000-01-01 {$timeBlockStart}");
@@ -77,9 +71,6 @@ try {
// negeer
}
}
=======
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
// Haal of maak daily plan op
$stmtPlan = $db->prepare("
INSERT INTO daily_plans (user_id, plan_date)
@@ -92,10 +83,6 @@ try {
$source = !empty($data['source']) ? substr(trim($data['source']), 0, 50) : 'FOCIZ';
$externalId = !empty($data['external_id']) ? substr(trim($data['external_id']), 0, 255) : null;
$externalUrl = !empty($data['external_url']) ? trim($data['external_url']) : null;
<<<<<<< HEAD
=======
$timeBlockEnd = null;
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
$outlookSyncError = null;
// Als synchronisatie naar Outlook gewenst is (of source is OUTLOOK) en nog geen extern ID heeft
@@ -110,10 +97,7 @@ try {
'description' => "Gepland via Fociz Dagplanning ({$priority})",
'date' => $date,
'start_time' => $timeBlockStart,
<<<<<<< HEAD
'end_time' => $timeBlockEnd,
=======
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
'duration_minutes' => $durationMinutes,
]);
@@ -122,30 +106,11 @@ try {
$externalId = $msResult['event_id'];
$externalUrl = $msResult['web_link'] ?? 'https://outlook.office.com';
$timeBlockStart = $msResult['start_time'] ?? $timeBlockStart;
<<<<<<< HEAD
$timeBlockEnd = $msResult['end_time'] ?? $timeBlockEnd;
=======
$timeBlockEnd = $msResult['end_time'] ?? null;
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
} else {
$outlookSyncError = $msResult['error'] ?? 'Kon afspraak niet aanmaken in Microsoft Outlook';
}
}
<<<<<<< HEAD
=======
// Bereken timeBlockEnd indien nog niet gezet maar wel starttijd bekend
if (!empty($timeBlockStart) && empty($timeBlockEnd)) {
try {
$dtEnd = new DateTime("{$date} {$timeBlockStart}:00", new DateTimeZone('Europe/Amsterdam'));
$dtEnd->modify("+{$durationMinutes} minutes");
$timeBlockEnd = $dtEnd->format('H:i');
} catch (Throwable $e) {
// negeer
}
}
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
$stmt = $db->prepare("
INSERT INTO tasks (user_id, daily_plan_id, title, priority, time_block_start, time_block_end, duration_minutes, status, source, external_id, external_url)
VALUES (?, ?, ?, ?, ?, ?, ?, 'TODO', ?, ?, ?)
@@ -162,13 +127,14 @@ try {
'time_block_start' => $timeBlockStart,
'time_block_end' => $timeBlockEnd,
'duration_minutes' => $durationMinutes,
<<<<<<< HEAD
'is_completed' => 0,
'status' => 'TODO',
'source' => $source,
'external_id' => $externalId,
'external_url' => $externalUrl
'external_url' => $externalUrl,
],
'outlook_synced' => ($source === 'OUTLOOK' && !empty($externalId)),
'outlook_error' => $outlookSyncError
'outlook_error' => $outlookSyncError,
]);
exit;
}
@@ -248,16 +214,6 @@ try {
'time_block_start' => $timeBlockStart,
'time_block_end' => $timeBlockEnd,
'duration_minutes' => $durationMinutes
=======
'is_completed' => 0,
'status' => 'TODO',
'source' => $source,
'external_id' => $externalId,
'external_url' => $externalUrl,
],
'outlook_synced' => ($source === 'OUTLOOK' && !empty($externalId)),
'outlook_error' => $outlookSyncError,
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
]);
exit;
}
@@ -300,10 +256,7 @@ try {
$planDate = $task['plan_date'] ?: $today;
$startTime = !empty($task['time_block_start']) ? $task['time_block_start'] : ($data['time_block_start'] ?? '09:00');
<<<<<<< HEAD
$endTime = !empty($task['time_block_end']) ? $task['time_block_end'] : null;
=======
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
$duration = (int)($task['duration_minutes'] ?: 30);
$msResult = microsoft_create_event($user['id'], [
@@ -311,10 +264,7 @@ try {
'description' => "Gepland via Fociz Dagplanning (" . $task['priority'] . ")",
'date' => $planDate,
'start_time' => $startTime,
<<<<<<< HEAD
'end_time' => $endTime,
=======
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
'duration_minutes' => $duration,
]);
@@ -394,7 +344,6 @@ try {
exit;
}
<<<<<<< HEAD
// 6. Realtime Outlook synchronisatie & controle op gewijzigde/gewiste items
if ($action === 'check_outlook_sync') {
$rawInput = file_get_contents('php://input');
@@ -503,8 +452,6 @@ try {
exit;
}
=======
>>>>>>> dd738e670b78819c11e329da93db1b472808f195
echo json_encode(['error' => 'Onbekende actie']);
} catch (Exception $e) {
http_response_code(500);