diff --git a/api.php b/api.php index e5060d8..5dc1e21 100644 --- a/api.php +++ b/api.php @@ -2254,6 +2254,7 @@ switch ($action) { 'description' => $input['description'] ?? '', 'status' => $input['status'] ?? ($type === 'task' ? 'avoin' : 'ehdotettu'), 'priority' => $input['priority'] ?? 'normaali', + 'category' => $input['category'] ?? '', 'assigned_to' => $input['assigned_to'] ?? '', 'created_by' => $isNew ? currentUser() : ($input['created_by'] ?? currentUser()), 'deadline' => $input['deadline'] ?? null, diff --git a/db.php b/db.php index 89b9032..4f65fbb 100644 --- a/db.php +++ b/db.php @@ -454,6 +454,7 @@ function initDatabase(): void { description TEXT, status VARCHAR(30) NOT NULL DEFAULT 'avoin', priority VARCHAR(20) DEFAULT 'normaali', + category VARCHAR(30) DEFAULT '', assigned_to VARCHAR(100) DEFAULT '', created_by VARCHAR(100) NOT NULL DEFAULT '', deadline DATE DEFAULT NULL, @@ -518,6 +519,7 @@ function initDatabase(): void { "ALTER TABLE mailboxes ADD COLUMN auto_reply_enabled BOOLEAN DEFAULT FALSE AFTER aktiivinen", "ALTER TABLE mailboxes ADD COLUMN auto_reply_body TEXT AFTER auto_reply_enabled", "ALTER TABLE companies ADD COLUMN allowed_ips TEXT DEFAULT '' AFTER enabled_modules", + "ALTER TABLE todos ADD COLUMN category VARCHAR(30) DEFAULT '' AFTER priority", ]; foreach ($alters as $sql) { try { $db->query($sql); } catch (\Throwable $e) { /* sarake on jo olemassa / jo ajettu */ } @@ -1524,13 +1526,13 @@ function dbLoadTodo(string $todoId): ?array { function dbSaveTodo(string $companyId, array $todo): void { _dbExecute(" - INSERT INTO todos (id, company_id, type, title, description, status, priority, assigned_to, created_by, deadline, luotu, muokattu, muokkaaja) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + INSERT INTO todos (id, company_id, type, title, description, status, priority, category, assigned_to, created_by, deadline, luotu, muokattu, muokkaaja) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE title = VALUES(title), description = VALUES(description), status = VALUES(status), priority = VALUES(priority), - assigned_to = VALUES(assigned_to), deadline = VALUES(deadline), - muokattu = VALUES(muokattu), muokkaaja = VALUES(muokkaaja) + category = VALUES(category), assigned_to = VALUES(assigned_to), + deadline = VALUES(deadline), muokattu = VALUES(muokattu), muokkaaja = VALUES(muokkaaja) ", [ $todo['id'], $companyId, $todo['type'] ?? 'task', @@ -1538,6 +1540,7 @@ function dbSaveTodo(string $companyId, array $todo): void { $todo['description'] ?? '', $todo['status'] ?? 'avoin', $todo['priority'] ?? 'normaali', + $todo['category'] ?? '', $todo['assigned_to'] ?? '', $todo['created_by'] ?? '', !empty($todo['deadline']) ? $todo['deadline'] : null, diff --git a/index.html b/index.html index 25ba2d2..616d20e 100644 --- a/index.html +++ b/index.html @@ -456,6 +456,14 @@ + @@ -468,6 +476,7 @@