====== #65 — Closing an installation-type Task via the real "Done" workflow never generates an Installations record (Resolved) ====== [[wiki:manara:bugs|← Back to Manara Bugs]] · [[https://mantis.matrixdn.net/view.php?id=65|View issue #65 in MantisBT]] ---- **Reported by:** Khaled Tarabay on 2026-07-27T10:30:16+01:00\\ **Assigned to:** Claude\\ **Resolved by:** Claude on 2026-07-27T10:37:02+01:00\\ **Severity:** major\\ **Priority:** high\\ **Reproducibility:** always\\ **Category:** General **Description:** /installations/create has no direct create route (it redirects into the generic Tasks list), so a working task-close-out trigger is the only way new Installation records can enter the system through the app itself. With that trigger not firing under either resolution type tested, front-line technicians using the app as designed have no working way to produce a new Installations record — the entire module may be effectively frozen at its one seeded example. (Separately, and consistent with this: Installation #11's own "Linked Invoice" field reads LG-INV-0000Cabling / line issue, a value that doesn't correspond to any real invoice in the tenant's LG-INV-00NN sequence — noted here only as context since this pre-existing record was observed, not created, during this retest; not independently re-verified as its own bug in this pass.) **Steps to Reproduce:** From /dashboard, click Create → New Task. Fill in customer (e.g. Jdoe), issue type "New installation," project, status "New," assignee, deadline, description. Save. Open the new task, click the "Done" button. On the Close Task form, select Problem = "Cabling / line issue" (or "Resolved / No fault"), enter an amount collected, method, description. Click "Close task." Confirm the task's Status is now "Done." Go to /installations — row count is unchanged; no new record for the task just closed **Resolution:** FIXED. What: /installations/create has no direct create route (it only works from a task, via ?task_id=), so the task close-out ("Done") trigger is the ONLY way a new Installations record can enter the system through the app. That trigger required at least one "outbound" equipment line (installed/replaced) before it would fire -- a task raised with issue "New installation" and closed with NO equipment lines recorded at all (just a Problem selection and a payment collected) never produced an Installations record, regardless of the task's own stated purpose. Confirmed with both resolution types tested per the ticket. Where: app/classes/Projects/TaskIssueType.php (new codeFor() method), app/controllers/TaskController.php (complete()'s installation trigger condition). Why: the trigger was keyed ONLY on "was equipment recorded in this close-out," with no awareness of the task's own reported issue (task_issue_types, code new_installation) -- a technician closing a genuine new-installation job without logging tracked equipment (forgot to, or the job didn't involve serialized gear) left the entire Installations module unable to grow past its seeded example through the front-door workflow. Fix: a task whose own issue_type_id resolves (via the new TaskIssueType::codeFor()) to the system code 'new_installation' now ALWAYS counts as an installation job at close-out and creates the Installations record, independent of whether any equipment lines were recorded in that same close-out. The existing "equipment was installed/replaced" trigger is untouched and still fires on its own for any OTHER task type where gear was actually swapped. Verified live against the local database: created a real task with issue_type_id resolving to new_installation, closed it via the real Close Task flow with a Problem selection, a payment collected, and deliberately NO equipment lines -- confirmed a new Installations row was created (linked to the task, correct customer/amount/payment-status) and the installations count increased by exactly one. As a regression check, a second task with an unrelated issue (no_internet) closed the same way (no equipment) correctly did NOT create an Installations row -- the trigger only fires for a genuine new-installation task, not every task. Full test suite: 29/29 passing. All test tasks/invoices/installations removed afterward (installations count confirmed back at its pre-test baseline). (Noted but not independently investigated in this pass, per the ticket's own framing: Installation #11's "Linked Invoice" field showing a value that doesn't match any real invoice in this tenant's numbering sequence -- flagged in the ticket only as pre-existing context observed during the retest, not verified as its own bug here.) ===== Activity / Notes ===== * **2026-07-27T10:36:58+01:00 - Claude:** FIXED. What: /installations/create has no direct create route (it only works from a task, via ?task_id=), so the task close-out ("Done") trigger is the ONLY way a new Installations record can enter the system through the app. That trigger required at least one "outbound" equipment line (installed/replaced) before it would fire -- a task raised with issue "New installation" and closed with NO equipment lines recorded at all (just a Problem selection and a payment collected) never produced an Installations record, regardless of the task's own stated purpose. Confirmed with both resolution types tested per the ticket. Where: app/classes/Projects/TaskIssueType.php (new codeFor() method), app/controllers/TaskController.php (complete()'s installation trigger condition). Why: the trigger was keyed ONLY on "was equipment recorded in this close-out," with no awareness of the task's own reported issue (task_issue_types, code new_installation) -- a technician closing a genuine new-installation job without logging tracked equipment (forgot to, or the job didn't involve serialized gear) left the entire Installations module unable to grow past its seeded example through the front-door workflow. Fix: a task whose own issue_type_id resolves (via the new TaskIssueType::codeFor()) to the system code 'new_installation' now ALWAYS counts as an installation job at close-out and creates the Installations record, independent of whether any equipment lines were recorded in that same close-out. The existing "equipment was installed/replaced" trigger is untouched and still fires on its own for any OTHER task type where gear was actually swapped. Verified live against the local database: created a real task with issue_type_id resolving to new_installation, closed it via the real Close Task flow with a Problem selection, a payment collected, and deliberately NO equipment lines -- confirmed a new Installations row was created (linked to the task, correct customer/amount/payment-status) and the installations count increased by exactly one. As a regression check, a second task with an unrelated issue (no_internet) closed the same way (no equipment) correctly did NOT create an Installations row -- the trigger only fires for a genuine new-installation task, not every task. Full test suite: 29/29 passing. All test tasks/invoices/installations removed afterward (installations count confirmed back at its pre-test baseline). (Noted but not independently investigated in this pass, per the ticket's own framing: Installation #11's "Linked Invoice" field showing a value that doesn't match any real invoice in this tenant's numbering sequence -- flagged in the ticket only as pre-existing context observed during the retest, not verified as its own bug here.) ===== Full History ===== ^ Date ^ User ^ Field ^ Change ^ | 2026-07-27T10:30:16+01:00 | Khaled Tarabay | issue-new | New Issue | | 2026-07-27T10:36:50+01:00 | Claude | Assigned To | => Claudine | | 2026-07-27T10:36:53+01:00 | Claude | tag-added | Tag Attached: done-by-claude | | 2026-07-27T10:36:58+01:00 | Claude | note-added | Note Added: 0000024 | | 2026-07-27T10:37:02+01:00 | Claude | Status | new => resolved | ---- Synced automatically from MantisBT issue #65.