User Tools

Site Tools


wiki:manara:bugs:invoice_label_add_collected

This is an old revision of the document!


invoice label add "collected" (Resolved)

Reported by: Khaled Tarabay on 2026-07-30T10:16:28+01:00
Assigned to: Claude
Resolved by: Claude on 2026-07-30T10:49:53+01:00
Priority: normal
Severity: minor
Reproducibility: have not tried
Category: General

Description: currently in the invoice tab there is a purchase label working as designated so what I want you to do is basically to add a collected label which isn't exclusively for contacts but for contacts and customers also, make it that it functions in the same away as the “purchase” label does, and an example of how it works in the contacts case is that when you collect a sale from a client it shows “collect” or “collected” or “collection” whatever is grammatically correct and mirrors purchase, also add an option to sort invoices by purchase and collect in the table view of the invoices tab

Resolution: Done. Added a “Collection” label that mirrors the existing “Purchase” label, for sale invoices (customers AND contacts), plus sort/filter by direction.

WHAT: The invoices list showed a “Purchase” pill only for purchase bills and nothing for a sale. Now every invoice carries a direction pill in its own new sortable “Type” column: purchase → “Purchase” (amber), sale → “Collection” (green). A customer invoice is always a sale, so it reads “Collection”; a contact sale reads “Collection”; a contact purchase bill reads “Purchase”.

WHERE / FIX: - app/classes/Billing/Invoice.php: added kind ⇒ i.invoice_kind to SORTABLE (Type column sorts by direction) and a filter param to allSorted() (collection → invoice_kind='sale', purchase → 'purchase'). - app/controllers/BillingController.php::index(): reads a whitelisted ?kind= param and passes it through. - app/views/billing/index.php: new sortable “Type” column with the Purchase/Collection pill; All / Collections / Purchases filter tabs (reusing the existing .filter-tabs CSS) that preserve the active search; search form + sort links preserve the active kind.

Files: app/classes/Billing/Invoice.php, app/controllers/BillingController.php, app/views/billing/index.php. No schema change. Verified via php -l + a closure/pill render harness (5/5) + RouteProtectionTest (green). Local MySQL is down so no live run.

Activity / Notes

  • 2026-07-30T10:49:50+01:00 - Claude: Done. Added a “Collection” label that mirrors the existing “Purchase” label, for sale invoices (customers AND contacts), plus sort/filter by direction.

WHAT: The invoices list showed a “Purchase” pill only for purchase bills and nothing for a sale. Now every invoice carries a direction pill in its own new sortable “Type” column: purchase → “Purchase” (amber), sale → “Collection” (green). A customer invoice is always a sale, so it reads “Collection”; a contact sale reads “Collection”; a contact purchase bill reads “Purchase”.

WHERE / FIX: - app/classes/Billing/Invoice.php: added kind ⇒ i.invoice_kind to SORTABLE (Type column sorts by direction) and a filter param to allSorted() (collection → invoice_kind='sale', purchase → 'purchase'). - app/controllers/BillingController.php::index(): reads a whitelisted ?kind= param and passes it through. - app/views/billing/index.php: new sortable “Type” column with the Purchase/Collection pill; All / Collections / Purchases filter tabs (reusing the existing .filter-tabs CSS) that preserve the active search; search form + sort links preserve the active kind.

Files: app/classes/Billing/Invoice.php, app/controllers/BillingController.php, app/views/billing/index.php. No schema change. Verified via php -l + a closure/pill render harness (5/5) + RouteProtectionTest (green). Local MySQL is down so no live run.

Full History

Date Modified Username Field Change
2026-07-30T10:16:28+01:00 Khaled Tarabay issue-new New Issue
2026-07-30T10:49:45+01:00 Claude Assigned To ⇒ Claudine
2026-07-30T10:49:48+01:00 Claude tag-added Tag Attached: done-by-claude
2026-07-30T10:49:50+01:00 Claude note-added Note Added: 0000104
2026-07-30T10:49:53+01:00 Claude Status new ⇒ resolved

Synced automatically from MantisBT issue #146.

wiki/manara/bugs/invoice_label_add_collected.1785405019.txt.gz · Last modified: by mantisbot