Remove unused overdue invoice setting move master cron switch out of notificaiton and into cron

This commit is contained in:
johnnyq
2026-08-02 17:22:28 -04:00
parent ad15fabbb3
commit a27019511e
23 changed files with 154 additions and 114 deletions

View File

@@ -26,7 +26,7 @@ if (isset($_GET['queue_backup'])) {
$cron_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT config_enable_cron FROM settings WHERE company_id = 1"));
if (intval($cron_row['config_enable_cron']) === 0) {
flashAlert(backupTypeLabel($type) . " queued, but cron is switched off in Settings > Notifications, so it will not start until that is enabled.", 'error');
flashAlert(backupTypeLabel($type) . " queued, but cron is switched off in Maintenance > Cron, so it will not start until that is enabled.", 'error');
} else {
flashAlert(backupTypeLabel($type) . " queued - it will start within a minute and you will be notified when it is ready.");
}

View File

@@ -3,11 +3,32 @@
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
/*
* Settings > Cron. Everything here identifies a job by its row, and every row is checked
* against the registry in includes/cron_jobs.php before anything is written - the database
* decides when and whether a job runs, never which file the dispatcher executes.
* Maintenance > Cron. Apart from the master switch, everything here identifies a job by its
* row, and every row is checked against the registry in includes/cron_jobs.php before
* anything is written - the database decides when and whether a job runs, never which file
* the dispatcher executes.
*/
if (isset($_GET['enable_cron']) || isset($_GET['disable_cron'])) {
validateCSRFToken();
// The master switch, config_enable_cron. Most jobs check it themselves and stop; it is
// not a dispatcher-level gate, so the two jobs that do not check it keep running. It
// lived in Settings > Notifications until 26.08, which is nowhere near anything else
// about cron.
$enabled = isset($_GET['enable_cron']) ? 1 : 0;
mysqli_query($mysqli, "UPDATE settings SET config_enable_cron = $enabled WHERE company_id = 1");
logAudit("Cron", "Edit", "$session_name " . ($enabled ? 'enabled' : 'disabled') . " the master cron switch");
flashAlert("Cron " . ($enabled ? 'enabled' : 'disabled') . ".", $enabled ? 'success' : 'error');
redirect();
}
if (isset($_POST['edit_cron_job'])) {
validateCSRFToken();

View File

@@ -6,13 +6,15 @@ if (isset($_POST['edit_notification_settings'])) {
validateCSRFToken();
$config_enable_cron = intval($_POST['config_enable_cron'] ?? 0);
// config_enable_cron is NOT set here - the master cron switch moved to Maintenance > Cron
// in 26.08. Leaving it in this UPDATE would switch cron off every time somebody saved
// this form, because the checkbox that fed it is gone from the page.
$config_enable_alert_domain_expire = intval($_POST['config_enable_alert_domain_expire'] ?? 0);
$config_send_invoice_reminders = intval($_POST['config_send_invoice_reminders'] ?? 0);
$config_recurring_auto_send_invoice = intval($_POST['config_recurring_auto_send_invoice'] ?? 0);
$config_ticket_client_general_notifications = intval($_POST['config_ticket_client_general_notifications'] ?? 0);
mysqli_query($mysqli,"UPDATE settings SET config_send_invoice_reminders = $config_send_invoice_reminders, config_recurring_auto_send_invoice = $config_recurring_auto_send_invoice, config_enable_cron = $config_enable_cron, config_enable_alert_domain_expire = $config_enable_alert_domain_expire, config_ticket_client_general_notifications = $config_ticket_client_general_notifications WHERE company_id = 1");
mysqli_query($mysqli,"UPDATE settings SET config_send_invoice_reminders = $config_send_invoice_reminders, config_recurring_auto_send_invoice = $config_recurring_auto_send_invoice, config_enable_alert_domain_expire = $config_enable_alert_domain_expire, config_ticket_client_general_notifications = $config_ticket_client_general_notifications WHERE company_id = 1");
logAudit("Settings", "Edit", "$session_name edited notification settings");