Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
cf2c9c2
Let clients pay the card fee - turn on Clients pay the card fee on St…
johnnyq Nov 5, 2026
3143cdb
Fix phone numbers keeping the 0 dialled at home after the country cod…
johnnyq Nov 5, 2026
c11de9a
Drop the phone formats build script from scripts/ - it is a maintaine…
johnnyq Nov 5, 2026
d7bc1bc
Make Maintenance > Update easier to follow - it opens with where the …
johnnyq Nov 5, 2026
3b5c11c
Add managed mode, so one ITFlow can manage others - Admin > Managed I…
johnnyq Nov 5, 2026
1649db5
Add secure link sharing for the client IT documentation PDF: new Expo…
johnnyq Nov 5, 2026
294352f
Let the API raise a ticket from a ticket template - tickets/create ta…
johnnyq Nov 5, 2026
b5ceeb4
Bill sign-ups through the API and follow up when an invoice is paid -…
johnnyq Nov 6, 2026
87cdf79
Make managed mode off by default and turned on per side in config.php…
johnnyq Nov 6, 2026
b391e2c
Add Skyetel text messaging with two-way ticket texting, text to ticke…
johnnyq Nov 6, 2026
172cd49
Turn cron on by default for new installs so adding the cron job is th…
johnnyq Nov 6, 2026
79e6166
Set up a hosted instance and connect it in one command - Add Instance…
johnnyq Nov 6, 2026
2a36534
Add demo mode for a public demo like demo.itflow.org - $config_demo_m…
johnnyq Nov 6, 2026
53e6564
Stop row actions menus being cut off on short lists - a list's table …
johnnyq Nov 6, 2026
29a0b9b
Update Chnagelog
johnnyq Nov 7, 2026
1c741b8
Bump Version
johnnyq Nov 7, 2026
076f429
Bug fixes
johnnyq Nov 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Be precise about what it does, because it is easy to oversell. It is **not** a g

That last part is the reason it is not redundant with `cron_job_enabled`. Turning the switch off and back on returns you to exactly the configuration you had. Sweeping all seven rows off and back on does not: `backup` ships `'enabled' => 0`, so the sweep quietly turns on nightly backups nobody asked for, along with anything else that was deliberately disabled.

It defaults to `0`. That is a weaker guard than it looks — an install with no crontab entry runs nothing whatever the switch says, so the entry is the real gate — but it does mean adding the crontab line to a half-configured install is not enough on its own to start emailing. Both setup paths name the step on the way out.
It defaults to `1`. An install with no crontab entry runs nothing whatever the switch says, so the entry is the real gate, and a new install has nothing to email or charge until someone adds it. Shipping it off only added a second step that could be missed in silence. Database 3.6.2 changed the column's default and nothing else: an install that already has the switch off keeps it off, because turning it on would start late fees, overdue reminders and autopay retries it has stopped. Don't write a migration that flips the value itself.

## Backups

Expand All @@ -137,6 +137,13 @@ Every script in `cron/` still runs standalone (`php cron/mail_queue.php`) and st

---

## Demo mode

`$config_demo_mode = true;` in `config.php` makes an install a public demo, like demo.itflow.org (`functions/demo.php`). Two parts of it need you when you add a feature:

- **Locks go by request key.** `demoModeGuard()` refuses a `post.php` or `ajax.php` request carrying a key in `DEMO_MODE_LOCKS`: anything that would reach outside the install, cost money or lock other visitors out - users and roles, a visitor's own sign-in, the mail, payment, AI and texting providers, API keys, backups, updates, cron and share links. A new handler in one of those areas adds its key there, or it is open on the demo. Anything new that connects somewhere a visitor types needs the same thought; certificate checks go through `demoModePublicAddress()`. Pages under `/guest/` open only for a signed-in session (`demoModeGuestGuard()`, from `includes/load_global_settings.php`) - a new guest page has to load that file.
- **The nightly reset builds from the code.** The Demo Reset job (`demoModeReset()`) drops every table, loads `db.sql`, runs `seedDefaultData()`, loads every Starter Content pack and `demoDataLoad()`, and makes the demo accounts. What you add to those is in the demo the next morning, and the demo never needs a database update. They all have to work without a request: the reset runs from cron, with the vault opened in-process and `$session_user_id` set to the demo admin.

## Security rules (non-negotiable)

ITFlow does not use prepared statements or an ORM; queries are built as strings. That works **only** if every value is neutralized before interpolation. The rules:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Ticketing, client documentation, contracts and billing - with a client portal -

[**Live demo**](https://demo.itflow.org)  ·  [Website](https://itflow.org)  ·  [Docs](https://docs.itflow.org)  ·  [Forum](https://forum.itflow.org)  ·  [What's new](CHANGELOG.md)

Demo sign in: `demo@demo.com` / `demo`
Sign in to the demo with one click as an admin, technician, accountant or client portal contact

</div>

Expand Down
33 changes: 33 additions & 0 deletions admin/database_updates/3.5.6.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/*
* ITFlow - Database update to version 3.5.6 (from 3.5.5)
* Included by admin/database_updates.php - do not access directly
*
* Clients can pay the card fee. On the Stripe payment provider:
* payment_provider_card_fee turns it on, and payment_provider_card_fee_percent
* and payment_provider_card_fee_fixed are what Stripe charges on a card
* payment. On a client, client_card_fee_exempt lets them off it. All start
* off, so nothing changes until it is turned on.
*
* Re-runnable: each column is added only where it isn't there yet.
*/

defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");

$itflow_new_columns = [
['payment_providers', 'payment_provider_card_fee', "TINYINT(1) NOT NULL DEFAULT 0 AFTER `payment_provider_expense_category`"],
['payment_providers', 'payment_provider_card_fee_percent', "DECIMAL(5,2) NOT NULL DEFAULT 0.00 AFTER `payment_provider_card_fee`"],
['payment_providers', 'payment_provider_card_fee_fixed', "DECIMAL(15,2) NOT NULL DEFAULT 0.00 AFTER `payment_provider_card_fee_percent`"],
['clients', 'client_card_fee_exempt', "TINYINT(1) NOT NULL DEFAULT 0 AFTER `client_tax_exempt_expires`"],
];

foreach ($itflow_new_columns as [$itflow_table, $itflow_column, $itflow_definition]) {
$itflow_column_exists = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = '$itflow_table' AND COLUMN_NAME = '$itflow_column' LIMIT 1");
if (!$itflow_column_exists || mysqli_num_rows($itflow_column_exists) === 0) {
mysqli_query($mysqli, "ALTER TABLE `$itflow_table` ADD `$itflow_column` $itflow_definition");
}
}

unset($itflow_new_columns, $itflow_table, $itflow_column, $itflow_definition, $itflow_column_exists);
24 changes: 24 additions & 0 deletions admin/database_updates/3.5.7.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/*
* ITFlow - Database update to version 3.5.7 (from 3.5.6)
* Included by admin/database_updates.php - do not access directly
*
* settings.config_update_details - what the update check found besides the commits, as JSON:
* the version the update brings, the changelog between this install and it, and the files
* this install has changed that updating would put back. Written by cron/update_check.php,
* read by Maintenance > Update.
*
* Re-runnable: skipped where the column is already there.
*/

defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");

$itflow_column_exists = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'settings' AND COLUMN_NAME = 'config_update_details' LIMIT 1");

if (!$itflow_column_exists || mysqli_num_rows($itflow_column_exists) === 0) {
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_update_details` MEDIUMTEXT DEFAULT NULL AFTER `config_update_checked_at`");
}

unset($itflow_column_exists);
80 changes: 80 additions & 0 deletions admin/database_updates/3.5.8.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

/*
* ITFlow - Database update to version 3.5.8 (from 3.5.7)
* Included by admin/database_updates.php - do not access directly
*
* Managed mode - one ITFlow managing others (functions/managed.php).
*
* As a manager: managed_instances, the instances it manages and what it sets for each;
* managed_instance_commands, what it has asked of them; settings.config_manager_keys, the
* key pair it signs support sign-ins with.
*
* As a managed instance: settings.config_managed, its manager and what the manager set.
*
* Re-runnable: each table and column is made only where it isn't there yet.
*/

defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");

mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS `managed_instances` (
`managed_instance_id` int(11) NOT NULL AUTO_INCREMENT,
`managed_instance_uuid` varchar(36) NOT NULL,
`managed_instance_name` varchar(200) NOT NULL,
`managed_instance_client_id` int(11) NOT NULL DEFAULT 0,
`managed_instance_notes` text DEFAULT NULL,
`managed_instance_enroll_hash` varchar(64) DEFAULT NULL,
`managed_instance_enroll_expires_at` datetime DEFAULT NULL,
`managed_instance_secret_hash` varchar(64) DEFAULT NULL,
`managed_instance_enrolled_at` datetime DEFAULT NULL,
`managed_instance_url` varchar(255) DEFAULT NULL,
`managed_instance_mode` varchar(20) NOT NULL DEFAULT 'active',
`managed_instance_mode_message` varchar(500) DEFAULT NULL,
`managed_instance_seat_limit` int(11) NOT NULL DEFAULT 0,
`managed_instance_white_label_key` text DEFAULT NULL,
`managed_instance_update_policy` varchar(20) NOT NULL DEFAULT 'manual',
`managed_instance_update_delay_days` int(11) NOT NULL DEFAULT 7,
`managed_instance_version` varchar(20) DEFAULT NULL,
`managed_instance_db_version` varchar(20) DEFAULT NULL,
`managed_instance_update_version` varchar(40) DEFAULT NULL,
`managed_instance_update_seen_at` datetime DEFAULT NULL,
`managed_instance_report` mediumtext DEFAULT NULL,
`managed_instance_last_checkin_at` datetime DEFAULT NULL,
`managed_instance_last_ip` varchar(45) DEFAULT NULL,
`managed_instance_offline_notified_at` datetime DEFAULT NULL,
`managed_instance_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`managed_instance_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`managed_instance_archived_at` datetime DEFAULT NULL,
PRIMARY KEY (`managed_instance_id`),
UNIQUE KEY `managed_instance_uuid` (`managed_instance_uuid`),
KEY `managed_instance_client_id` (`managed_instance_client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci");

mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS `managed_instance_commands` (
`managed_command_id` int(11) NOT NULL AUTO_INCREMENT,
`managed_command_instance_id` int(11) NOT NULL,
`managed_command` varchar(40) NOT NULL,
`managed_command_status` varchar(20) NOT NULL DEFAULT 'queued',
`managed_command_source` varchar(20) NOT NULL DEFAULT 'manual',
`managed_command_requested_by` varchar(200) DEFAULT NULL,
`managed_command_result` varchar(1000) DEFAULT NULL,
`managed_command_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`managed_command_sent_at` datetime DEFAULT NULL,
`managed_command_done_at` datetime DEFAULT NULL,
PRIMARY KEY (`managed_command_id`),
KEY `managed_command_instance_id` (`managed_command_instance_id`, `managed_command_status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci");

// In db.sql's order: config_update_details, config_manager_keys, config_managed
foreach ([
'config_manager_keys' => "TEXT DEFAULT NULL AFTER `config_update_details`",
'config_managed' => "MEDIUMTEXT DEFAULT NULL AFTER `config_manager_keys`",
] as $itflow_column => $itflow_definition) {
$itflow_column_exists = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'settings' AND COLUMN_NAME = '$itflow_column' LIMIT 1");
if (!$itflow_column_exists || mysqli_num_rows($itflow_column_exists) === 0) {
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `$itflow_column` $itflow_definition");
}
}

unset($itflow_column, $itflow_definition, $itflow_column_exists);
22 changes: 22 additions & 0 deletions admin/database_updates/3.5.9.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* ITFlow - Database update to version 3.5.9 (from 3.5.8)
* Included by admin/database_updates.php - do not access directly
*
* settings.config_invoice_paid_lead_to_client - a lead that pays an invoice in full
* becomes a client (invoicePaidFollowUp(), functions/billing.php). On by default:
* a lead that pays is a client.
*
* Re-runnable: the column is made only where it isn't there yet.
*/

defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");

$itflow_column_exists = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'settings' AND COLUMN_NAME = 'config_invoice_paid_lead_to_client' LIMIT 1");
if (!$itflow_column_exists || mysqli_num_rows($itflow_column_exists) === 0) {
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_invoice_paid_lead_to_client` tinyint(1) NOT NULL DEFAULT 1 AFTER `config_invoice_paid_notification_email`");
}

unset($itflow_column_exists);
91 changes: 91 additions & 0 deletions admin/database_updates/3.6.0.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

/*
* ITFlow - Database update to version 3.6.0 (from 3.5.9)
* Included by admin/database_updates.php - do not access directly
*
* Text messaging (functions/sms.php):
* sms_providers - the texting service ITFlow sends and receives through (Skyetel), its
* keys, the number it texts from and the key in its inbound address
* sms_messages - every text sent and received, and what came of it: queued, sent or failed
* going out; on a ticket, in the Texts inbox (unmatched, a code, spam) or a keyword coming in
* sms_numbers - what is known about a number: a name for it, whether it replied STOP, and
* whether it is blocked as spam
* settings.config_ticket_sms_parse, config_ticket_sms_unknown_senders, config_ticket_sms_acknowledge -
* Settings > Tickets > Text to ticket
*
* Re-runnable: each table and column is made only where it isn't there yet.
*/

defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");

mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS `sms_providers` (
`sms_provider_id` int(11) NOT NULL AUTO_INCREMENT,
`sms_provider_name` varchar(100) NOT NULL,
`sms_provider_description` varchar(255) DEFAULT NULL,
`sms_provider_username` varchar(255) NOT NULL DEFAULT '',
`sms_provider_secret` varchar(500) NOT NULL DEFAULT '',
`sms_provider_number` varchar(20) NOT NULL DEFAULT '',
`sms_provider_inbound_key` varchar(64) NOT NULL DEFAULT '',
`sms_provider_active` tinyint(1) NOT NULL DEFAULT 1,
`sms_provider_last_inbound_at` datetime DEFAULT NULL,
`sms_provider_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`sms_provider_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`sms_provider_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci");

mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS `sms_messages` (
`sms_message_id` int(11) NOT NULL AUTO_INCREMENT,
`sms_message_direction` varchar(3) NOT NULL,
`sms_message_status` varchar(20) NOT NULL,
`sms_message_number` varchar(20) NOT NULL,
`sms_message_our_number` varchar(20) NOT NULL DEFAULT '',
`sms_message_body` text DEFAULT NULL,
`sms_message_media` text DEFAULT NULL,
`sms_message_code` varchar(20) DEFAULT NULL,
`sms_message_purpose` varchar(30) NOT NULL DEFAULT '',
`sms_message_attempts` tinyint(4) NOT NULL DEFAULT 0,
`sms_message_error` varchar(500) DEFAULT NULL,
`sms_message_provider_ref` varchar(100) DEFAULT NULL,
`sms_message_contact_id` int(11) NOT NULL DEFAULT 0,
`sms_message_client_id` int(11) NOT NULL DEFAULT 0,
`sms_message_ticket_id` int(11) NOT NULL DEFAULT 0,
`sms_message_ticket_reply_id` int(11) NOT NULL DEFAULT 0,
`sms_message_user_id` int(11) NOT NULL DEFAULT 0,
`sms_message_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`sms_message_attempted_at` datetime DEFAULT NULL,
`sms_message_sent_at` datetime DEFAULT NULL,
`sms_message_handled_at` datetime DEFAULT NULL,
`sms_message_handled_by` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`sms_message_id`),
KEY `sms_message_status` (`sms_message_status`,`sms_message_id`),
KEY `sms_message_number` (`sms_message_number`,`sms_message_created_at`),
KEY `sms_message_ticket_id` (`sms_message_ticket_id`),
KEY `sms_message_created_at` (`sms_message_created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci");

mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS `sms_numbers` (
`sms_number_phone` varchar(20) NOT NULL,
`sms_number_label` varchar(100) DEFAULT NULL,
`sms_number_opted_out_at` datetime DEFAULT NULL,
`sms_number_blocked_at` datetime DEFAULT NULL,
`sms_number_blocked_by` int(11) NOT NULL DEFAULT 0,
`sms_number_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`sms_number_phone`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci");

// Settings > Tickets > Text to ticket - after the email-to-ticket switches, in the order the page shows them
$itflow_sms_settings = [
'config_ticket_sms_parse' => "tinyint(1) NOT NULL DEFAULT 1 AFTER `config_ticket_email_parse_unknown_senders`",
'config_ticket_sms_unknown_senders' => "tinyint(1) NOT NULL DEFAULT 0 AFTER `config_ticket_sms_parse`",
'config_ticket_sms_acknowledge' => "tinyint(1) NOT NULL DEFAULT 1 AFTER `config_ticket_sms_unknown_senders`",
];
foreach ($itflow_sms_settings as $itflow_sms_column => $itflow_sms_definition) {
$itflow_column_exists = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'settings' AND COLUMN_NAME = '$itflow_sms_column' LIMIT 1");
if (!$itflow_column_exists || mysqli_num_rows($itflow_column_exists) === 0) {
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `$itflow_sms_column` $itflow_sms_definition");
}
}

unset($itflow_sms_settings, $itflow_sms_column, $itflow_sms_definition, $itflow_column_exists);
Loading
Loading