Files
itflow/admin/database_updates/2.8.8.php
johnnyq 3ec52974db Calendar modernization: calendar page rebuilt to load only the dates on screen with show or hide toggles for each calendar and for built-in sources (scheduled tickets, project start and due dates, service reviews, recurring tickets, renewals, invoices due), a filter for one agent, quick looks on click, drag to reschedule tickets and events that do not repeat, and a To schedule panel for dragging open unscheduled tickets onto the calendar; events get a shared add/edit form with repeats every N days/weeks/months/years with an optional end date and single skipped occurrences, a client site, location or meeting link, agents, client contacts and guest emails as attendees, iCalendar invitations with updates and cancellations sent to invited attendees, an event quick look with map and join links, .ics download and resend; each agent gets a personal subscription link for their schedule (their own or the whole team, busy only option, respects role and client access, stops when the account is disabled) with setup help for Google, Outlook, Apple, Nextcloud and Thunderbird; shared calendar feeds and invites now publish timed events with TZID and VTIMEZONE so repeating events keep their time across DST, with INTERVAL, UNTIL and EXDATE support; managing calendars is limited to admins; ticket schedule logic moved into functions/ticket.php and shared with the calendar, the schedule dialog shows the assigned agent's day, and ticket visit calendar files are rebuilt without zapcal as one-hour published events; mail queue sends invitations and cancellations as a text/calendar part and other calendar files as invite.ics; dashboard schedule shows only events the agent is on or added, client overview Coming up and client sidebar count use upcoming events, sites and contacts get New event shortcuts, demo data uses repeating events and attendees; database update 2.8.8 adds event repeat interval, until, skip, sequence and created by, attendee user and invited at, user_calendar_feeds, and widens email_queue.email_cal_str to text
2026-10-15 19:17:17 -04:00

52 lines
3.4 KiB
PHP

<?php
/*
* ITFlow - Database update to version 2.8.8 (from 2.8.7)
* Included by admin/database_updates.php - do not access directly
*/
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
// Events: a repeat can now be every N days/weeks/months/years and stop on a date,
// and single occurrences can be skipped (the dates they would have fallen on).
// The sequence goes up each time an invited event changes, so the attendees'
// calendars take the update rather than ignoring it. Who added it puts it on
// their own schedule.
mysqli_query($mysqli, "ALTER TABLE `calendar_events` ADD COLUMN `event_repeat_interval` int(11) NOT NULL DEFAULT 1 AFTER `event_repeat`");
mysqli_query($mysqli, "ALTER TABLE `calendar_events` ADD COLUMN `event_repeat_until` date DEFAULT NULL AFTER `event_repeat_interval`");
mysqli_query($mysqli, "ALTER TABLE `calendar_events` ADD COLUMN `event_repeat_skip` text DEFAULT NULL AFTER `event_repeat_until`");
mysqli_query($mysqli, "ALTER TABLE `calendar_events` ADD COLUMN `event_sequence` int(11) NOT NULL DEFAULT 0 AFTER `event_repeat_skip`");
mysqli_query($mysqli, "ALTER TABLE `calendar_events` ADD COLUMN `event_created_by` int(11) NOT NULL DEFAULT 0 AFTER `event_archived_at`");
// The calendar asks for a date range at a time now, rather than everything at once
mysqli_query($mysqli, "ALTER TABLE `calendar_events` ADD INDEX `event_start` (`event_start`)");
// Agents on an event as well as client contacts, and when each was last sent the invitation
mysqli_query($mysqli, "ALTER TABLE `calendar_event_attendees` ADD COLUMN `attendee_user_id` int(11) NOT NULL DEFAULT 0 AFTER `attendee_contact_id`");
mysqli_query($mysqli, "ALTER TABLE `calendar_event_attendees` ADD COLUMN `attendee_invited_at` datetime DEFAULT NULL AFTER `attendee_invitation_status`");
mysqli_query($mysqli, "ALTER TABLE `calendar_event_attendees` ADD INDEX `attendee_user_id` (`attendee_user_id`)");
// Each agent's own schedule as a subscription link - their scheduled tickets,
// the events they are on and the projects they manage - for the phone or
// Nextcloud calendar. The key is the only thing the link carries, so like the
// calendar feed keys it is case-sensitive.
mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS `user_calendar_feeds` (
`feed_user_id` int(11) NOT NULL,
`feed_key` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`feed_scope` varchar(20) NOT NULL DEFAULT 'mine',
`feed_tickets` tinyint(1) NOT NULL DEFAULT 1,
`feed_events` tinyint(1) NOT NULL DEFAULT 1,
`feed_projects` tinyint(1) NOT NULL DEFAULT 1,
`feed_busy_only` tinyint(1) NOT NULL DEFAULT 0,
`feed_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`feed_accessed_at` datetime DEFAULT NULL,
PRIMARY KEY (`feed_user_id`),
UNIQUE KEY `feed_key` (`feed_key`),
CONSTRAINT `user_calendar_feeds_ibfk_1` FOREIGN KEY (`feed_user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci");
// A calendar invitation - with the timezone it is in, so a repeating meeting
// keeps its time across a clock change - is longer than the 1024 characters
// the mail queue kept for it
mysqli_query($mysqli, "ALTER TABLE `email_queue` MODIFY `email_cal_str` text DEFAULT NULL");