Invoices > Paid online). The team is notified either way (functions/card_expiry.php). * client_saved_payment_methods.saved_payment_checked_at - when the card was last read back from Stripe, which * keeps a card the bank replaced up to date. * client_saved_payment_methods.saved_payment_reminded_expiry and saved_payment_reminded - the expiry (yyyymm) * the reminders went out for, and which: 1 a month before, 2 in the month it runs out. A new expiry starts again. * client_saved_payment_methods.saved_payment_update_key - the key in the link the reminder sends, which opens * guest/guest_card_update.php for that card. Cleared once the card is replaced. * * Re-runnable: each column is made only where it isn't there. */ defined('FROM_DB_UPDATER') || die("Direct file access is not allowed"); $itflow_card_columns = [ ['settings', 'config_invoice_card_expiry_reminders', "tinyint(1) NOT NULL DEFAULT 1", 'config_invoice_offer_autopay'], ['client_saved_payment_methods', 'saved_payment_checked_at', "datetime DEFAULT NULL", 'saved_payment_updated_at'], ['client_saved_payment_methods', 'saved_payment_reminded_expiry', "int(11) DEFAULT NULL", 'saved_payment_checked_at'], ['client_saved_payment_methods', 'saved_payment_reminded', "tinyint(1) NOT NULL DEFAULT 0", 'saved_payment_reminded_expiry'], ['client_saved_payment_methods', 'saved_payment_update_key', "varchar(64) DEFAULT NULL", 'saved_payment_reminded'], ]; foreach ($itflow_card_columns as [$itflow_table, $itflow_column, $itflow_type, $itflow_after]) { $itflow_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_exists || mysqli_num_rows($itflow_exists) === 0) { $itflow_after_exists = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = '$itflow_table' AND COLUMN_NAME = '$itflow_after' LIMIT 1"); $itflow_place = $itflow_after_exists && mysqli_num_rows($itflow_after_exists) > 0 ? " AFTER `$itflow_after`" : ''; mysqli_query($mysqli, "ALTER TABLE `$itflow_table` ADD `$itflow_column` $itflow_type$itflow_place"); } }