Enable domain expire alerts and send invoice reminders did not respect their settings it would still execute as long as cron was executing, updated the desription of the options as well

This commit is contained in:
johnnyq
2023-10-20 18:38:48 -04:00
parent 509a955277
commit fcfb162ec8
3 changed files with 110 additions and 114 deletions
+11
View File
@@ -32,6 +32,8 @@ $config_invoice_from_email = $row['config_invoice_from_email'];
$config_invoice_from_name = $row['config_invoice_from_name']; $config_invoice_from_name = $row['config_invoice_from_name'];
$config_invoice_late_fee_enable = intval($row['config_invoice_late_fee_enable']); $config_invoice_late_fee_enable = intval($row['config_invoice_late_fee_enable']);
$config_invoice_late_fee_percent = floatval($row['config_invoice_late_fee_percent']); $config_invoice_late_fee_percent = floatval($row['config_invoice_late_fee_percent']);
// Mail Settings
$config_smtp_host = $row['config_smtp_host']; $config_smtp_host = $row['config_smtp_host'];
$config_smtp_username = $row['config_smtp_username']; $config_smtp_username = $row['config_smtp_username'];
$config_smtp_password = $row['config_smtp_password']; $config_smtp_password = $row['config_smtp_password'];
@@ -58,6 +60,10 @@ $config_module_enable_ticketing = intval($row['config_module_enable_ticketing'])
$config_module_enable_accounting = $row['config_module_enable_accounting']; $config_module_enable_accounting = $row['config_module_enable_accounting'];
$config_telemetry = intval($row['config_telemetry']); $config_telemetry = intval($row['config_telemetry']);
// Alerts
$config_enable_alert_domain_expire = intval($row['config_enable_alert_domain_expire']);
$config_send_invoice_reminders = intval($row['config_send_invoice_reminders']);
// Set Currency Format // Set Currency Format
$currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY); $currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY);
@@ -121,6 +127,8 @@ mysqli_query($mysqli, "DELETE FROM email_queue WHERE email_queued_at < CURDATE()
// DOMAINS EXPIRING // DOMAINS EXPIRING
if($config_enable_alert_domain_expire == 1){
$domainAlertArray = [1,7,14,30,90,120]; $domainAlertArray = [1,7,14,30,90,120];
foreach ($domainAlertArray as $day) { foreach ($domainAlertArray as $day) {
@@ -147,6 +155,7 @@ foreach ($domainAlertArray as $day) {
} }
// Logging // Logging
//mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for domain expiring'"); //mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for domain expiring'");
}
// CERTIFICATES EXPIRING // CERTIFICATES EXPIRING
@@ -404,6 +413,7 @@ if ($config_ticket_autoclose == 1) {
} }
} }
if ($config_send_invoice_reminders == 1) {
// PAST DUE INVOICE Notifications // PAST DUE INVOICE Notifications
//$invoiceAlertArray = [$config_invoice_overdue_reminders]; //$invoiceAlertArray = [$config_invoice_overdue_reminders];
@@ -490,6 +500,7 @@ foreach ($invoiceAlertArray as $day) {
} }
} }
}
// Logging // Logging
//mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for past due invoices and sent out notifications to the primary contacts email'"); //mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for past due invoices and sent out notifications to the primary contacts email'");
+1 -2
View File
@@ -300,9 +300,8 @@ if (isset($_POST['edit_alert_settings'])) {
$config_cron_key = sanitizeInput($_POST['config_cron_key']); $config_cron_key = sanitizeInput($_POST['config_cron_key']);
$config_enable_alert_domain_expire = intval($_POST['config_enable_alert_domain_expire']); $config_enable_alert_domain_expire = intval($_POST['config_enable_alert_domain_expire']);
$config_send_invoice_reminders = intval($_POST['config_send_invoice_reminders']); $config_send_invoice_reminders = intval($_POST['config_send_invoice_reminders']);
$config_invoice_overdue_reminders = sanitizeInput($_POST['config_invoice_overdue_reminders']);
mysqli_query($mysqli,"UPDATE settings SET config_send_invoice_reminders = $config_send_invoice_reminders, config_invoice_overdue_reminders = '$config_invoice_overdue_reminders', config_enable_cron = $config_enable_cron, config_enable_alert_domain_expire = $config_enable_alert_domain_expire WHERE company_id = 1"); mysqli_query($mysqli,"UPDATE settings SET config_send_invoice_reminders = $config_send_invoice_reminders, config_enable_cron = $config_enable_cron, config_enable_alert_domain_expire = $config_enable_alert_domain_expire WHERE company_id = 1");
//Logging //Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name modified alert settings', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name modified alert settings', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
+2 -16
View File
@@ -32,31 +32,17 @@ require_once "inc_all_settings.php";
<div class="form-group"> <div class="form-group">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" name="config_enable_alert_domain_expire" <?php if ($config_enable_alert_domain_expire == 1) { echo "checked"; } ?> value="1" id="alertDomainExpireSwitch"> <input type="checkbox" class="custom-control-input" name="config_enable_alert_domain_expire" <?php if ($config_enable_alert_domain_expire == 1) { echo "checked"; } ?> value="1" id="alertDomainExpireSwitch">
<label class="custom-control-label" for="alertDomainExpireSwitch">Enable Domain Expiration Alerts</label> <label class="custom-control-label" for="alertDomainExpireSwitch">Enable Domain Expiration Alerts <small>(This setting triggers a notification when a domain is approaching its expiration date, specifically at 1, 7, 14, 30, 90, and 120 days prior to expiry.)</small></label>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" name="config_send_invoice_reminders" <?php if ($config_send_invoice_reminders == 1) { echo "checked"; } ?> value="1" id="sendInvoiceRemindersSwitch"> <input type="checkbox" class="custom-control-input" name="config_send_invoice_reminders" <?php if ($config_send_invoice_reminders == 1) { echo "checked"; } ?> value="1" id="sendInvoiceRemindersSwitch">
<label class="custom-control-label" for="sendInvoiceRemindersSwitch">Send Invoice Reminders</label> <label class="custom-control-label" for="sendInvoiceRemindersSwitch">Email Invoice Reminders <small>(This will automatically dispatch a reminder email for the invoice to the primary contact's email every 30 days following the invoice's due date.)</small></label>
</div> </div>
</div> </div>
<?php if ($config_send_invoice_reminders == 1) { ?>
<div class="form-group">
<label>Overdue Reminders</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-bell"></i></span>
</div>
<input type="text" class="form-control" name="config_invoice_overdue_reminders" placeholder="Send After Due Days" value="<?php echo nullable_htmlentities($config_invoice_overdue_reminders); ?>">
</div>
</div>
<?php } ?>
<hr> <hr>
<button type="submit" name="edit_alert_settings" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button> <button type="submit" name="edit_alert_settings" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>