Commit Graph

85 Commits

Author SHA1 Message Date
johnnyq
a27019511e Remove unused overdue invoice setting move master cron switch out of notificaiton and into cron 2026-08-02 17:22:28 -04:00
johnnyq
75028ba09a Fix some Ticket History gaps 2026-08-01 14:33:37 -04:00
johnnyq
53f45fa008 Fix queued backups never building, per-type retention, and cron connection handling 2026-07-31 16:35:39 -04:00
johnnyq
ae468d6cee Encrypted backups with types, scheduling and CLI restore
Backups are now AES-256 encrypted zips in three types (full, database
only, master key), catalogued in a new backups table, built by cron rather
than the web request, and kept under uploads/backups with retention in the
nightly job. The encryption key is one value per install held in config.php,
never in the database and never in the file name.

Restore is shared by the setup wizard and the new scripts/restore_cli.php,
which is the only path without an upload size limit. It verifies the key and
unpacks the archive before dropping anything, and dumps the current database
first so a failed import is rolled back.

A backup dumps, zips and encrypts for minutes without issuing a query, so on
a server with a short wait_timeout the connection is closed underneath it and
the UPDATE marking the backup complete is what fails - long after the archive
was written correctly. The connection is now held open for the job and
re-established before any write that follows long file work, including the
database phase of a restore. Retention recovers rows a dropped connection
left behind: still Running after six hours becomes Complete if the archive is
on disk, Failed if it is not.

cron.php's own failure path is hardened to match. It recorded job failures
through the same connection the failing job had just killed, so an uncaught
exception ended the dispatch and no trace of the original error survived.
Failures now also echo to stdout, so cron mails something useful when the
database is unreachable.

Security: the setup wizard's restore step is now closed on any install that
has users, whatever config.php says. $config_enable_setup defaulted to
enabled when the flag was absent, and the flag is only written at the end of
a successful install, so an install abandoned partway left an unauthenticated
endpoint that would drop every table, import an attacker-supplied archive,
and overwrite uploads/ including the .htaccess that stops PHP running there.
Affects 26.07 and earlier. Restoring over a live install is now CLI only.
2026-07-31 16:18:20 -04:00
johnnyq
16000efcf7 Drop SVG extension in the ticket mail parser 2026-07-31 12:39:10 -04:00
johnnyq
7c5579677d Cron: daily jobs catch up when the dispatcher is invoked before their scheduled time, so an old single daily crontab entry still runs them 2026-07-30 18:21:47 -04:00
johnnyq
8436cd6296 Nightly tasks: apply late fees, overdue reminder emails, and autopay retries at most once per invoice per day, and lock nightly to the daily schedule 2026-07-30 17:50:11 -04:00
johnnyq
0631c45040 Fix Cron Schedule and new directory includes created inside cron for the cron lock 2026-07-30 17:06:07 -04:00
johnnyq
119334ab71 Cron Fix 2026-07-30 16:44:56 -04:00
johnnyq
38e8edea19 Cron runs all jobs from a single dispatcher cron.php which should now be run every minute and all other cron jobs eliminated from cron 2026-07-30 13:48:39 -04:00
johnnyq
2395a3ee16 Phase 2 of ticket attachements by agents 2026-07-29 18:10:34 -04:00
johnnyq
e74307eaea Feature: Add Dynamic Task editing in add ticket and add recurring ticket, recurring tickets now have their own task table as well 2026-07-29 17:48:41 -04:00
johnnyq
7245ff0650 Fix Cron URL Key on recurring tickets 2026-07-29 16:11:36 -04:00
johnnyq
bc64c9e3d1 Feature: Abiliry to assign Ticket Templates to Recurring Tickets 2026-07-29 15:55:14 -04:00
johnnyq
162a597da9 Add SLA pausing, SLA reports, SLA filtering and kanban SLA state (phase 3)
Statuses can be flagged to pause the resolution clock; sla_history records the intervals a ticket's clock actually ran and the deadline is re-based on remaining budget when it resumes. Adds SLA Summary and SLA by Client reports, an SLA state filter on the ticket list, SLA colouring on kanban cards, and an Urgent column on the Tickets by Client report. DB update 2.5.1. Also fixes resolution SLA verdicts being skipped when resolving via kanban or the client portal.
2026-07-29 13:02:27 -04:00
johnnyq
d08ef6184a Add optional ticket SLAs
Response/resolution targets stamped at creation from per-client/priority assignments, business-hours due date math, warn/breach alert stages via cron/ticket_sla.php, ticket list coloring, per-ticket SLA override, admin page for plans/assignments/business hours. DB update 2.5.0. No behavior change unless SLAs are assigned. Bulk reply now only counts Public replies as first response.
2026-07-29 00:00:42 -04:00
johnnyq
c5ff3e2a3f Normalize line endings to LF; add .gitattributes and .editorconfig 2026-07-28 17:45:52 -04:00
johnnyq
4c65b8c561 Clear mail bodies after successful delivery 2026-07-28 00:18:07 -04:00
johnnyq
97490bef3b Security Fix in recurring invoices in cron 2026-07-27 18:07:15 -04:00
johnnyq
a844d7b428 Adds a shared flock guard used by all five cron entry points, keyed per
script and per install. Replaces the mail queue's own lock file, which
was not atomic and could be deleted out from under a long run. Bounds
the SMTP conversation so an unresponsive server cannot hold the lock.
Recovers rows left at Sending by a run that died, which nothing
previously picked up.
2026-07-27 17:35:39 -04:00
johnnyq
686fca99e1 Fix Possible duplicate emails in a race condition in mail queue 2026-07-27 16:59:10 -04:00
johnnyq
409d769eb7 Scope the cron lock per install so instances don't block each other
Report an unopenable cron lock file instead of claiming cron is running
2026-07-27 16:41:21 -04:00
johnnyq
65de8c35e6 Prevent duplicate Stripe payment bookings and overlapping cron runs 2026-07-27 15:22:16 -04:00
johnnyq
8f43b92496 Use stripe_init include to init stripe and updated code everywhere 2026-07-23 13:00:01 -04:00
johnnyq
8ee780566e Cleanup Expense Code in post blocks and remove single use function since stripe payments get reconciled during nightly cron 2026-07-22 17:06:10 -04:00
johnnyq
08334b22c3 Add Stripe fee reconciliation to cron
Balance transactions aren't always attached when a payment completes,
so the fee expense can be skipped at payment time. Daily cron pass now
finds recent Stripe payments with no matching fee expense and records
the actual fee once available. Dedupes by expense reference prefix,
30-day lookback.
2026-07-22 16:47:28 -04:00
johnnyq
66b38b7f19 Get Expense from Stripe instead of Static Entry 2026-07-22 16:07:39 -04:00
johnnyq
21a23e79b0 Replace Function getSSL() with getSslCertificate() 2026-07-14 17:54:31 -04:00
johnnyq
52b5063066 Replace Function getDomainRecords() with getDnsRecords() 2026-07-14 17:53:16 -04:00
johnnyq
9d540f4bfe Replace Function customAction() with triggerCustomAction() 2026-07-14 17:43:55 -04:00
johnnyq
f1836c70cd Replace Function logAction() with logAudit() 2026-07-14 17:35:23 -04:00
johnnyq
29a0b3ead8 Replace Function fetchUpdates() with checkForUpdates() 2026-07-14 17:31:54 -04:00
johnnyq
b57ddc0e5c Replace Function sanitizeInput() with just escapeSql() and update all instances throughout 2026-07-14 17:17:50 -04:00
johnnyq
8da3a107fb Rename plugins to libs and update all file references 2026-07-10 13:24:20 -04:00
johnnyq
ae5c9fe8ec Mail Parser: Add logic when creating ITFlow folder to determine if the namespace is INBOX. or can be created in root directory. Fixes issue with CPanel Dovecot Maildir++ configuration where their namespace is just INBOX 2026-07-08 15:58:00 -04:00
johnnyq
171a0d38f8 Mail Parser: Completely remove Webklex IMAP and all dependcies 2026-06-24 13:39:07 -04:00
johnnyq
6e7d2b2d6a Invoice Late Overdue notices shows correct balance when late fees are attached and if partial invoice was paid 2026-06-24 13:07:52 -04:00
johnnyq
a819dff19a Mail: Update mail configuration check to use smtp_provider instead of smtp_host as host is blank upon using oath2 2026-06-24 12:47:41 -04:00
johnnyq
b1a5b34725 Do not send an inapp alert on successful cron execution, keep it in logging only 2026-06-23 18:22:20 -04:00
johnnyq
2204bd52f4 Rewrite email parser using ImapEngine, harden processing loop
Replace webklex/php-imap with directorytree/imapengine in the ticket
email parser. ImapEngine is pure PHP over sockets.

Parser improvements:
- Wrap per-message processing in try/catch so one malformed email
  can't abort the run; failures are flagged and logged with UID
- Query unseen + unflagged so previously-failed (flagged) messages
  are no longer re-processed on every cron run
- Skip vacation/auto-responder emails (RFC 3834) to prevent mail
  loops with the ticket auto-reply
- Cap messages per run (50) and attachment size (15MB); inline
  images over 2MB are stored as attachments instead of base64-embedded
  in ticket details
- Atomic lock file creation
- preg_quote() the ticket prefix in subject matching
- Dedupe CC watchers and exclude the sender
- Map webklex 'tls' encryption setting to STARTTLS for compatibility

NDR/DSN parsing now walks MIME parts via the underlying
zbateson parser instead of relying on attachment extraction.
2026-06-12 16:56:39 -04:00
wrongecho
163581cbcd Expire all PW reset tokens nightly with cron 2026-04-27 13:36:39 +01:00
johnnyq
e9c3ee4661 Shared Items via secure link: Do not delete shared items that have not been viewed before cron runs 2026-04-24 11:40:38 -04:00
johnnyq
6d1b654d0c Invoice: Do not apply late fee on first overdue reminder (day 1) 2026-03-20 17:44:33 -04:00
johnnyq
6122efc870 Updated all Queries related to invoice items to reflect their new tables quote, invoice, recurring invoice items 2026-03-07 19:35:44 -05:00
johnnyq
92fba49a91 Revert "Add new optional beta email parser thats based on ImapEngine instead of Webklex"
This reverts commit 9cb1ff7330.
2026-02-26 16:44:49 -05:00
johnnyq
ac4bb32081 Revert "Beta Mail Parser Add inline images as attachments keeps the DB clean"
This reverts commit 87fd23f443.
2026-02-26 16:44:39 -05:00
johnnyq
7927312f4f Revert "Revert "Beta Mail Parser Add inline images as attachments keeps the DB clean""
This reverts commit 04a74b5a34.
2026-02-26 16:41:50 -05:00
johnnyq
04a74b5a34 Revert "Beta Mail Parser Add inline images as attachments keeps the DB clean"
This reverts commit 87fd23f443.
2026-02-26 16:41:03 -05:00
johnnyq
87fd23f443 Beta Mail Parser Add inline images as attachments keeps the DB clean 2026-02-26 16:30:29 -05:00
johnnyq
9cb1ff7330 Add new optional beta email parser thats based on ImapEngine instead of Webklex 2026-02-26 16:11:49 -05:00