diff --git a/app/Controllers/Opd.php b/app/Controllers/Opd.php
index 3b6dd74..1553bf1 100644
--- a/app/Controllers/Opd.php
+++ b/app/Controllers/Opd.php
@@ -3253,18 +3253,9 @@ class Opd extends BaseController
$tokens['investigation'] = $formatBlock('Investigation Advised', (string) ($tokens['investigation_raw'] ?? ''));
$tokens['Prescriber_Remarks'] = $formatBlock('Remarks', (string) ($tokens['Prescriber_Remarks_raw'] ?? ''));
$adviceRaw = trim((string) ($tokens['advice_raw'] ?? ''));
- $adviceLocalText = trim((string) ($tokens['advice_local'] ?? ''));
+ // Print advice exactly as typed — no AI/Hindi conversion applied.
if ($adviceRaw !== '') {
- $advLabelHtml = 'सलाह (Advice) :';
- $adviceHtml = '
';
- if ($adviceLocalText !== '') {
- $adviceHtml .= $advLabelHtml . '
' . $adviceLocalText . '';
- $adviceHtml .= '
(Advice: ' . $adviceRaw . ')
';
- } else {
- $adviceHtml .= $advLabelHtml . ' ' . $adviceRaw;
- }
- $adviceHtml .= '
';
- $tokens['advice'] = $adviceHtml;
+ $tokens['advice'] = nl2br(htmlspecialchars($adviceRaw, ENT_QUOTES, 'UTF-8'));
} else {
$tokens['advice'] = '';
}
diff --git a/app/Controllers/Setup.php b/app/Controllers/Setup.php
index 6aa92c0..07aa16d 100644
--- a/app/Controllers/Setup.php
+++ b/app/Controllers/Setup.php
@@ -180,9 +180,13 @@ class Setup extends BaseController
$maxRuntimeSeconds = 5;
}
+ // For analyze: run to full completion — no time or table-count truncation.
+ $analyzeMaxRuntime = $action === 'analyze' ? PHP_INT_MAX : $maxRuntimeSeconds;
+ $analyzeMaxTables = $action === 'analyze' ? 0 : -1; // 0 = unlimited override
+
$startedAt = microtime(true);
- $syncResult = $this->buildSchemaSyncPlan($startedAt, $maxRuntimeSeconds);
+ $syncResult = $this->buildSchemaSyncPlan($startedAt, $analyzeMaxRuntime, $analyzeMaxTables);
if ($action === 'apply' && empty($syncResult['errors']) && !empty($syncResult['sql'])) {
$maxApplyStatements = (int) env('setup.sync.max_apply_statements_per_run', 75);
if ($maxApplyStatements <= 0) {
@@ -695,7 +699,7 @@ class Setup extends BaseController
/**
* @return array
*/
- private function buildSchemaSyncPlan(float $startedAt, int $maxRuntimeSeconds): array
+ private function buildSchemaSyncPlan(float $startedAt, int $maxRuntimeSeconds, int $maxTablesOverride = -1): array
{
$errors = [];
$sql = [];
@@ -724,9 +728,14 @@ class Setup extends BaseController
$masterTables = $masterSchema['tables'] ?? [];
$clientTables = array_flip($client->listTables());
- $maxTables = (int) env('setup.sync.max_tables_per_run', 0);
- if ($maxTables < 0) {
- $maxTables = 0;
+ // $maxTablesOverride >= 0 takes precedence over the .env setting (0 = unlimited).
+ if ($maxTablesOverride >= 0) {
+ $maxTables = $maxTablesOverride;
+ } else {
+ $maxTables = (int) env('setup.sync.max_tables_per_run', 0);
+ if ($maxTables < 0) {
+ $maxTables = 0;
+ }
}
$processedTables = 0;
$truncated = false;
diff --git a/app/Views/setup/db_setup.php b/app/Views/setup/db_setup.php
index 1d29d3f..c71ae5e 100644
--- a/app/Views/setup/db_setup.php
+++ b/app/Views/setup/db_setup.php
@@ -180,11 +180,20 @@