User Tools

Site Tools


wiki:manara:bugs:maintenance_overhaul

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:manara:bugs:maintenance_overhaul [2026/07/29 10:13] – Auto-synced from MantisBT mantisbotwiki:manara:bugs:maintenance_overhaul [2026/08/03 07:23] (current) – Removed: not a current major-bug page mantisbot
Line 1: Line 1:
-====== maintenance overhaul (Resolved) ====== 
- 
-**Reported by:** Khaled Tarabay on 2026-07-29T07:54:33+01:00\\ 
-**Assigned to:** Claude\\ 
-**Resolved by:** Claude on 2026-07-29T09:33:47+01:00\\ 
-**Priority:** normal\\ 
-**Severity:** minor\\ 
-**Reproducibility:** always\\ 
-**Category:** General 
- 
-**Description:** 
-the maintenance tab has "add maintenance job" we don't want that and you should remove it, what we want is basically that when you create a task you should get an option to choose if it is a maintenance or an installation based on this it creates than entry automatically in the installation tab if installation is chosen and maintenance if maintenance is chosen, and so the task is created it must create the maintenance entry and when closed out it creates the invoice, and there is no need for the maintenance entry to create anything  
- 
-**Resolution:** 
-FIXED — maintenance/installation are now created automatically from a task, and the manual "Add Maintenance Job" entry point is gone. 
- 
-WHAT: A task now carries a required Job Type (Maintenance / Installation) chosen at creation. Creating the task auto-creates the matching field-ops entry (a maintenance_jobs row or an installations row, linked via task_id) — no more manual "+ Add Maintenance Job". Closing the task out (the completion flow) is what raises the invoice; the maintenance/installation entry itself no longer auto-creates a task or an invoice (that duplicate path is removed). 
- 
-WHERE / FIX: 
-- Migration 069: tasks.job_type ENUM('maintenance','installation') NOT NULL DEFAULT 'maintenance', backfilled to 'installation' for tasks whose issue is the system 'new_installation'. (schema.sql + run-migrations.php + 069_task_job_type.sql.) 
-- Task.php: job_type fillable + JOB_TYPES const. TaskController: job_type required on create (preserved on edit); store() calls createLinkedFieldJob() (creates the unpaid maintenance/installation with task_id); close-out routes to ensureMaintenanceForTask()/ensureInstallationForTask() by job_type, stamps resolved_at, and links the invoice to whichever field job exists. 
-- MaintenanceController: removed create()/store()/autoLinkTaskAndInvoice()/autoCreateTask()/resolveMaintenanceProjectId() and the auto-link call in update(). InstallationController: removed create()/store() (kept autoInvoiceIfPaid on update). web.php: removed GET /maintenance/create, POST /maintenance, GET /installations/create, POST /installations. maintenance/index.php: dropped the "+ Add Maintenance Job" action. dashboard/index.php: dropped the "New Maintenance" quick-action. tasks/form.php: Job Type select (read-only on edit). tasks/show.php: linked-job "View" link. 
-- MaintenanceStatus::defaultId() + Maintenance::findIdForTask() added. 
- 
-VERIFIED LIVE (14/14) against the local DB: task->maintenance auto-create, task->installation auto-create, invalid job_type rejected, close-out creates the invoice + links to the maintenance job + stamps resolved_at + moves the task to a terminal status with no stray installation, and the removed create routes 404. PHPUnit green. 
- 
-Prod: run /run-migrations.php for migration 069. 
- 
-===== Activity / Notes ===== 
- 
-  * **2026-07-29T09:33:44+01:00 - Claude:** FIXED — maintenance/installation are now created automatically from a task, and the manual "Add Maintenance Job" entry point is gone. 
- 
-WHAT: A task now carries a required Job Type (Maintenance / Installation) chosen at creation. Creating the task auto-creates the matching field-ops entry (a maintenance_jobs row or an installations row, linked via task_id) — no more manual "+ Add Maintenance Job". Closing the task out (the completion flow) is what raises the invoice; the maintenance/installation entry itself no longer auto-creates a task or an invoice (that duplicate path is removed). 
- 
-WHERE / FIX: 
-- Migration 069: tasks.job_type ENUM('maintenance','installation') NOT NULL DEFAULT 'maintenance', backfilled to 'installation' for tasks whose issue is the system 'new_installation'. (schema.sql + run-migrations.php + 069_task_job_type.sql.) 
-- Task.php: job_type fillable + JOB_TYPES const. TaskController: job_type required on create (preserved on edit); store() calls createLinkedFieldJob() (creates the unpaid maintenance/installation with task_id); close-out routes to ensureMaintenanceForTask()/ensureInstallationForTask() by job_type, stamps resolved_at, and links the invoice to whichever field job exists. 
-- MaintenanceController: removed create()/store()/autoLinkTaskAndInvoice()/autoCreateTask()/resolveMaintenanceProjectId() and the auto-link call in update(). InstallationController: removed create()/store() (kept autoInvoiceIfPaid on update). web.php: removed GET /maintenance/create, POST /maintenance, GET /installations/create, POST /installations. maintenance/index.php: dropped the "+ Add Maintenance Job" action. dashboard/index.php: dropped the "New Maintenance" quick-action. tasks/form.php: Job Type select (read-only on edit). tasks/show.php: linked-job "View" link. 
-- MaintenanceStatus::defaultId() + Maintenance::findIdForTask() added. 
- 
-VERIFIED LIVE (14/14) against the local DB: task->maintenance auto-create, task->installation auto-create, invalid job_type rejected, close-out creates the invoice + links to the maintenance job + stamps resolved_at + moves the task to a terminal status with no stray installation, and the removed create routes 404. PHPUnit green. 
- 
-Prod: run /run-migrations.php for migration 069. 
- 
-===== Full History ===== 
- 
-^ Date Modified ^ Username ^ Field ^ Change ^ 
-| 2026-07-29T07:54:33+01:00 | Khaled Tarabay | issue-new | New Issue | 
-| 2026-07-29T09:33:39+01:00 | Claude | Assigned To |  => Claudine | 
-| 2026-07-29T09:33:42+01:00 | Claude | tag-added | Tag Attached: done-by-claude | 
-| 2026-07-29T09:33:44+01:00 | Claude | note-added | Note Added: 0000097 | 
-| 2026-07-29T09:33:47+01:00 | Claude | Status | new => resolved | 
- 
----- 
-Synced automatically from MantisBT issue #138. 
  
wiki/manara/bugs/maintenance_overhaul.1785316427.txt.gz · Last modified: by mantisbot