Commit Graph
668 Commits
Author SHA1 Message Date
Claude 03af3457ab Show invoice statuses
Invoices get a status badge on the customer page's invoice list and the invoice page: Paid, Partially
paid, Overdue, Open or Voided (zero total), worked out from the total, balance and due date like
QuickBooks' invoice list (RedmineQboBilling::InvoiceStatus; QuickBooks keeps no status on invoices).
The list uses the cached balance and due date; the invoice page uses QuickBooks' current figures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 14:10:11 -04:00
Claude b739b84917 Fix duplicate estimates: make QuickBooks ids unique
The customers, employees, estimates and invoices tables were created with
t.integer :id, options: 'PRIMARY KEY', which Rails ignores, so the QuickBooks id was never unique. Two
syncs of the same record at once (saving an estimate in Redmine, then QuickBooks' webhook) inserted it
twice, so it showed twice on the customer page and counted twice on the business report.

- Migration 050 keeps one row per id (the most recently updated) and adds a unique index on id.
- A sync that collides with another one's insert retries once as an update.
- Estimates, customers and employees validate a unique id, like invoices already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 11:48:23 -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 3304fce92f Make billed estimates read-only
An estimate that's Converted or Closed in QuickBooks, or linked to an invoice, opens read-only and is
refused on save (this includes redmine_qbo_lineitems' estimates once invoiced). Its page lists the
invoices it's on. Estimates cache their status so lists show View instead of Edit for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 08:34:41 -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 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 c31ec82e61 Normalize customer name before saving and update QBO display name accordingly 2026-08-10 15:20:14 -04:00
ricky 9373963c94 Fix association type for issues in Estimate model 2026-08-09 20:47:55 -04:00
ricky d18a0c180a added name function to estimate 2026-08-06 07:55:51 -04:00
ricky 7149e85d37 Updated how settings are handled.
Note: Breaking change. Will need to update settings after update
2026-03-21 10:25:46 -04:00
ricky b8327be5d6 Updated to handle no qbo exception 2026-03-14 21:45:15 -04:00
ricky c4e1ece82c Merge branch 'master' into dev 2026-03-14 17:30:53 -04:00
ricky a6c8923ea9 Fixed uncaught exception when there is no QBO connection 2026-03-14 17:27:01 -04:00
ricky bb57af71ae Simplified detail calls 2026-03-14 08:20:18 -04:00
ricky cd109f16b5 Refactored QBO service calls 2026-03-14 00:10:10 -04:00
ricky fd18205c10 Refactored all Sync Jobs into QboSyncJob 2026-03-13 23:26:02 -04:00
ricky 2bcb1840a4 Added qbo_sync flag 2026-03-13 08:33:18 -04:00
ricky beb4a66a93 Updated comments 2026-03-12 17:53:06 -04:00
ricky 40f7a3335c Reworked push on save and refactored variable names 2026-03-12 15:58:28 -04:00
ricky 4fa8be856a Refactored models to use base model 2026-03-12 11:14:45 -04:00
ricky 00b1baa1f3 Fixed create new customer 2026-03-05 21:33:49 -05:00
ricky b96678a2e9 fixed accident deleteion details_cache_key 2026-03-04 20:09:13 -05:00
ricky bccfcd9dbc cache qbo details to reduce api calls 2026-03-04 20:06:22 -05:00
ricky 4403267abb Moved QBO fetch from customer model into service 2026-03-03 19:49:36 -05:00
ricky 28db5cb8c8 removed unused code 2026-03-02 22:50:43 -05:00
ricky f8b1c72394 show all customer when search is blank 2026-03-02 22:49:18 -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 f02b50ae26 Added time stamps to each qbo entity model 2026-03-02 07:10:13 -05:00
ricky b15b88f48d Fix: Correct I18n reference in last_sync method for proper translation 2026-03-01 01:07:43 -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 6e90548dbb Removed unused method 2026-02-28 22:56:03 -05:00
ricky 19911b7940 Refactor EstimateSyncJob to support syncing by ID and document number; add EstimateSyncService for handling estimate synchronization 2026-02-28 08:24:25 -05:00
ricky a80f59cc45 Refactor sync_by_id method in Estimate model to use EstimateSyncJob for syncing 2026-02-28 07:50:23 -05:00
ricky eee99e4d83 Implement CustomerSyncService for customer synchronization and update CustomerSyncJob to support syncing by ID 2026-02-28 07:50:07 -05:00
ricky 9a688c4841 Set primary_key 2026-02-27 23:39:34 -05:00
ricky e94352e2c4 Added comment 2026-02-27 23:19:44 -05:00
ricky ea0f42b68e Added comment 2026-02-27 23:18:40 -05:00
ricky 5a31c194a5 Added comments 2026-02-27 23:15:37 -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 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 138e55933b Fixed creation of new customers. 2026-02-25 15:32:45 -05:00
ricky 5fbc169ade Restored old search 2026-02-25 08:08:02 -05:00