ISSUE 2: After clicking 'Save Discharge Advice', CKEditor turns into plain textarea ROOT CAUSE: initInstructionTools() was not re-initializing CKEditor after AJAX section reload - When user clicks button with data-reload-section='section-instructions' - Form submits via AJAX, returns updated HTML - Section content replaced with new HTML - initInstructionTools() called but did NOT restore CKEditor - Fields remain as plain textareas SOLUTION: Added CKEditor re-initialization to initInstructionTools() Changes to discharge_create.php initInstructionTools(): 1. Check if CKEDITOR is available 2. Destroy existing instances first (instruction_other, instruction_remark) 3. Re-create CKEditor for both fields with same config 4. Prevents duplicate instances and ensures editors work after reload TESTING: - Type in instruction_remark or instruction_other - Click 'Save Discharge Advice' - After reload, both fields should still be CKEditor (not textarea) - Can continue editing with toolbar NOTE: Issue 1 (data mixing between fields) requires separate investigation User can test with: php check_instruction_data.php to see actual DB values
23 lines
810 B
PHP
23 lines
810 B
PHP
<?php
|
|
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
|
|
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
|
|
// Bootstrap minimal CI4
|
|
$paths = new \Config\Paths();
|
|
$app = \CodeIgniter\Config\Services::codeigniter();
|
|
$app->initialize();
|
|
|
|
$db = \Config\Database::connect();
|
|
$row = $db->table('ipd_discharge_instructions')->where('ipd_id', 1007141)->get()->getRowArray();
|
|
|
|
if ($row) {
|
|
echo "=== IPD 1007141 - ipd_discharge_instructions ===" . PHP_EOL . PHP_EOL;
|
|
echo "comp_report (contains other_text JSON): " . PHP_EOL;
|
|
echo substr($row['comp_report'] ?? '', 0, 300) . PHP_EOL . PHP_EOL;
|
|
echo "comp_remark (Discharge Summary field): " . PHP_EOL;
|
|
echo substr($row['comp_remark'] ?? '', 0, 300) . PHP_EOL;
|
|
} else {
|
|
echo "No record found for IPD 1007141" . PHP_EOL;
|
|
}
|