User Tools

Site Tools


wiki:manara:bugs:weird_invoice_naming_instance

This is an old revision of the document!


Weird Invoice Naming Instance (Resolved)

Reported by: Khaled Tarabay on 2026-08-01T11:10:27+01:00
Assigned to: Claude
Resolved by: Claude on 2026-08-01T11:15:58+01:00
Priority: normal
Severity: minor
Reproducibility: have not tried
Category: General

Description: a created invoice from a task it seems has created a weird instance of naming in which the customer name was repeated twice, as you can see in the image below the evidence to investigate what is happening and here, and also when we tried to recreate it, it didn't happen again from both the task create installation and task create maitenance

Resolution: FIXED (root-caused from the screenshot).

WHAT: A task close-out invoice's number showed the customer's identity twice, e.g. “LG-INV-280 - AUDIT-TEST-customers-1784533171790 — AUDIT-TEST-customers-178453317” (the second copy truncated by the 80-char cap). It only happened for that one customer and couldn't be reproduced with normal data — that's the tell.

WHERE: app/controllers/TaskController.php — composeTitle() (the task title builder) and, downstream, JobInvoicer::paidInvoice()/issuedInvoice(), which set a task/job invoice's number to “<running number> - <task title>”.

WHY: composeTitle() builds the task title as “username — location — issue”, where location is the first non-empty of the customer's area → city → address line. The invoice number is then “LG-INV-NNN - ” + that title. The reported customer is an automated audit/test record whose AREA was set to the SAME string as its USERNAME (“AUDIT-TEST-customers-1784533171790”), so the title became “AUDIT… — AUDIT… — issue” and the invoice number repeated the name. A real customer, whose username and area differ, never shows this — which is exactly why it didn't reproduce.

FIX: composeTitle() now skips a location segment that just repeats the username (trimmed, case-insensitive), and keeps looking (area → city → address) for one that's a genuinely different place. So the degenerate case collapses to “username — issue” (name once), while a normal “jdoe — Zahle — No internet” is unchanged. This fixes both the task title itself AND the close-out invoice number derived from it.

VERIFIED: a reflection test against the real composeTitle() — the exact reported username==area input now yields the name ONCE (“AUDIT-TEST-customers-1784533171790 — No internet”); a distinct location is still kept; area==username but a distinct city falls through to the city; case-insensitive duplicates are caught (6/6). php -l clean. No schema change, no migration.

NOTE: existing invoices already created with the doubled number keep their stored number (numbers are immutable once assigned) — this only affects invoices created from a task close-out from now on.

Attachments

  • image.png

Activity / Notes

  • 2026-08-01T11:15:53+01:00 - Claude: FIXED (root-caused from the screenshot).

WHAT: A task close-out invoice's number showed the customer's identity twice, e.g. “LG-INV-280 - AUDIT-TEST-customers-1784533171790 — AUDIT-TEST-customers-178453317” (the second copy truncated by the 80-char cap). It only happened for that one customer and couldn't be reproduced with normal data — that's the tell.

WHERE: app/controllers/TaskController.php — composeTitle() (the task title builder) and, downstream, JobInvoicer::paidInvoice()/issuedInvoice(), which set a task/job invoice's number to “<running number> - <task title>”.

WHY: composeTitle() builds the task title as “username — location — issue”, where location is the first non-empty of the customer's area → city → address line. The invoice number is then “LG-INV-NNN - ” + that title. The reported customer is an automated audit/test record whose AREA was set to the SAME string as its USERNAME (“AUDIT-TEST-customers-1784533171790”), so the title became “AUDIT… — AUDIT… — issue” and the invoice number repeated the name. A real customer, whose username and area differ, never shows this — which is exactly why it didn't reproduce.

FIX: composeTitle() now skips a location segment that just repeats the username (trimmed, case-insensitive), and keeps looking (area → city → address) for one that's a genuinely different place. So the degenerate case collapses to “username — issue” (name once), while a normal “jdoe — Zahle — No internet” is unchanged. This fixes both the task title itself AND the close-out invoice number derived from it.

VERIFIED: a reflection test against the real composeTitle() — the exact reported username==area input now yields the name ONCE (“AUDIT-TEST-customers-1784533171790 — No internet”); a distinct location is still kept; area==username but a distinct city falls through to the city; case-insensitive duplicates are caught (6/6). php -l clean. No schema change, no migration.

NOTE: existing invoices already created with the doubled number keep their stored number (numbers are immutable once assigned) — this only affects invoices created from a task close-out from now on.

Full History

Date Modified Username Field Change
2026-08-01T11:10:27+01:00 Khaled Tarabay issue-new New Issue
2026-08-01T11:10:27+01:00 Khaled Tarabay file-added File Added: image.png
2026-08-01T11:15:45+01:00 Claude Assigned To ⇒ Claudine
2026-08-01T11:15:50+01:00 Claude tag-added Tag Attached: done-by-claude
2026-08-01T11:15:53+01:00 Claude note-added Note Added: 0000117
2026-08-01T11:15:58+01:00 Claude Status new ⇒ resolved

Synced automatically from MantisBT issue #159.

wiki/manara/bugs/weird_invoice_naming_instance.1785579457.txt.gz · Last modified: by mantisbot