Commit Graph
10 Commits
Author SHA1 Message Date
rickyandClaude Opus 5.5 ae0ffc7c1c Leave other plugins' features to hooks
Refund emails and PDFs take the shop name and mail settings from
:qbo_mail_settings instead of reading redmine_qbo_reminders' settings; the
customer page's ticked boxes use generic data-ticked-field/data-ticked-params
instead of knowing redmine_qbo_calendar's Add appointment link; and Create
issues carries the params plugins name in :qbo_billing_issue_carry_params
instead of appointment_id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 07:37:57 -05:00
rickyandClaude Opus 5.5 ff9556e728 Show the customer's addresses again; blank missing phones
The customer page's Billing and Shipping Address were always empty: the
controller stopped setting them in March and the view still read them.
The page now formats the QuickBooks addresses itself. A missing phone
number showed as "0", and the balance as "$125.0"; they're now blank
and "$125.00".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 18:02:32 -05:00
rickyandClaude Opus 5.5 b829593bc2 Limit estimate and invoice PDFs by permission; clean up
Any logged-in user could open any estimate or invoice PDF by id. Now:
- estimates: View customers or Write estimates, or an estimate attached
  to an issue the user can see (the issue page links to it); users
  without the permission don't trigger a sync of uncached estimates
- invoices: View customers, Write invoices, View/Receive payments or
  Issue refunds, or invoices attached to issues the user can see
- share-link customers are unchanged (their own issue's documents)
- the sidebar's estimate search only shows to those who can use it

The issue PDF merges an estimate PDF with optional content, as it
already did for the issue's own PDF, instead of failing.

Removed dead code: the JSON branches of CustomersController#create
(Redmine refuses JSON there) and the scaffold views for
qbo#authenticate, #oauth_callback and #webhook, which those actions
never render. An invalid customer now shows the form with a 422.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 17:36:20 -05:00
rickyandClaude Opus 5.5 17f24f9641 Add tests for billing time, OAuth, patches and helpers
BillIssueTimeJob (hours by activity, partial failure and retry, quoted
item names), the QuickBooks connection and token refresh, the business
report's periods and database figures, the Redmine page patches and
hooks (issue page, form, history, issue list column and filter, billed
time, user employee, bill/share links, issue PDF with its estimate,
activity), RefundGateway, the refund email and PDF, the services' query
string and emailing, invoice lines' LinkedTxn, combined PDFs, invoice
attachment, and the plugin settings page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 16:41:58 -05:00
rickyandClaude Opus 5.5 da82f7e12c Add controller and job tests
Integration tests for every controller: permissions, the estimate and
invoice editors (drafts, save and send, conflicts, the linked-estimate
and paid-invoice unlocks), payments, drafts, customers and share
links, estimate/invoice PDFs for share-link customers, items, accounts,
the business report, and QboController (OAuth state check, webhook
signature, manual billing). Unit tests for the webhook job, the sync
dispatcher and QboSyncJob.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 16:36:02 -05:00
rickyandClaude Opus 5.5 7c87f4f9c5 Fix attachments on customer share links
The attachments patch skipped the login redirect for share-link holders
but left Redmine's read_authorize, find_container and
find_downloadable_attachments in place, which deny the anonymous user.
It relied on an Attachment#visible? patch that never existed, so every
file on a shared issue sent the customer to the login page.

Those checks now pass when the session holds an active share token for
the file's issue (show, download, thumbnail, Download all), and defer
to Redmine otherwise. Files on private notes stay hidden, matching the
share page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:44:30 -05:00
rickyandClaude Opus 5.5 c851929e02 Refunds of paid invoices: refund receipt with optional restocking fee
Completed work that's billed and paid in full can be refunded from its
invoice (Refund on the invoice, or Paid invoice on the customer's Refund
page). It makes a QuickBooks Refund Receipt: the invoice lines refunded
(all or part, by quantity or amount) with their products/services and
tax codes, the invoice discount's share, and the restocking fee as a
negative line when it's ticked: the fee rate of the parts refunded, so
labor-only work has none. Paid out of the refund check or card account,
with the check number.

Each refund records the lines it refunded, so a line can't be refunded
for more than it was billed across refunds. Optionally notes the refund
on the invoice's work orders and emails the customer. The refund page,
PDF and email show the lines, tax and fee. Migration 056 adds the
columns to qbo_refunds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 13:23:10 -05:00
rickyandClaude Opus 5.5 9fa199aa98 Refunds for canceled orders and returned parts (SOP-OPS-014)
A Refund page on the customer: the canceled order's estimate fills in
the parts the 30% restocking fee is worked out on. Refunding makes the
fee invoice, pays it from the customer's credit, records the rest as a
Check (company check) or Expense (card refund on the terminal) with the
category Accounts Receivable, applies the credit to it so the balance
comes back to $0.00, and optionally marks the estimate Rejected,
cancels its work orders with the reason as a note and emails the
customer. Each refund has a page with a PDF of it.

New permission: Issue refunds. New settings under Billing » Refunds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 20:43:36 -05:00
ricky 5ca68b01b6 removed unsued tests 2026-01-30 20:46:04 -05:00
ricky 84f1f8dacc Initial commit 2016-01-01 10:36:43 -05:00