23 lines
740 B
PHP
23 lines
740 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once dirname(__DIR__) . '/config.php';
|
|
require_once dirname(__DIR__, 2) . '/includes/accounting_helper.php';
|
|
|
|
if (function_exists('ensureAccountingSchema')) {
|
|
ensureAccountingSchema();
|
|
}
|
|
|
|
$added = function_exists('seedDefaultAccountingAccounts') ? seedDefaultAccountingAccounts() : 0;
|
|
$total = 0;
|
|
|
|
try {
|
|
$total = (int) db()->query('SELECT COUNT(*) FROM acc_accounts')->fetchColumn();
|
|
} catch (Throwable $e) {
|
|
error_log('Chart of accounts count failed: ' . $e->getMessage());
|
|
}
|
|
|
|
echo $added > 0
|
|
? sprintf('Chart of accounts seeded successfully. Added %d account(s); total is now %d.', $added, $total)
|
|
: sprintf('Chart of accounts already up to date. Total accounts: %d.', $total);
|