Skip to content

[IP-268]: bill project tasks to a draft invoice#572

Closed
nielsdrost7 wants to merge 2 commits into
developfrom
feature/268-bill-project-tasks
Closed

[IP-268]: bill project tasks to a draft invoice#572
nielsdrost7 wants to merge 2 commits into
developfrom
feature/268-bill-project-tasks

Conversation

@nielsdrost7

Copy link
Copy Markdown
Collaborator

Addresses #268 (kept open per workflow — PRs stay draft).

What

  • ProjectBillingService::billTasks(Project, array $taskIds): Invoice — creates one invoice item per selected task (item name = task name, quantity 1, price = task_price, task's tax rate, task_id link). Appends to the client's existing draft invoice when one exists, otherwise creates a new draft with a null invoice number (numbering is assigned when the invoice leaves draft — consistent with the duplicate-prevention observer on PR [IP-513]: duplicate-number prevention via Observers #540, which allows multiple nulls for drafts).
  • Only completed tasks that are not already on an invoice (invoice_items.task_id) qualify — double billing is impossible.
  • Bill Tasks row action on the projects list (gated by create-invoices) opens a checkbox list of billable tasks; guard failures surface as a notification.
  • Invoice totals are refreshed from the item subtotals after billing.

Deviation from the SMART plan: no redirect to EditInvoice — that page only exists on PR #544's branch, not on develop yet. Trivial to add once #544 lands.

Tests

ProjectBillingTest — 5 tests: new draft creation, append-to-existing-draft, double-billing rejection, non-completed rejection, and modal option filtering.

Note: upstream CI fails at job startup on every branch (no runner assigned) — validated locally; the 24 pre-existing Projects failures (permission-seeding 403s) are unchanged.

🤖 Generated with Claude Code

nielsdrost7 and others added 2 commits July 3, 2026 20:22
ProjectBillingService::billTasks() creates one invoice item per selected
task (name, description, price, tax rate; quantity 1) on the client's
existing draft invoice, or a new unnumbered draft when none exists.
Only completed tasks not already linked to an invoice item qualify.

The Bill Tasks row action on the projects list opens a checkbox list of
billable tasks and reports success or the guard message.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bc3d9bdb-2067-4bd9-903c-e9395dabdc14

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/268-bill-project-tasks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nielsdrost7 nielsdrost7 closed this Jul 3, 2026
@nielsdrost7 nielsdrost7 deleted the feature/268-bill-project-tasks branch July 3, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant