From c53e944d52c589f88489529a59ef739aad4ac615 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 3 May 2026 04:30:55 +0000 Subject: [PATCH] splitting pages and final touch --- ai/LocalAIApi.php | 50 +- ai_debug.log | 1 - cookies.txt | 5 - cookies_debug.txt | 5 - cookies_repro.txt | 5 - cookies_verify.txt | 5 - debug.log | 138 - debug_accounting.php | 18 - debug_items.php | 17 - fix_accounting_bug.php | 51 - fix_duplicates.php | 30 - fix_forms.py | 149 - fix_index_py.py | 58 - fix_login_dup.php | 11 - fix_payment_query.php | 16 - fix_schema.php | 30 - fix_ui_typo.php | 2 - fix_users_table.php | 36 - index.php | 3699 +--- index.php.bak | 14185 ---------------- index.php.bak.20260319 | 13632 --------------- login_debug.log | 7 - output_test.html | 5074 ------ pages/avery_label_script.php | 152 + pages/barcode_pos_script.php | 196 + pages/language_dashboard_script.php | 110 + pages/lpo_quotation_script.php | 379 + pages/register_session_report_script.php | 20 + ...sales_purchases_invoice_actions_script.php | 223 + .../sales_purchases_invoice_form_helpers.php | 155 + pages/sales_purchases_modals.php | 1117 ++ ...sales_purchases_payment_receipt_script.php | 158 + pages/sales_purchases_print_script.php | 181 + pages/sales_purchases_print_view.php | 237 + pages/sales_purchases_save_logic.php | 179 + pages/users_role_permissions_script.php | 35 + post_debug.log | 190 - repair_timezone.py | 10 - search_debug.log | 7 - simulate_import.php | 44 - test_accounting_page.php | 24 - test_ai_config.php | 9 - test_db.php | 22 - test_import.csv | 3 - test_search.php | 15 - 45 files changed, 3715 insertions(+), 36975 deletions(-) delete mode 100644 ai_debug.log delete mode 100644 cookies.txt delete mode 100644 cookies_debug.txt delete mode 100644 cookies_repro.txt delete mode 100644 cookies_verify.txt delete mode 100644 debug.log delete mode 100644 debug_accounting.php delete mode 100644 debug_items.php delete mode 100644 fix_accounting_bug.php delete mode 100644 fix_duplicates.php delete mode 100644 fix_forms.py delete mode 100644 fix_index_py.py delete mode 100644 fix_login_dup.php delete mode 100644 fix_payment_query.php delete mode 100644 fix_schema.php delete mode 100644 fix_ui_typo.php delete mode 100644 fix_users_table.php delete mode 100644 index.php.bak delete mode 100644 index.php.bak.20260319 delete mode 100644 login_debug.log delete mode 100644 output_test.html create mode 100644 pages/avery_label_script.php create mode 100644 pages/barcode_pos_script.php create mode 100644 pages/language_dashboard_script.php create mode 100644 pages/lpo_quotation_script.php create mode 100644 pages/register_session_report_script.php create mode 100644 pages/sales_purchases_invoice_actions_script.php create mode 100644 pages/sales_purchases_invoice_form_helpers.php create mode 100644 pages/sales_purchases_modals.php create mode 100644 pages/sales_purchases_payment_receipt_script.php create mode 100644 pages/sales_purchases_print_script.php create mode 100644 pages/sales_purchases_print_view.php create mode 100644 pages/sales_purchases_save_logic.php create mode 100644 pages/users_role_permissions_script.php delete mode 100644 post_debug.log delete mode 100644 repair_timezone.py delete mode 100644 search_debug.log delete mode 100644 simulate_import.php delete mode 100644 test_accounting_page.php delete mode 100644 test_ai_config.php delete mode 100644 test_db.php delete mode 100644 test_import.csv delete mode 100644 test_search.php diff --git a/ai/LocalAIApi.php b/ai/LocalAIApi.php index 8c970bd..dc69892 100644 --- a/ai/LocalAIApi.php +++ b/ai/LocalAIApi.php @@ -28,6 +28,53 @@ class LocalAIApi /** @var array|null */ private static ?array $configCache = null; + private static function debugFileLoggingEnabled(): bool + { + static $enabled = null; + if ($enabled !== null) { + return $enabled; + } + + $candidates = [ + getenv('APP_FILE_DEBUG_LOGS'), + $_ENV['APP_FILE_DEBUG_LOGS'] ?? null, + $_SERVER['APP_FILE_DEBUG_LOGS'] ?? null, + ]; + + foreach ($candidates as $candidate) { + if ($candidate === false || $candidate === null) { + continue; + } + + $value = strtolower(trim((string) $candidate)); + if ($value === '') { + continue; + } + + if (in_array($value, ['1', 'true', 'yes', 'on'], true)) { + $enabled = true; + return true; + } + + if (in_array($value, ['0', 'false', 'no', 'off'], true)) { + $enabled = false; + return false; + } + } + + $enabled = false; + return false; + } + + private static function debugFileLog(string $message): void + { + if (!self::debugFileLoggingEnabled()) { + return; + } + + @file_put_contents(__DIR__ . '/../debug.log', rtrim($message, "\r\n") . PHP_EOL, FILE_APPEND); + } + /** * Signature compatible with the OpenAI Responses API. * @@ -107,8 +154,7 @@ class LocalAIApi $projectUuid = $cfg['project_uuid']; - // DEBUG LOGGING - file_put_contents(__DIR__ . '/../debug.log', date('Y-m-d H:i:s') . " - Requesting AI. UUID: [" . ($projectUuid ?? 'NULL') . "] CFG: " . json_encode($cfg) . "\n", FILE_APPEND); + self::debugFileLog(date('Y-m-d H:i:s') . " - Requesting AI. UUID: [" . ($projectUuid ?? 'NULL') . "] CFG: " . json_encode($cfg)); if (empty($projectUuid)) { return [ diff --git a/ai_debug.log b/ai_debug.log deleted file mode 100644 index e43feaf..0000000 --- a/ai_debug.log +++ /dev/null @@ -1 +0,0 @@ -2026-02-21 18:35:57 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"project-uuid","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} diff --git a/cookies.txt b/cookies.txt deleted file mode 100644 index c9d73f7..0000000 --- a/cookies.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Netscape HTTP Cookie File -# https://curl.se/docs/http-cookies.html -# This file was generated by libcurl! Edit at your own risk. - -127.0.0.1 FALSE / FALSE 0 PHPSESSID b6ihps49oas08569v0vg5i1hnb diff --git a/cookies_debug.txt b/cookies_debug.txt deleted file mode 100644 index ebe17bd..0000000 --- a/cookies_debug.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Netscape HTTP Cookie File -# https://curl.se/docs/http-cookies.html -# This file was generated by libcurl! Edit at your own risk. - -127.0.0.1 FALSE / FALSE 0 PHPSESSID 2uea9bvpufvp1th7vnnvcog2as diff --git a/cookies_repro.txt b/cookies_repro.txt deleted file mode 100644 index 64a675f..0000000 --- a/cookies_repro.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Netscape HTTP Cookie File -# https://curl.se/docs/http-cookies.html -# This file was generated by libcurl! Edit at your own risk. - -127.0.0.1 FALSE / FALSE 0 PHPSESSID f3c2q95r0m6iaptq2skotkpemo diff --git a/cookies_verify.txt b/cookies_verify.txt deleted file mode 100644 index d765b2a..0000000 --- a/cookies_verify.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Netscape HTTP Cookie File -# https://curl.se/docs/http-cookies.html -# This file was generated by libcurl! Edit at your own risk. - -127.0.0.1 FALSE / FALSE 0 PHPSESSID il48dnd8duujsd9cbumbfbum85 diff --git a/debug.log b/debug.log deleted file mode 100644 index 06a519f..0000000 --- a/debug.log +++ /dev/null @@ -1,138 +0,0 @@ -[INFO] AI agent editing: index.php -2026-02-26 08:18:16 - Items case hit -2026-03-01 13:00:29 - Items case hit -2026-03-01 13:17:12 - Items case hit -2026-03-01 18:24:40 - Items case hit -2026-03-17 09:58:59 - Items case hit -2026-03-17 10:04:31 - Items case hit -2026-03-17 10:12:20 - Items case hit -2026-03-17 17:26:10 - Items case hit -2026-03-17 18:04:40 - Items case hit -2026-03-17 19:06:45 - Items case hit -2026-03-17 19:07:15 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-17 19:07:52 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-17 19:08:16 - Items case hit -2026-03-17 19:08:47 - Items case hit -2026-03-17 21:28:08 - Items case hit -2026-03-17 21:37:02 - Items case hit -2026-03-17 21:46:30 - Items case hit -2026-03-17 21:47:03 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-17 21:47:17 - Items case hit -2026-03-17 21:47:27 - Items case hit -2026-03-17 22:30:34 - Items case hit -2026-03-17 22:30:54 - Items case hit -2026-03-17 22:31:12 - Items case hit -2026-03-17 22:31:17 - Items case hit -2026-03-17 22:36:20 - Items case hit -2026-03-17 22:40:51 - Items case hit -2026-03-17 18:45:47 - Items case hit -2026-03-17 18:47:55 - Items case hit -2026-03-17 18:51:56 - Items case hit -2026-03-17 18:54:27 - Items case hit -2026-03-18 01:51:29 - Items case hit -2026-03-18 01:51:45 - Items case hit -2026-03-18 02:00:48 - Items case hit -2026-03-18 02:02:37 - Items case hit -2026-03-18 02:03:03 - Items case hit -2026-03-18 02:05:55 - Items case hit -2026-03-18 02:06:44 - Items case hit -2026-03-18 02:12:27 - Items case hit -2026-03-18 02:14:19 - Items case hit -2026-03-18 02:15:13 - Items case hit -2026-03-18 02:15:31 - Items case hit -2026-03-18 02:15:56 - Items case hit -2026-03-18 02:16:33 - Items case hit -2026-03-18 02:17:32 - Items case hit -2026-03-18 02:17:48 - Items case hit -2026-03-18 02:18:21 - Items case hit -2026-03-18 02:19:01 - Items case hit -2026-03-18 02:19:49 - Items case hit -2026-03-18 02:20:06 - Items case hit -2026-03-18 02:20:47 - Items case hit -2026-03-18 02:21:53 - Items case hit -2026-03-18 02:24:31 - Items case hit -2026-03-18 02:26:44 - Items case hit -2026-03-18 02:28:48 - Items case hit -2026-03-18 02:28:58 - Items case hit -2026-03-18 06:00:05 - Items case hit -2026-03-18 14:33:50 - Items case hit -2026-03-18 14:34:10 - Items case hit -2026-03-18 17:01:37 - Items case hit -2026-03-18 17:07:17 - Items case hit -2026-03-18 17:09:46 - Items case hit -2026-03-18 17:35:42 - Items case hit -2026-03-18 17:36:53 - Items case hit -2026-03-18 17:49:12 - Items case hit -2026-03-18 18:07:03 - Items case hit -2026-03-18 18:08:41 - Items case hit -2026-03-18 22:12:51 - Items case hit -2026-03-18 22:15:09 - Items case hit -2026-03-18 22:24:28 - Items case hit -2026-03-18 22:25:14 - Items case hit -2026-03-18 22:25:43 - Items case hit -2026-03-18 22:26:38 - Items case hit -2026-03-18 22:29:27 - Items case hit -2026-03-18 22:29:45 - Items case hit -2026-03-18 22:30:17 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-18 22:30:49 - Items case hit -2026-03-18 22:31:04 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-18 22:31:16 - Items case hit -2026-03-18 22:31:26 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-18 22:31:35 - Items case hit -2026-03-18 22:31:54 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-18 22:32:01 - Items case hit -2026-03-18 22:32:15 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-18 22:32:28 - Items case hit -2026-03-18 22:33:07 - Items case hit -2026-03-18 22:40:07 - Items case hit -2026-03-18 22:40:13 - Items case hit -2026-03-18 22:40:18 - Items case hit -2026-03-18 22:40:29 - Items case hit -2026-03-18 22:40:46 - Items case hit -2026-03-18 22:41:01 - Items case hit -2026-03-18 22:41:16 - Items case hit -2026-03-18 23:02:18 - Items case hit -2026-03-18 23:03:06 - Items case hit -2026-03-18 23:03:19 - Items case hit -2026-03-18 23:05:39 - Items case hit -2026-03-18 23:06:02 - Items case hit -2026-03-19 05:57:24 - Items case hit -2026-03-19 05:57:45 - Items case hit -2026-03-19 05:58:17 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-19 05:58:34 - Items case hit -2026-03-19 05:58:51 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-19 05:59:01 - Items case hit -2026-03-19 06:00:05 - Items case hit -2026-03-19 18:14:48 - Items case hit -2026-03-19 18:15:00 - Items case hit -2026-03-19 18:15:13 - Items case hit -2026-03-19 21:18:34 - Items case hit -2026-03-19 21:18:52 - Items case hit -2026-03-20 04:58:13 - Test write from web server -2026-03-20 09:01:08 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-20 09:01:47 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-20 21:46:17 - Items case hit -2026-03-20 21:46:35 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-20 21:46:43 - Items case hit -2026-03-20 21:46:56 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-20 21:47:03 - Items case hit -2026-03-20 21:47:15 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-20 21:47:23 - Items case hit -2026-03-20 21:56:20 - Items case hit -2026-03-20 21:56:30 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-20 21:56:39 - Items case hit -2026-03-20 21:56:47 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-03-20 21:56:51 - Items case hit -2026-05-02 17:20:57 - Items case hit -2026-05-02 17:23:36 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-05-02 17:29:22 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-05-02 17:29:31 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-05-02 17:29:39 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-05-02 17:29:45 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-05-02 17:32:00 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-05-02 17:32:02 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-05-02 17:32:10 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-05-02 17:32:11 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-05-02 17:32:54 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} -2026-05-02 18:41:44 - Items case hit -2026-05-03 01:36:24 - Items case hit diff --git a/debug_accounting.php b/debug_accounting.php deleted file mode 100644 index 11ca168..0000000 --- a/debug_accounting.php +++ /dev/null @@ -1,18 +0,0 @@ -query("SELECT * FROM acc_accounts LIMIT 5")->fetchAll(); - echo "Found " . count($accounts) . " accounts.\n"; - print_r($accounts); - - echo "\nTesting getAccountBalance('1100')...\n"; - $balance = getAccountBalance('1100'); - echo "Balance for 1100: " . $balance . "\n"; - -} catch (Exception $e) { - echo "Error: " . $e->getMessage() . "\n"; -} - diff --git a/debug_items.php b/debug_items.php deleted file mode 100644 index f276260..0000000 --- a/debug_items.php +++ /dev/null @@ -1,17 +0,0 @@ -prepare("SELECT i.*, c.name_en as cat_en, c.name_ar as cat_ar, u.short_name_en as unit_en, u.short_name_ar as unit_ar, s.name as supplier_name - FROM stock_items i - LEFT JOIN stock_categories c ON i.category_id = c.id - LEFT JOIN stock_units u ON i.unit_id = u.id - LEFT JOIN suppliers s ON i.supplier_id = s.id - WHERE $whereSql - ORDER BY i.id DESC"); -$stmt->execute($params); -$items = $stmt->fetchAll(); -echo "Count: " . count($items) . "\n"; -foreach ($items as $item) { - echo "ID: {$item['id']}, Name: {$item['name_en']}\n"; -} diff --git a/fix_accounting_bug.php b/fix_accounting_bug.php deleted file mode 100644 index 2781e42..0000000 --- a/fix_accounting_bug.php +++ /dev/null @@ -1,51 +0,0 @@ -query("SELECT je.*, - (SELECT SUM(debit) FROM acc_ledger WHERE journal_entry_id = je.id) as total_debit - FROM acc_journal_entries je - ORDER BY je.entry_date DESC, je.id DESC LIMIT 100")->fetchAll(); -EOD; - -$replace = <<<'EOD' - case 'accounting': - // Pagination for Journal Entries - $currentPage = isset($_GET['p']) ? max(1, (int)$_GET['p']) : 1; - $limit = isset($_GET['limit']) ? (int)$_GET['limit'] : 20; - $offset = ($currentPage - 1) * $limit; - - $total_entries = db()->query("SELECT COUNT(*) FROM acc_journal_entries")->fetchColumn(); - $data['total_pages'] = ceil($total_entries / $limit); - $data['current_page'] = $currentPage; - - $data['journal_entries'] = db()->query("SELECT je.*, - (SELECT SUM(debit) FROM acc_ledger WHERE journal_entry_id = je.id) as total_debit - FROM acc_journal_entries je - ORDER BY je.entry_date DESC, je.id DESC LIMIT $limit OFFSET $offset")->fetchAll(); -EOD; - -// Normalize line endings -$content = str_replace("\r\n", "\n", $content); -$search = str_replace("\r\n", "\n", $search); -$replace = str_replace("\r\n", "\n", $replace); - -if (strpos($content, $search) !== false) { - $newContent = str_replace($search, $replace, $content); - file_put_contents($file, $newContent); - echo "Successfully patched index.php\n"; -} else { - echo "Could not find the code block to replace.\n"; - // Debug: print a small chunk around where we expect it - $pos = strpos($content, "case 'accounting':"); - if ($pos !== false) { - echo "Found case 'accounting': at position $pos. Content around it:\n"; - echo substr($content, $pos, 500) . "\n"; - } -} \ No newline at end of file diff --git a/fix_duplicates.php b/fix_duplicates.php deleted file mode 100644 index 3895568..0000000 --- a/fix_duplicates.php +++ /dev/null @@ -1,30 +0,0 @@ - - - - '; - -$content = str_replace($search1 . "\n " . $search1, $search1, $content); - - -$search2 = '
- - -
'; - -$content = str_replace($search2 . "\n " . $search2, $search2, $content); - -file_put_contents('index.php', $content); -echo "Duplicates removed.\n"; diff --git a/fix_forms.py b/fix_forms.py deleted file mode 100644 index 076e3ff..0000000 --- a/fix_forms.py +++ /dev/null @@ -1,149 +0,0 @@ -import re - -file_path = 'index.php' - -with open(file_path, 'r') as f: - content = f.read() - -# 1. Replace
with
-# We want to be careful. The user specifically mentioned "Items edit form" and "Add new items form". -# And "Apply the style to all forms in app". -# "row g-3" is the standard Bootstrap form layout class. Replacing it with "form-grid-3" (which I defined) -# should be safe for forms. -# However, "row g-3" might be used for non-form layouts (e.g. stats cards). -# I should look for inputs inside. -# But checking content inside is hard with regex. - -# Let's count how many "row g-3" there are. -matches = len(re.findall(r'class=["\']row g-3["\']', content)) -print(f"Found {matches} instances of 'row g-3'.") - -# Strategy: -# Replace 'class="row g-3"' with 'class="form-grid-3"' IF it's inside a form or modal context. -# Or just replace all? "row g-3" implies a grid with gap 3 (1rem). -# My "form-grid-3" is a grid with gap 1rem and 3 columns. -# If "row g-3" was used for 2 columns (col-6) or 4 columns (col-3), forcing 3 columns might break layout. -# BUT the user said "Apply the style to all forms". -# Most "row g-3" in this app seem to be forms (based on previous grep). -# Non-form grids usually use "row" without "g-3" or with different gap? -# Let's assume "row g-3" is the form standard here. - -# I'll define a function to replace specific occurrences if I can identify them. -# The "Edit Item" modal is around line 4964. -# The "Add Item" modal is around line 10141. - -# Regex to find
and replace it, but maybe verify context? -# I'll just do a global replace for now, but I will backup first. -# Wait, "row g-3" in a dashboard stats widget (e.g. 4 cards) would become 3 columns. -# That might be annoying. -# I should inspect if there are stats widgets using "row g-3". - -# Let's look for "col-md-3" or "col-xl-3" inside "row g-3". -# If I see "col-xl-3", it's likely a 4-column layout (12/3 = 4). -# My "form-grid-3" forces 3 columns. -# So replacing it would break 4-column layouts. -# "Edit Item" uses "col-md-3", "col-md-4", "col-md-6". -# If I change the container to grid-3, the children become grid items. -# I added CSS to make children width 100%. - -# To be safer, I will only replace "row g-3" if it contains "form-control" or "form-select" or "form-label" inside it (heuristic). -# This is tricky with regex. - -# Alternative: Find the specific blocks for Items and change them. -# Then find other *forms*. - -# Let's use a simpler approach. -# I will search for the specific lines for Edit Item and Add Item and change them. -# Then I will search for other obvious forms. - -new_content = content - -# 1. Edit Item Modal (around line 4975) -# Context: