Files
itflow/admin/database_updates/3.0.6.php
johnnyq 47969cd3c2 Income Import Deposits: bring the money in on a bank statement in as payments on invoices, other income or transfers from the Income list's menu, reading the same CSV as the expense statement import with the columns kept on the account for both sides and a link from each side's review to the other without uploading again; each deposit is matched by an invoice number in its text or reference, the payer remembered from last time, a client's name in it, the only invoice or the oldest of one client's invoices owing the amount or everything one client owes together, a payment provider payout or a transfer from another account, and anything else as other income for a category and client; payments pay the client's oldest invoices first with one deposit paying several and a short one leaving the last part paid, picking a client ticks the invoices it pays and each line says what it pays off, two deposits on one invoice don't pay it twice and more than they owe blocks the import; deposits imported before are locked, ones matching a payment, other income, transfer or a day's payments entered by hand within 4 days are left out and linked when left out, and a payout into the payment provider's own account counts as recorded; every ticked deposit is checked before any is saved, invoices get their status and history, receipts can be emailed, the payment method is read from the text, and payments and other income say they came from a bank statement on their quick look; payments need write Sales access and client scope applies; remembered payers window with forget; the statement columns step moved to a shared include and the sign guess now reads deposit and charge words on the lines; new functions/income_import.php, agent/income_import.php, js/income_import.js and agent/post/income_import.php; database 3.0.6 adds payment_import_key, revenue_import_key and the income_import_rules table; CHANGELOG updated
2026-10-16 21:44:14 -04:00

37 lines
1.9 KiB
PHP

<?php
/*
* ITFlow - Database update to version 3.0.6 (from 3.0.5)
* Included by admin/database_updates.php - do not access directly
*/
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
// Deposits brought in from a bank statement (functions/income_import.php)
// keep the key of the line they came from, so the same statement can't
// bring them in twice - as payments on invoices, or as other income and
// the money coming in from a transfer
mysqli_query($mysqli, "ALTER TABLE `payments`
ADD COLUMN `payment_import_key` varchar(64) DEFAULT NULL AFTER `payment_invoice_id`,
ADD KEY `payment_import_key` (`payment_import_key`)");
mysqli_query($mysqli, "ALTER TABLE `revenues`
ADD COLUMN `revenue_import_key` varchar(64) DEFAULT NULL AFTER `revenue_created_by`,
ADD KEY `revenue_import_key` (`revenue_import_key`)");
// Who a deposit is from - what was picked for a payer last time (a
// payment from a client, other income in a category, or a transfer from
// one of our accounts), matched on the start of its cleaned-up text
mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS `income_import_rules` (
`import_rule_id` int(11) NOT NULL AUTO_INCREMENT,
`import_rule_match` varchar(200) NOT NULL,
`import_rule_action` varchar(10) NOT NULL DEFAULT 'income',
`import_rule_client_id` int(11) NOT NULL DEFAULT 0,
`import_rule_category_id` int(11) NOT NULL DEFAULT 0,
`import_rule_account_id` int(11) NOT NULL DEFAULT 0,
`import_rule_used_count` int(11) NOT NULL DEFAULT 0,
`import_rule_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`import_rule_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`import_rule_id`),
UNIQUE KEY `import_rule_match` (`import_rule_match`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci");