52 Commits
Author SHA1 Message Date
rickyandClaude Opus 5.5 30c1f5181e Clear out expired customer share links
CustomerToken.purge_expired deletes share links that have expired or
whose issue was deleted. It runs whenever a new link is made, so they
don't pile up, and from rake redmine_qbo:purge_customer_tokens for a
manual or scheduled run. Expired links were only ignored before.

Also drops Issue's belongs_to :customer_token: issues have no such
column, so the association could only raise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 19:51:25 -05:00
rickyandClaude Opus 5.5 92f9eb1bc7 Customer page lists: short paid badge, aligned icons, appointment link
* The invoice list's paid badge is short so each invoice stays on one
  line: "Paid", or "Paid +3d" when it was paid in full 3 days after
  its date, with the day on hover. The invoice page keeps the date.
* The estimate and invoice lists are laid out in columns (checkbox,
  number, date, status, actions), so the edit/view icons line up.
* Ticked estimates (and redmine_qbo_vehicles' vehicles) fill in
  redmine_qbo_calendar's Add appointment link (estimate_id,
  vehicle_id) as well as New issue. Estimate checkboxes are only on
  the customer page, where they're used.
* application.js is gone: it only carried the old Google Calendar
  link code, which threw an error when a box was ticked on a vehicle
  page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 19:39:08 -05:00
rickyandClaude Opus 5.5 8a947483db Estimate/invoice numbers on issue PDF; create estimate issues as subtasks
- Issue PDF: show the issue's estimate number and invoice number(s)
- Create issues from estimate: optional parent task. The issues are created as
  its subtasks, take its customer, and start from its project, vehicle and
  custom field values (subtask_field_copier's rules when installed)
- Issue page: shortcut to create the estimate's issues as subtasks of the issue
- Create issues page: editable start and due dates, pre-filled from the
  appointment or the parent task
- Always show plugins' fields (e.g. the vehicle) on the Create issues page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 20:17:38 -05:00
rickyandClaude Opus 5.5 084df36061 Link the Customer column in issue lists to the customer
Only for users with View customers, who can open the customer page; others see
the name as plain text. CSV and PDF exports are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 22:12:47 -05:00
rickyandClaude Opus 5.5 3b51625df4 Fix sorting and grouping time entries by Billed
The time entry Billed column sorted by time_entries.name, which doesn't exist, so
sorting or grouping by it failed. The issue list's Billed column is removed: issues
have no billed value, so showing or sorting it always failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 22:12:47 -05:00
rickyandClaude Opus 5.5 d2cdd798cd Show names in issue history, and record invoices the webhook attaches
The history showed the customer and estimate as id numbers. It now shows their names,
for existing entries too. When the QuickBooks webhook attaches an invoice to an issue,
the issue's history gets "Invoice 1042 added", linking to the invoice PDF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 21:53:13 -05:00
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
Claude b8ddf1c38b Issue PDF: allow plugin rows with an HTML value
Rows from the :pdf_left / :pdf_right hooks can now be
[label, text, { html: "..." }]; the value is drawn with writeHTMLCell so
part of it can be bold (used by redmine_qbo_vehicles to bold the last 8
of a VIN). The text still sizes the row, plain rows are unchanged, and
PdfPatch::PDF_HTML_VALUES lets plugins check for support.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-29 20:21:07 -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 8ae82f1423 Updated pdf patch to support markdown tables 2026-08-18 13:14:53 -04:00
ricky 7abb1aa06c fixed customer view to show attachments 2026-08-17 20:22:23 -04:00
ricky 396a56ceec Refactor associations in IssuePatch for clarity and consistency 2026-08-09 20:47:42 -04:00
ricky 61b02831e3 removed comment 2026-03-28 06:40:59 -04:00
ricky eacdecd65b Updated patches and hooks 2026-03-21 00:09:42 -04:00
ricky 8a8c6f5fa0 renamed issue_customer_id to customer_id 2026-03-19 18:07:21 -04:00
ricky 8fb9d74277 removced placeholder for customer field 2026-03-19 07:20:59 -04:00
ricky b367687113 Implmented custom autocomplete for customer field 2026-03-18 21:55:55 -04:00
ricky 164252cb97 Refactored PDF services 2026-03-13 23:40:52 -04:00
ricky aff7d0c48e removed uneeded logging of issue and project contents. 2026-03-04 18:37:30 -05:00
ricky e9b3b1c838 Merge branch 'master' into dev 2026-03-04 17:42:42 -05:00
ricky 2fc2f94cd1 Fixed combining of estimate pdf 2026-03-04 13:23:59 -05:00
ricky 485a977d1a Use Safe Navigation Operator &. 2026-03-01 21:31:28 -05:00
ricky 4ed71f5667 Fix: Remove unnecessary QBO configuration check in billing enqueue method 2026-02-28 18:01:32 -05:00
ricky 8303dec501 Fix: Raise error if no QBO configuration is found in sync jobs 2026-02-28 17:58:11 -05:00
ricky dc6eba8566 Refactor logging in PdfPatch to use custom log method for better clarity and consistency 2026-02-28 08:29:10 -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 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 4dc1f5d0bd Enhance billing functionality in IssuePatch with detailed logging and self-references 2026-02-20 09:47:47 -05:00
ricky 2f9ef6304f scope.includes(:customer) 2026-02-16 18:53:29 -05:00
ricky 1ade938eb3 Fixed Querying issues by customer name 2026-02-16 08:13:57 -05:00
ricky 3111f391f3 Filter by customer works now 2026-02-15 21:34:22 -05:00
ricky 359c582e22 Fixed partial billing and added flash messages 2026-02-13 18:25:07 -05:00
ricky e63b9e4217 use safe_join 2026-02-13 07:32:20 -05:00
ricky 167385bb99 override issues form to add passing @project to issues hook 2026-02-11 19:31:01 -05:00
ricky 11b9876d4f Removed unused controller_issues_new_before_save that was used for finding the 422 error 2026-02-11 08:09:00 -05:00
ricky 57adcce431 Refactor JavaScript path handling for issue form updates to help prevent 422 errors on new issue creation 2026-02-11 07:59:18 -05:00
ricky 7fdb15f7e8 more logging 2026-02-10 22:09:16 -05:00
ricky a4b51457bb moved controller_issues_new_before_save nito issues_hook_listener 2026-02-09 20:04:16 -05:00
ricky fb4a883b43 Added logging 2026-02-09 14:31:56 -05:00
ricky c24ec93335 force a tracker if still nil 2026-02-09 14:21:50 -05:00
ricky df49964bf9 added tracker nil check 2026-02-09 14:19:31 -05:00
ricky 502ba94465 Readded missing controller_issues_new_before_save 2026-02-09 14:12:01 -05:00
ricky 6a2f7a1146 initialize string link 2026-02-09 09:21:42 -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 7a73b7e8a9 refactor error handling in issue creation; remove unused reload_new_issue method 2026-02-08 10:58:39 -05:00
ricky b38bd951f7 fiex typo tracker not project 2026-02-08 10:02:42 -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 d063494bd2 removed empty link string 2026-02-06 23:00:26 -05:00
ricky d59e52b111 removed subject from logs 2026-02-06 18:58:16 -05:00
ricky 2c3548d1ac Added logging 2026-02-06 18:55:49 -05:00