Files
itflow/admin/database_updates/2.8.6.php
johnnyq bbb2456f0b Projects modernization: projects list with Active/Mine/Overdue/Due soon/Stalled/Over budget/Ready to close/Completed/Archived/All views, ticket and task progress bars, time logged against budget with unbilled hours, due badges, manager changed in place, manager/client/created filters, bulk set manager, set due date, complete, reopen, archive, restore and delete, CSV/PDF export; project page with header actions, attention banners, tickets/tasks/time/due stat cards, Tickets/Tasks/Activity tabs, scope, details and team with hours; project quick look; New/Edit Project with client contact, start date, budget hours and template that can assign its tickets to the manager; Add tickets by picking or by number; add a project template's tickets to an existing project; template ticket subjects fill in [Client], [Project], [Month], [Quarter] and [Year]; project templates admin rework with ordered ticket templates, multi-add, duplicate, archive and restore; projects on the ticket page, client overview, dashboard, calendar, global search and client actions menu; New Ticket offers internal projects; tickets only join a project of their own client or an internal one; completing a project is checked on the server and completed projects can be reopened; deleting a project keeps its tickets; deleting a client deletes its projects; bulk ticket creation limits project choices to matching clients; project template reordering limited to admins; new manager notifications; new functions/project.php; removed project_link_closed_ticket.php; DB 2.8.6 adds project_start, project_budget_hours, project_contact_id and a ticket_project_id index, and cleans up orphaned projects, ticket project links and template links
2026-10-15 16:35:00 -04:00

28 lines
1.9 KiB
PHP

<?php
/*
* ITFlow - Database update to version 2.8.6 (from 2.8.5)
* Included by admin/database_updates.php - do not access directly
*/
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
// Projects: when the work starts, the hours sold for it, and who signs it off at the client
mysqli_query($mysqli, "ALTER TABLE `projects` ADD COLUMN `project_start` date DEFAULT NULL AFTER `project_description`");
mysqli_query($mysqli, "ALTER TABLE `projects` ADD COLUMN `project_budget_hours` decimal(8,2) DEFAULT NULL AFTER `project_due`");
mysqli_query($mysqli, "ALTER TABLE `projects` ADD COLUMN `project_contact_id` int(11) NOT NULL DEFAULT 0 AFTER `project_manager`");
// A project's tickets are looked up by project on every projects page
mysqli_query($mysqli, "ALTER TABLE `tickets` ADD INDEX `ticket_project_id` (`ticket_project_id`)");
// Deleting a client left its projects behind, and deleting a project left
// its tickets pointing at it - clear out both
mysqli_query($mysqli, "DELETE `projects` FROM `projects` LEFT JOIN `clients` ON `client_id` = `project_client_id` WHERE `project_client_id` > 0 AND `client_id` IS NULL");
mysqli_query($mysqli, "UPDATE `tickets` LEFT JOIN `projects` ON `project_id` = `ticket_project_id` SET `ticket_project_id` = 0 WHERE `ticket_project_id` > 0 AND `project_id` IS NULL");
// A project template's ticket templates whose template is gone
mysqli_query($mysqli, "DELETE `project_template_ticket_templates` FROM `project_template_ticket_templates`
LEFT JOIN `project_templates` ON `project_templates`.`project_template_id` = `project_template_ticket_templates`.`project_template_id`
LEFT JOIN `ticket_templates` ON `ticket_templates`.`ticket_template_id` = `project_template_ticket_templates`.`ticket_template_id`
WHERE `project_templates`.`project_template_id` IS NULL OR `ticket_templates`.`ticket_template_id` IS NULL");