Commit Graph
45 Commits
Author SHA1 Message Date
Claude c4ab97b75e Customer search: bundled nickname data and sound-alike matching
- Nicknames now come from the carltonnorthern/nicknames data set
  (Apache 2.0, ~2,800 pairs, bundled in data/nicknames with its license),
  plus a few extra groups in EXTRA_NICKNAME_GROUPS. Names match if
  directly linked, or if both are short for the same longer name, so
  Bill/William and Bill/Will match but William/Robert don't (the data
  lists "bill" for both)
- Double Metaphone (text gem) matches names that sound alike but are
  spelled differently: Jon/John, Smyth/Smith, Cathy/Kathy,
  Steven/Stephen, Jeffrey/Geoffrey
- Faster ranking: per-search word-pair scores are cached, whole-name
  comparison only runs when it can succeed, and prepared search data is
  kept in process memory until a customer changes (~40 ms per search at
  5,000 customers)

Adds gem 'text', '~> 1.3' to the Gemfile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-28 22:22:00 -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 f2b0186ee2 Add EstimateService class 2026-08-09 20:50:20 -04:00
ricky e681203a45 Removed custom field sync, it was never really useful anyways. 2026-03-28 00:25:07 -04:00
ricky 7993f15441 updated comments 2026-03-14 15:30:50 -04:00
ricky 1a10360884 refactored PdfService to use QboConnectionService 2026-03-14 00:16:11 -04:00
ricky cd109f16b5 Refactored QBO service calls 2026-03-14 00:10:10 -04:00
ricky 164252cb97 Refactored PDF services 2026-03-13 23:40:52 -04:00
ricky fd18205c10 Refactored all Sync Jobs into QboSyncJob 2026-03-13 23:26:02 -04:00
ricky 6fc8a18e93 Updated attribute mapping 2026-03-13 15:43:24 -04:00
ricky c87e18810b Added Attribute Mapping DSL 2026-03-13 08:32:55 -04:00
ricky eb6954ddf1 refactor(sync): improve attribute mapping to support dynamic fields and custom transformations 2026-03-12 21:38:06 -04:00
ricky be1a69217f created a shared helper for authenticated requests. 2026-03-12 21:05:39 -04:00
ricky 99669f7baa created a shared helper for performing authenticated request. 2026-03-12 18:26:21 -04:00
ricky 29530e2c95 fixed order 2026-03-12 17:55:09 -04:00
ricky 40f7a3335c Reworked push on save and refactored variable names 2026-03-12 15:58:28 -04:00
ricky ffd8dc6332 Refactored Customer service to use a service base class 2026-03-12 09:48:36 -04:00
ricky b10665355d Allow Subclasses to override the page size 2026-03-08 23:34:37 -04:00
ricky ef5089438c Fixed query_in_batches 2026-03-08 21:51:31 -04:00
ricky 9f9810686f removed logging 2026-03-03 20:36:23 -05:00
ricky f041e1bce4 Added logging for completed pull 2026-03-03 20:05:19 -05:00
ricky d44d5e2fb7 Fixed log prefix 2026-03-03 19:54:50 -05:00
ricky 4403267abb Moved QBO fetch from customer model into service 2026-03-03 19:49:36 -05:00
ricky 23e565a304 raise exceptions if not initialized properly 2026-03-02 22:57:13 -05:00
ricky 2e2b17fac3 log should be private 2026-03-02 22:54:26 -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 899c9878c4 Fix: only attach invoices if document is updated 2026-03-01 19:27:23 -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 46f06df995 Removed unused service 2026-03-01 12:14:53 -05:00
ricky 7b7b07b5fa fixed file name 2026-03-01 01:01:26 -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 348c521491 Added comments 2026-02-28 20:03:19 -05:00
ricky 6cee8c1d81 Fix: Remove logging of fetched page information in SyncServiceBase 2026-02-28 19:59:50 -05:00
ricky d4a0aa1db5 Refactor: Introduce SyncServiceBase for shared functionality across sync services 2026-02-28 19:47:45 -05:00
ricky b80dbaa015 Fix: Update last_update query to use correct timestamp field for customer sync 2026-02-28 09:11:01 -05:00
ricky 9e399b934b Fix: Update last_update query to use correct timestamp field for employee sync 2026-02-28 09:10:55 -05:00
ricky 9089adaba0 removed uneeded comments 2026-02-28 08:35:35 -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 eee99e4d83 Implement CustomerSyncService for customer synchronization and update CustomerSyncJob to support syncing by ID 2026-02-28 07:50:07 -05:00
ricky b3f01bd372 Refactor persist method in InvoiceSyncService to use 'local' variable for clarity and add logging for updates 2026-02-28 07:41:22 -05:00
ricky d1ba93d61a Refactor persist method in EmployeeSyncService to use 'local' variable for clarity 2026-02-28 07:41:05 -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