translation fix

This commit is contained in:
Flatlogic Bot 2026-03-20 05:04:02 +00:00
parent a790c96025
commit 05984b08f1
5 changed files with 33 additions and 34 deletions

View File

@ -5,15 +5,15 @@
function get_ai_env($key) {
$val = getenv($key);
if ($val !== false && $val !== '') {
error_log("get_ai_env: $key from getenv: " . $val);
error_log("get_ai_env: $key from getenv: " . substr($val, 0, 5) . "...");
return $val;
}
if (isset($_ENV[$key]) && $_ENV[$key] !== '') {
error_log("get_ai_env: $key from \$_ENV: " . $_ENV[$key]);
error_log("get_ai_env: $key from \$_ENV: " . substr($_ENV[$key], 0, 5) . "...");
return $_ENV[$key];
}
if (isset($_SERVER[$key]) && $_SERVER[$key] !== '') {
error_log("get_ai_env: $key from \$_SERVER: " . $_SERVER[$key]);
error_log("get_ai_env: $key from \$_SERVER: " . substr($_SERVER[$key], 0, 5) . "...");
return $_SERVER[$key];
}
error_log("get_ai_env: $key not found in environment");
@ -40,7 +40,7 @@ if (!$projectUuid || !$projectId) {
if ($env) {
if (!$projectUuid && !empty($env['PROJECT_UUID'])) {
$projectUuid = $env['PROJECT_UUID'];
error_log("Found PROJECT_UUID in $path: " . $projectUuid);
error_log("Found PROJECT_UUID in $path: " . substr($projectUuid, 0, 5) . "...");
}
if (!$projectId && !empty($env['PROJECT_ID'])) {
$projectId = $env['PROJECT_ID'];
@ -54,6 +54,8 @@ if (!$projectUuid || !$projectId) {
}
if ($projectUuid && $projectId) break;
}
} else {
error_log("PROJECT_UUID and PROJECT_ID found in environment immediately.");
}
$baseUrl = 'https://flatlogic.com';

View File

@ -108,3 +108,6 @@
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}

View File

@ -48,10 +48,10 @@ if (isset($_GET['action']) && $_GET['action'] === 'download_items_template') {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
file_put_contents('post_debug.log', date('Y-m-d H:i:s') . " - POST: " . json_encode($_POST) . "\n", FILE_APPEND);
}
require_once 'db/config.php';
require_once 'includes/SimpleXLSX.php';
require_once 'includes/stock_helper.php';
require_once 'db/BackupService.php';
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/includes/SimpleXLSX.php';
require_once __DIR__ . '/includes/stock_helper.php';
require_once __DIR__ . '/db/BackupService.php';
// Helper for current outlet
if (!function_exists('current_outlet_id')) {
@ -6926,9 +6926,9 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
<tfoot>
<tr class="fw-bold bg-light">
<td colspan="5" class="text-end" data-en="Totals" data-ar="الإجمالي">Totals</td>
<td class="text-end">OMR <?= number_format($total_all, 3) ?></td>
<td class="text-end text-success">OMR <?= number_format($total_paid, 3) ?></td>
<td class="text-end text-danger">OMR <?= number_format($total_balance, 3) ?></td>
<td class="text-end">OMR <?= number_format((float)$total_all, 3) ?></td>
<td class="text-end text-success">OMR <?= number_format((float)$total_paid, 3) ?></td>
<td class="text-end text-danger">OMR <?= number_format((float)$total_balance, 3) ?></td>
<td class="d-print-none"></td>
</tr>
</tfoot>
@ -9450,16 +9450,16 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
$t_sales = (float)($st['total_sales'] ?? 0);
$row_expected_cash = (float)$s['opening_balance'] + $c_total;
?>
<td>OMR <?= number_format($c_total, 3) ?></td>
<td>OMR <?= number_format($cd_total, 3) ?></td>
<td>OMR <?= number_format($cr_total, 3) ?></td>
<td class="fw-bold">OMR <?= number_format($t_sales, 3) ?></td>
<td>OMR <?= number_format((float)$c_total, 3) ?></td>
<td>OMR <?= number_format((float)$cd_total, 3) ?></td>
<td>OMR <?= number_format((float)$cr_total, 3) ?></td>
<td class="fw-bold">OMR <?= number_format((float)$t_sales, 3) ?></td>
<td>
<?php if ($s['status'] === 'closed'):
$diff = (float)($s['cash_in_hand'] ?? 0) - $row_expected_cash;
$color = $diff == 0 ? 'text-success' : ($diff > 0 ? 'text-info' : 'text-danger');
?>
<span class="<?= $color ?> fw-bold">OMR <?= number_format($diff, 3) ?></span>
<span class="<?= $color ?> fw-bold">OMR <?= number_format((float)$diff, 3) ?></span>
<?php else: ?>---<?php endif; ?>
</td>
<td>
@ -9597,32 +9597,32 @@ function loadSessionReport(id) {
</div>
<div class="d-flex justify-content-between mb-1">
<span class="text-muted">Cash Sales:</span>
<span class="fw-bold">OMR <?= number_format($cash_sales, 3) ?></span>
<span class="fw-bold">OMR <?= number_format((float)$cash_sales, 3) ?></span>
</div>
<div class="d-flex justify-content-between mb-1">
<span class="text-muted">Credit Card Sales:</span>
<span class="fw-bold">OMR <?= number_format($card_sales, 3) ?></span>
<span class="fw-bold">OMR <?= number_format((float)$card_sales, 3) ?></span>
</div>
<div class="d-flex justify-content-between mb-1">
<span class="text-muted">Credit:</span>
<span class="fw-bold">OMR <?= number_format($credit_sales, 3) ?></span>
<span class="fw-bold">OMR <?= number_format((float)$credit_sales, 3) ?></span>
</div>
<div class="d-flex justify-content-between mb-1">
<span class="text-muted">Bank Transfer:</span>
<span class="fw-bold">OMR <?= number_format($bank_transfer_sales, 3) ?></span>
<span class="fw-bold">OMR <?= number_format((float)$bank_transfer_sales, 3) ?></span>
</div>
<div class="d-flex justify-content-between mb-1 border-top pt-1 mt-1 fw-bold text-dark">
<span>Total Sales:</span>
<span>OMR <?= number_format($total_sales, 3) ?></span>
<span>OMR <?= number_format((float)$total_sales, 3) ?></span>
</div>
<hr class="my-2">
<div class="d-flex justify-content-between fw-bold text-primary mb-1 h6">
<span>Balance (Total):</span>
<span>OMR <?= number_format($total_all, 3) ?></span>
<span>OMR <?= number_format((float)$total_all, 3) ?></span>
</div>
<div class="d-flex justify-content-between fw-bold text-success">
<span>Expected Cash:</span>
<span>OMR <?= number_format($expected_cash, 3) ?></span>
<span>OMR <?= number_format((float)$expected_cash, 3) ?></span>
</div>
</div>
</div>

View File

@ -118,3 +118,8 @@
2026-03-19 09:23:02 - POST: {"action":"save_theme","theme":"sunset"}
2026-03-19 13:46:44 - POST: {"create_backup":""}
2026-03-19 13:48:49 - POST: {"open_register":"1","register_id":"3","opening_balance":"0"}
2026-03-20 04:59:21 - POST: {"action":"translate","text":"Apple","target":"ar"}
2026-03-20 04:59:40 - POST: {"action":"translate","text":"Apple","target":"ar"}
2026-03-20 05:00:37 - POST: {"action":"translate","text":"Apple","target":"ar"}
2026-03-20 05:01:08 - POST: {"action":"translate","text":"Apple","target":"ar"}
2026-03-20 05:01:47 - POST: {"action":"translate","text":"Apple","target":"ar"}

View File

@ -1,11 +0,0 @@
<?php
$_POST['action'] = 'translate';
$_POST['text'] = 'Laptop';
$_POST['target'] = 'ar';
// Capture output
ob_start();
include __DIR__ . '/index.php';
$output = ob_get_clean();
echo $output;