Commit Graph
441 Commits
Author SHA1 Message Date
Claude 6ac0e27cb2 Report when an estimate can't be marked Accepted; show every status on the estimate page
- Accepting sends Accepted by (the customer) with the accepted date, as QuickBooks' own Accept does, and
  checks what QuickBooks returns. If it keeps the old status or refuses, the Create issues page shows a
  warning with QuickBooks' message instead of only logging it.
- The estimate page's header shows the status badge for every status, Pending included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 12:43:17 -04:00
Claude 338b4db237 Mark an estimate Accepted when issues are created from it
Creating issues from an estimate means the work is going ahead, so a pending estimate becomes Accepted in
QuickBooks (sparse update with today's accepted date, like closing an estimate) and the local estimate is
synced, so its status badge updates. Accepted, Closed, Converted and Rejected estimates are left alone. A
failure is logged and doesn't affect the created issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 12:36:05 -04:00
Claude 388ac915d7 Handle QuickBooks custom fields generically; no vehicle code left
redmine_qbo now works the same for any business; vehicle behaviour lives in redmine_qbo_vehicles.

- Every enabled QuickBooks text custom field gets a box on the estimate/invoice editor (the sales person
  is still filled in automatically). Forms keep custom_fields { field_id => value } instead of vin and
  mileage; Duplicate and Create invoice copy them all.
- Company: custom_field_matching(pattern) and editable_custom_fields; the VIN and Mileage name patterns
  are gone.
- Hooks are keyed by custom field id: qbo_billing_field_options (box suggestions) and
  qbo_billing_field_defaults (values for a document's work orders) replace the VIN hooks;
  qbo_billing_issue_values returns { field_id => { issue_id => value } }.
- Editor script API for plugins: window.qboEditor, the qbo:customer-changed and qbo:imported events, and
  the view_qbo_estimate_form_bottom hook to add a script. The VIN/mileage filling and the several-vehicle
  warning moved to redmine_qbo_vehicles.
- EstimateWriter.create_estimate(custom_fields:), custom_field_value and custom_field_values replace
  the vin/mileage arguments and vin_for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 11:34:10 -04:00
Claude abeb0fe0f5 Let plugins add fields to the Create issues from estimate page
View hook view_qbo_estimate_issues_form draws plugins' fields in the shared Issue fields box; values
posted as issue_plugin_fields[name] override the plugin defaults and reach qbo_billing_build_issue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 10:25:03 -04:00
Claude 28538d4c7f Show when a QuickBooks sync is running
Syncs record their state in a new qbo_sync_statuses table: queued when asked for, running with how
many records have been read, removed when finished (stale rows are ignored after 6 hours). The
business report says when estimates, invoices or payments are still syncing and refreshes every 30
seconds until they finish; the settings page's Synchronization table shows the same per type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 10:03:12 -04:00
Claude bf7c7b0905 Sync services and other items without a description or rate
QuickBooks only requires an item's name, but the local Item required a description and a rate, so
services such as Labor (often with neither) failed validation and were silently skipped by the sync.
Name is now the only requirement; a missing description syncs as blank and a missing rate as 0.
Product/service pickers and the labor setting list sellable items only (no Categories or Bundles).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 09:34:22 -04:00
Claude 06a78ebccb Move vehicle code out to redmine_qbo_vehicles
- IssueMileageListener removed: redmine_qbo_vehicles answers qbo_billing_issue_values with mileage.
- New hook qbo_billing_build_issue sets plugins' fields on issues created from an estimate; the vehicle
  lookup by VIN moved to redmine_qbo_vehicles.
- New hook qbo_billing_vin_options gives the VIN box's suggestions (RedmineQboBilling.vin_options)
  instead of reading customer.vehicles.
- The customer page's New issue link script is generic: any checkbox with
  data-new-issue-param="issue[field]" fills that field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 09:12:52 -04:00
Claude 616ee13725 Tidy the plugin settings page
- Three sections: QuickBooks connection, Synchronization and Billing.
- Synchronization is one table of every synced type (customers, employees, estimates, invoices,
  payments, items, accounts) with its count, last sync and a Sync link, plus Sync changes and Full sync.
  The separate billing stats and management boxes are folded into it.
- New payments sync (admin only).
- Sync links return to the page they were clicked on instead of the home page.
- Remove locale strings nothing uses any more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 08:11:27 -04:00
Claude 062ef9b8b3 Cache totals, man-hours and payments; add a business report
- Estimates now keep their total; estimates and invoices keep their man-hours: the quantities of the
  products/services set as "Replaced by imported time" (bundles included; the estimate item codes
  while that setting is blank). Filled in by the webhook and the sync.
- Payment model (QboBaseModel) caching each payment's customer, date, amount and unapplied amount,
  kept current by the webhook, the sync and the Receive payment page.
- Business report (View business reports permission, top menu): estimates written vs. invoices written
  vs. payments received, and estimated hours on estimates and issues vs. invoiced and spent hours, for
  a period, with a month-by-month breakdown.
- Fix two keyword arguments that defaulted to themselves (QboSyncDispatcher.enque_jobs, PdfService),
  which newer Ruby refuses to parse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 07:54:28 -04:00
Claude 14f0409395 Add a customer payments page
Payments on the customer page lists the customer's QuickBooks payments, newest first, with the
invoices each was applied to, memo, amount, unapplied credit and totals; each links to the payment
page and its PDF. A new View payments permission allows the list, payment page and PDF; Receive
payments includes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 00:00:36 -04:00
Claude 9121e079a0 Fold redmine_qbo_billing into redmine_qbo
Estimates, invoices and payments written in Redmine, issues from estimates,
and the QuickBooks product/service list and accounts are now part of this
plugin (the RedmineQboBilling code, its controllers, views, strings and
permissions), so there's one plugin and one version instead of two that had
to match.

- The customer page, estimate and invoice lists and the issue page render the
  Create Estimate / Create invoice / Receive payment and Edit links directly;
  the hooks that only existed to let billing add them are gone. Users without
  the billing permissions still get the links to QuickBooks.
- Migrations 043-046 create the items and accounts tables and the estimate
  line links, skipping whatever an existing database already has
  (redmine_qbo_lineitems' tables are used as they are), and copy calendar's
  existing estimate line links in.
- The billing settings are a section of this plugin's settings page.
- The hooks other plugins use stay: qbo_billing_issue_values,
  qbo_billing_validate, qbo_billing_issue_defaults, qbo_billing_issues_created
  and view_qbo_estimate_contextual.
- rake redmine_qbo:relate_estimate_issues

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-30 23:47:01 -04:00
Claude 0523e8dd24 Security, permission and search fixes
Security
- Connecting to QuickBooks (authenticate/oauth_callback) and all syncs
  are admin-only; the OAuth state is stored and verified on callback
- New "Bill issue time to QuickBooks" project permission; billing is now
  a POST and checks the permission and issue visibility
- Estimate/invoice PDFs require a logged-in user, or a customer share
  link limited to the estimate and invoices attached to that issue
  (the old require_user check never ran)
- Attachments patch keeps the share token per request instead of in
  Thread.current, so it can't leak into other requests

Permissions and share links
- customers#autocomplete and the filter_* actions are part of View
  customers, so non-admins can pick customers on forms
- customers#view no longer goes through authorize_global; share needs
  the new "Share issues with customers" permission and a visible issue
- Removed a check in customers#view that compared a value to itself

Bugs
- Subjects and customer names capitalize each word without lowercasing
  the rest (LED, JL, 4x4 stay as typed); subjects only when changed
- Settings page shows Invoice/Estimate sync times (Item/Account models
  no longer exist)
- customers#update shows validation errors instead of reporting success
- Billing marks each activity billed once sent to QBO, so retries and
  token refreshes don't create duplicate TimeActivities

Search
- New CustomerSearchService for autocomplete and the customer search
  page: nicknames (Bill/William), typos, word order, partial words,
  accents, and phone digits in any format; ranked, with the candidate
  list cached until a customer changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-28 22:08:36 -04:00
ricky bab019a152 Implement global permissions for customer actions and update views to check permissions before rendering buttons 2026-09-08 22:35:52 -04:00
ricky ba40496421 Enhance autocomplete functionality to support name and phone queries with fuzzy matching 2026-08-25 16:05:51 -04:00
ricky 9dc4b79355 Refactor customer controller and form to enhance error handling and conditional rendering 2026-08-24 20:17:21 -04:00
ricky b367687113 Implmented custom autocomplete for customer field 2026-03-18 21:55:55 -04:00
ricky 020ea01d36 renamed controllers and updated routes 2026-03-18 00:08:56 -04:00
ricky 7d3908ec41 fixed estimate#sync 2026-03-17 23:31:42 -04:00
ricky f60e507029 Updated settings page 2026-03-17 21:23:29 -04:00
ricky 3e81d2840a fixed typo 2026-03-15 17:59:53 -04:00
ricky c9a5dc20f9 Added manual sync links 2026-03-15 08:01:04 -04:00
ricky eb1174cf7c Updated manual sync to to allow full or partial sync 2026-03-14 15:36:39 -04:00
ricky 164252cb97 Refactored PDF services 2026-03-13 23:40:52 -04:00
ricky 8ba99b7db2 Fixed eager loading issues 2026-03-04 19:18:06 -05:00
ricky be400c2b2a Added logging for errors when editing 2026-03-03 19:22:15 -05:00
ricky 899237c5ab Reduced blanket rescues, added respond_to_missing?, and extracted push into CustomerPushService 2026-03-02 22:41:22 -05:00
ricky b95a3b6623 Refactor: Update billing error messages in locale for consistency and clarity 2026-03-01 12:35:54 -05:00
ricky ef3f00c445 Refactor: Replace BillingValidator with inline validations in bill method and update error messages in locale 2026-03-01 12:29:20 -05:00
ricky 3728ec2a12 Refactor: Improve address formatting in CustomersController and enhance HTML rendering for billing and shipping addresses 2026-03-01 00:40:11 -05:00
ricky cefa36c880 Removed unsued Customer destroy method 2026-03-01 00:28:57 -05:00
ricky ed111fefe7 Refactor: Update QBO connection handling to use QboConnectionService for consistency across services and controllers 2026-03-01 00:27:06 -05:00
ricky f921f227e2 Refactor: Introduce PdfServiceBase for shared PDF fetching functionality and update Invoice/Estimate controllers to utilize new services 2026-02-28 21:59:01 -05:00
ricky a34ae46358 Refactor: Simplify invoice PDF fetching and introduce InvoicePdfService for better organization 2026-02-28 21:36:16 -05:00
ricky e4cfb0674e Refactor: Enhance estimate loading and syncing logic in EstimateController 2026-02-28 21:20:35 -05:00
ricky 7a50df24d9 Add logging to get_estimate method for better debugging 2026-02-28 08:53:38 -05:00
ricky 6f8af9bba8 Implement Employee synchronization; add EmployeeSyncJob and EmployeeSyncService for improved background processing and logging 2026-02-27 23:07:12 -05:00
ricky 03109d5775 Refactor invoice processing and synchronization; implement InvoiceSyncJob and related services for improved background processing and logging 2026-02-27 22:33:04 -05:00
ricky 9c0f153518 Refactor logging across controllers and jobs to use a centralized log method; improve consistency and readability of log messages 2026-02-27 22:32:07 -05:00
ricky f32b48296d Refactor estimate synchronization to use EstimateSyncJob; remove direct sync logic from Estimate model for improved background processing 2026-02-27 08:29:52 -05:00
ricky 889e9bf31f Refactor customer synchronization to use CustomerSyncJob; remove direct sync logic from Customer model for improved background processing 2026-02-27 08:00:38 -05:00
ricky 208e839e6a Refactor CustomerToken model for improved token management; streamline token generation and expiration handling, and enhance association with issues 2026-02-26 21:05:02 -05:00
ricky 4f55751500 Refactor QuickBooks webhook handling to use ActiveJob for processing; improve security with signature verification and streamline entity processing 2026-02-26 20:30:20 -05:00
ricky a64016eb95 Refactor QBO billing to use ActiveJob; remove threaded billing and add manual job enqueue support 2026-02-26 19:48:29 -05:00
ricky 5d858ae186 Enhance customer search functionality by ordering results and refining search method 2026-02-25 22:05:52 -05:00
ricky a54de28db5 Extending customers to Redmine's built in search 2026-02-21 11:20:20 -05:00
ricky e7dfc3f2ad added sync estimates by id 2026-02-14 08:25:02 -05:00
ricky 359c582e22 Fixed partial billing and added flash messages 2026-02-13 18:25:07 -05:00
ricky e6c4e81df2 Remove unused add_appointment method from CustomersController 2026-02-08 19:48:01 -05:00
ricky 5d7d9a81bb inital start of using javascript to update the appointment link with selected document links 2026-02-06 17:58:02 -05:00
ricky 6c9ae82f81 fixed typo 2026-01-30 21:22:08 -05:00