Update besar apk finance
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Tenantschemacheck extends CI_Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if (!$this->input->is_cli_request()) show_404();
|
||||
$tables = array(
|
||||
'accounts','journals','journal_details','accounting_periods','fiscal_years',
|
||||
'document_sequences','system_account_mappings','customers','invoices','payments',
|
||||
'suppliers','purchase_orders','supplier_invoices','supplier_payments','items',
|
||||
'warehouses','assets','cash_accounts','cash_transactions','k_employees',
|
||||
'k_payroll_periods','k_payrolls','tax_codes','tax_transactions','business_dimensions',
|
||||
'budgets','budget_lines','budget_revisions','saved_report_filters',
|
||||
'report_export_jobs','report_snapshots','closing_checklists','exchange_rates',
|
||||
'fx_revaluations','intercompany_transactions','user_companies'
|
||||
);
|
||||
$missingTables = array();
|
||||
$missingColumns = array();
|
||||
$nullRows = array();
|
||||
foreach ($tables as $table) {
|
||||
if (!$this->db->table_exists($table)) {$missingTables[]=$table;continue;}
|
||||
if (!$this->db->field_exists('company_id',$table)) {$missingColumns[]=$table;continue;}
|
||||
$count=(int)$this->db->where('company_id IS NULL',null,false)->count_all_results($table);
|
||||
if ($count) $nullRows[$table]=$count;
|
||||
}
|
||||
$result=array('missing_tables'=>$missingTables,'missing_company_id'=>$missingColumns,'null_company_rows'=>$nullRows,'status'=>!$missingTables&&!$missingColumns&&!$nullRows?'ok':'failed');
|
||||
echo json_encode($result,JSON_PRETTY_PRINT).PHP_EOL;
|
||||
if($result['status']!=='ok')exit(1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user