Autopay offered to clients: database 4.3.7 adds settings.config_invoice_offer_autopay and recurring_invoices.recurring_invoice_offer_autopay, an invoice from a recurring invoice with no autopay offers Set up autopay in its email and on its guest and portal pages, guest/guest_autopay.php sets it up with no sign-in through a Stripe Checkout Session in setup mode (name, email and agreement kept in its metadata and the recurring invoice's history), the card is saved and autopay turned on when Stripe sends them back, agents are told and the client gets a confirmation, the portal turns it on with a saved card, Settings > Invoices and each recurring invoice's Autopay card can turn the offer off; 26.12.3 changelog

This commit is contained in:
johnnyq
2026-12-01 14:55:29 -05:00
parent 0b770dcdf0
commit 25dac4cee2
19 changed files with 872 additions and 6 deletions

View File

@@ -0,0 +1,32 @@
<?php
/*
* ITFlow - Database update to version 4.3.7 (from 4.3.6)
* Included by admin/database_updates.php - do not access directly
*
* settings.config_invoice_offer_autopay - whether an invoice from a recurring invoice with no autopay offers the
* client a Set up autopay button, in its email and on its page (1, Settings > Invoices > Paid online), when
* card payments are on. The button opens a page that needs no sign-in: the client agrees, adds a card through
* Stripe, and each invoice from then on is charged on its due date.
* recurring_invoices.recurring_invoice_offer_autopay - the same for one recurring invoice (1), turned off on its
* page for a client who pays another way.
*
* Both start on. Re-runnable: each column is made only where it isn't there.
*/
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
$itflow_offer_columns = [
'settings' => ['config_invoice_offer_autopay', 'config_invoice_paid_lead_to_client'],
'recurring_invoices' => ['recurring_invoice_offer_autopay', 'recurring_invoice_email_notify'],
];
foreach ($itflow_offer_columns as $itflow_table => [$itflow_column, $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` tinyint(1) NOT NULL DEFAULT 1$itflow_place");
}
}