mirror of
https://github.com/itflow-org/itflow
synced 2026-08-06 15:47:15 +00:00
Remove unused overdue invoice setting move master cron switch out of notificaiton and into cron
This commit is contained in:
@@ -13,7 +13,7 @@ $config_backup_retention_days = intval($row['config_backup_retention_days']);
|
||||
$config_backup_retention_count = intval($row['config_backup_retention_count']);
|
||||
$config_backup_cron_type = $row['config_backup_cron_type'];
|
||||
|
||||
// Same heartbeat rule as Settings > Cron - archives are built by the dispatcher, so a dead
|
||||
// Same heartbeat rule as Maintenance > Cron - archives are built by the dispatcher, so a dead
|
||||
// crontab means the buttons below queue work that never runs
|
||||
$cron_is_running = $cron_last_dispatch_at !== null && (time() - strtotime($cron_last_dispatch_at)) < 300;
|
||||
|
||||
@@ -51,12 +51,12 @@ if (!empty($_SESSION['backup_master_key_reveal'])) {
|
||||
<div class="alert alert-danger">
|
||||
<h5><i class="fas fa-fw fa-exclamation-triangle mr-2"></i>Cron is not running</h5>
|
||||
Backups are built by the cron dispatcher, not by your browser. Until cron is running, anything you
|
||||
start here will sit in the queue. See <a href="cron.php">Settings > Cron</a>.
|
||||
start here will sit in the queue. See <a href="cron.php">Maintenance > Cron</a>.
|
||||
</div>
|
||||
<?php } elseif ($config_enable_cron == 0) { ?>
|
||||
<div class="alert alert-warning">
|
||||
<i class="fas fa-fw fa-exclamation-circle mr-2"></i>Cron is switched off in
|
||||
<a href="settings_notification.php">Settings > Notifications</a>.
|
||||
<a href="cron.php">Maintenance > Cron</a>.
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
@@ -241,7 +241,7 @@ if (!empty($_SESSION['backup_master_key_reveal'])) {
|
||||
<?php } else { ?>
|
||||
<i class="fas fa-fw fa-times text-danger mr-2"></i>Scheduled backups are switched off.
|
||||
<?php } ?>
|
||||
Turn them on or change the time in <a href="cron.php">Settings > Cron</a>.
|
||||
Turn them on or change the time in <a href="cron.php">Maintenance > Cron</a>.
|
||||
</p>
|
||||
<p class="text-muted small mt-2 mb-0">
|
||||
Old backups are removed by the nightly job, never by the backup itself, so a failed nightly
|
||||
|
||||
@@ -54,10 +54,25 @@ while ($job_row = mysqli_fetch_assoc($sql)) {
|
||||
|
||||
<?php if ($config_enable_cron == 0) { ?>
|
||||
<div class="alert alert-warning">
|
||||
<i class="fas fa-fw fa-exclamation-circle mr-2"></i>Cron is switched off in
|
||||
<a href="settings_notification.php">Settings > Notifications</a>. The dispatcher is running, but most jobs
|
||||
stop themselves immediately while this is off.
|
||||
<div class="float-right">
|
||||
<a class="btn btn-sm btn-warning" href="post.php?enable_cron=1&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-power-off mr-2"></i>Turn cron on
|
||||
</a>
|
||||
</div>
|
||||
<h5><i class="fas fa-fw fa-exclamation-circle mr-2"></i>Cron is switched off</h5>
|
||||
The dispatcher is running, but every job below stops itself immediately while this is off -
|
||||
no mail is sent, no email becomes a ticket, and nothing is invoiced.
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<p class="text-muted">
|
||||
<small>
|
||||
<i class="fas fa-fw fa-power-off mr-1"></i>The master switch is <strong>on</strong>. Turning it off
|
||||
stops every job at once without touching their schedules, which is what you want on a restored
|
||||
backup or a staging clone - those come up with every job enabled and will otherwise email clients
|
||||
and charge cards. Switching back on returns you to exactly this configuration.
|
||||
<a href="post.php?disable_cron=1&csrf_token=<?= $_SESSION['csrf_token'] ?>">Turn cron off</a>.
|
||||
</small>
|
||||
</p>
|
||||
<?php } ?>
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
|
||||
|
||||
// The cron dispatcher's schedule moves out of code and into the database so it can be
|
||||
// managed from Settings > Cron. The registry in includes/cron_jobs.php still decides
|
||||
// managed from Maintenance > Cron. The registry in includes/cron_jobs.php still decides
|
||||
// which scripts exist and seeds these columns the first time it meets a job; from then
|
||||
// on the row is what runs. Nothing here can name a script - a row whose job is not in
|
||||
// the registry is ignored.
|
||||
|
||||
19
admin/database_updates/2.6.6.php
Normal file
19
admin/database_updates/2.6.6.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* ITFlow - Database update to version 2.6.6 (from 2.6.5)
|
||||
* Included by admin/database_updates.php - do not access directly
|
||||
*/
|
||||
|
||||
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
|
||||
|
||||
// config_invoice_overdue_reminders never did anything. Both setup paths seeded it with
|
||||
// '1,3,7' and two files read it, but the only line that would have used it was commented
|
||||
// out in the nightly job - the reminder schedule is a hardcoded array. The read in
|
||||
// includes/load_global_settings.php also ran intval() over a comma-separated string, so
|
||||
// the global was 1 whatever the column said.
|
||||
//
|
||||
// Nothing in the app has ever written to it either, so no install has a value worth
|
||||
// keeping and there is nothing to migrate anywhere.
|
||||
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` DROP COLUMN IF EXISTS `config_invoice_overdue_reminders`");
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -12,12 +12,6 @@ require_once "includes/inc_all_admin.php";
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" name="config_enable_cron" <?php if ($config_enable_cron == 1) { echo "checked"; } ?> value="1" id="enableCronSwitch">
|
||||
<label class="custom-control-label" for="enableCronSwitch">Enable Cron (recommended) <small>(several cron scripts must also be added to cron with correct schedules, <a href="https://docs.itflow.org/cron">docs</a>)</small></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead class="thead-dark">
|
||||
@@ -50,32 +44,6 @@ require_once "includes/inc_all_admin.php";
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<div><i class="fas fa-fw fa-lock mr-2"></i>Certificate Expiration Notice</div>
|
||||
<small class="text-muted">
|
||||
(This setting triggers a notification when a certificate is approaching its expiration date, specifically at 1, 7 and 45 days prior to expiry.)
|
||||
</small>
|
||||
</th>
|
||||
<td>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<div><i class="fas fa-fw fa-desktop mr-2"></i>Asset Warranty Expiration Notice</div>
|
||||
<small class="text-muted">
|
||||
(This setting triggers a notification when an asset is approaching its expiration date, specifically at 1, 7 and 45 days prior to expiry.)
|
||||
</small>
|
||||
</th>
|
||||
<td>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan=5>Billing</th>
|
||||
</tr>
|
||||
@@ -135,39 +103,6 @@ require_once "includes/inc_all_admin.php";
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<div><i class="fas fa-fw fa-link mr-2"></i>Shared Item View</div>
|
||||
<small class="text-secondary">(Notify when Shared items are viewed)</small>
|
||||
</th>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<div><i class="fas fa-fw fa-clock mr-2"></i>Cron Execution</div>
|
||||
<small class="text-secondary">(Notify when the nightly cron job ran)</small>
|
||||
</th>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<div><i class="fas fa-fw fa-download mr-2"></i>ITFlow Updates</div>
|
||||
<small class="text-secondary">(Notify when ITFlow has an update)</small>
|
||||
</th>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -33,7 +33,7 @@ require_once "includes/inc_all_admin.php";
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" name="config_ticket_email_parse" <?php if($config_ticket_email_parse == 1){ echo "checked"; } ?> value="1" id="emailToTicketParseSwitch">
|
||||
<label class="custom-control-label" for="emailToTicketParseSwitch">Email-to-ticket parsing <small class="text-secondary">(cron_ticket_email_parser.php must also be added to cron and run every few mins)</small></label>
|
||||
<label class="custom-control-label" for="emailToTicketParseSwitch">Email-to-ticket parsing <small class="text-secondary">(the Ticket Email Parser cron job must also be enabled - see <a href="cron.php">Maintenance > Cron</a>)</small></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user