Commit Graph
140 Commits
Author SHA1 Message Date
rickyandClaude Opus 5.5 159420fac1 Show estimate, invoice and payment activity on the activity page
Each type appears only on the overall activity page, and only for users who may see it:
estimates need View customers or Write estimates, invoices View customers or Write invoices,
and payments View or Receive payments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 21:53:13 -05:00
rickyandClaude Opus 5.5 4ba96e2dfd Warn about the customer's open issues on a new invoice
A new invoice lists the customer's open issues (any project, those the user can see) in a warning under
the title, so work orders aren't left open once the work is billed. It's there when the page opens with a
customer (from the customer page or an estimate) and follows the customer when it's changed: customer_info
returns open_issues_html for invoices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 17:55:14 -05:00
rickyandClaude Opus 5.5 489edd97fa Customers page lists every customer, paged by Redmine instead of will_paginate
- The Customers page shows all customers without a search: a Redmine list with name, phone, mobile,
  issue count and last update, sortable by column, with Redmine's pagination and per-page choices
- Search works as before (best matches first, a single match opens the customer); clicking a column
  sorts the matches by it instead, and Clear goes back to everyone
- New Customer and Sync move to the page's action links
- will_paginate removed from the Gemfile and init.rb; redmine_qbo_vehicles 2026.11.3 no longer needs it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 17:47:19 -05:00
rickyandClaude Opus 5.5 51159d5034 Business report: project filter, remembered per user
- Projects picker (project tree, visible projects only) limits issues' estimated time and spent time
  to the chosen projects, in the totals, charts, last-year lines and months; none picked is every project
- Estimates, invoices and payments have no project in QuickBooks, so they stay whole-business; the page
  says so while filtered (the CPI's invoiced hours included)
- "Remember these projects" saves the choice in the user's Redmine preferences; the report opens with it
  when the address has no projects, and saving none goes back to every project

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 16:44:03 -05:00
Claude 8f2cef2bc8 Business report: week periods and line charts with last-year comparison
- This week and last week periods; weeks start on Redmine's "Start calendars on" day
- Sales and Hours line charts above the bars, same figures and colors, drawn with
  Redmine's bundled Chart.js: a point per day (a week), week (up to ~3 months) or month
- "Compare with last year" toggle adds dashed, faded last-year lines instantly and is
  kept in the URL; days/weeks go back 52 weeks so weekdays line up, months to the same month
- Legend: one entry per figure (hides both years' lines) plus a single "last year" entry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 21:58:58 -04:00
Claude bd29ec2978 Imported time replaces its own line, not one block at the first
Importing time with "Replace these lines" put all the time where the first ticked line was and removed the
others, so ticking several lines jumbled the invoice (time out of order, subtotals over the wrong lines).
Each time entry now takes the place of one ticked line: the one whose description is its issue's subject
(issues created from an estimate are named after the line: "Install #134: Install Lift Kit" replaces
"Install Lift Kit"), then any others in order. Extra time goes after the last replaced line; extra ticked
lines are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 18:05:01 -04:00
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 0d35cffb83 Cost performance index on the business report
CPI = invoiced hours / spent hours, for the period and for each month, colour-coded: green at 1.00 or
more, yellow below 1, red below 0.80. It replaces the invoiced-vs-spent percentage (the same figure).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 13:51:19 -04:00
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 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 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 4732c32409 Combine the labor settings into Labor products/services
The estimate item codes and "Replaced by imported time" become one list of products/services
(RedmineQboBilling::LaborItems), used to create issues from an estimate's labor lines (and an
appointment's minimum hours), to offer an invoice's labor lines to be replaced by imported time, and
to total the hours on estimates and invoices for the business report. While none are chosen,
products/services named Labor are used. The old settings and redmine_qbo_calendar's fallbacks are no
longer read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 08:22:32 -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 9fd6e90c81 Drop QuickBooks estimate and payment links from customer actions
Estimates and payments are handled in Redmine; each action shows only to users with its permission.
The customer's name still links to their QuickBooks account page as a fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-31 00:12:03 -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 b901e64149 added new issue link to actions 2026-08-17 20:40:42 -04:00
ricky b3c3006b56 Added transaltion for Estimate 2026-08-06 16:22:12 -04:00
ricky 576ca5a0a9 Added transation for customer 2026-08-06 16:03:31 -04:00
ricky 6bf84dd61a Added payment link 2026-07-01 14:06:02 -04:00
ricky 82712f361c fixed estimate path 2026-03-19 08:07:34 -04:00
ricky b367687113 Implmented custom autocomplete for customer field 2026-03-18 21:55:55 -04:00
ricky 460bcd466f Fixed routes 2026-03-18 19:11:33 -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 c9a5dc20f9 Added manual sync links 2026-03-15 08:01:04 -04: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 ed111fefe7 Refactor: Update QBO connection handling to use QboConnectionService for consistency across services and controllers 2026-03-01 00:27:06 -05:00
ricky cc6fd07435 Update notice for missing estimate to include syncing information with QuickBooks 2026-02-28 08:53:46 -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 9c11704d03 Added label_create_estimate 2026-02-13 20:45:59 -05:00
ricky 2ae53adf08 added needed trailing space 2026-02-13 20:37:42 -05:00
ricky a069556ed9 Alphabetized: All keys are now in A-Z order for easier maintenance.
Branding: Changed "Quickbooks" to QuickBooks (capitalized B) to match official branding.

Grammar:

warn_ru_sure: Changed "You sure?" to "Are you sure?"

label_no_customers: Refined to "There are no customers matching the search term(s)."

label_billing_error: Added punctuation and clarified the phrasing.

Cleanup: Removed unnecessary spaces inside quotes (e.g., " Make" and "Matching ").
2026-02-13 18:33:48 -05:00
ricky 359c582e22 Fixed partial billing and added flash messages 2026-02-13 18:25:07 -05:00
ricky df49964bf9 added tracker nil check 2026-02-09 14:19:31 -05:00
ricky 548dc4fba8 Implement issue creation error handling; add project validation and refactored issue hooks 2026-02-08 13:07:28 -05:00
ricky 0e3318efdd Added prefilters to help locate 422 on issue creation.
This is an effort to figure out why I get 422 Unprocessable Entity errors sometimes when creating new issues.
2026-02-08 09:58:34 -05:00
ricky f1bdf59697 Add customer details translation and fix link in appointment action 2026-01-30 23:05:23 -05:00
ricky 7e0b2c9d09 Removed unused folders 2026-01-30 20:51:09 -05:00
ricky e6818958ae Add I18n support for flash messages and update locale file with new notices 2026-01-30 20:19:12 -05:00
ricky b80e1d4e28 loose the hash rocket, use symbol keys 2026-01-29 22:30:59 -05:00
ricky 1f03908040 Refactor employee and estimate models by removing redundant comments; update locale file to remove item references; delete unused QboItemTest file. 2026-01-28 07:45:20 -05:00
ricky 3c2f1d0edd Merge branch 'redmine-6' into HEAD 2026-01-22 20:39:20 -05:00
ricky 35e303d54b Migrated hard coded strings to locales 2026-01-21 20:49:54 -05:00