diff --git a/application/controllers/tools/Inform_consent.php b/application/controllers/tools/Inform_consent.php index c28fcacb..453a5229 100644 --- a/application/controllers/tools/Inform_consent.php +++ b/application/controllers/tools/Inform_consent.php @@ -111,10 +111,16 @@ class Inform_consent extends MY_Controller [$orderHeaderId] )->row_array(); $printName = trim($cacheRow['ppc_name'] ?? ''); + $namePart = trim($printName !== '' ? $printName : ($row['M_PatientName'] ?? '')); $row['patient_name'] = trim( ($title ? $title . ' ' : '') . trim($row['M_PatientPrefix'] ?? '') . ' ' . - trim($printName !== '' ? $printName : ($row['M_PatientName'] ?? '')) . ' ' . + $namePart . ' ' . + trim($row['M_PatientSuffix'] ?? '') + ); + $row['patient_sign_name'] = trim( + trim($row['M_PatientPrefix'] ?? '') . ' ' . + $namePart . ' ' . trim($row['M_PatientSuffix'] ?? '') ); $row['dob'] = $row['M_PatientDOB']; @@ -264,7 +270,7 @@ class Inform_consent extends MY_Controller if ($signaturePath !== null) { $pdf->Image($signaturePath, $rightX - 6, $signBottom - 23, 42, 12); } - $this->draw_full_name_block($pdf, $rightX, $signBottom - 9, $rightW, trim(preg_replace('/\s+/', ' ', $patient['patient_name']))); + $this->draw_full_name_block($pdf, $rightX, $signBottom - 9, $rightW, trim(preg_replace('/\s+/', ' ', $patient['patient_sign_name']))); $boxEndY = min($this->pageContentBottom, $signBottom + 2); $pdf->Rect(10, $boxStartY, 190, max(10, $boxEndY - $boxStartY)); diff --git a/application/controllers/tools/Inform_consent_cpmi.php b/application/controllers/tools/Inform_consent_cpmi.php index 6e23d2b1..a0c3c012 100644 --- a/application/controllers/tools/Inform_consent_cpmi.php +++ b/application/controllers/tools/Inform_consent_cpmi.php @@ -69,6 +69,7 @@ class Inform_consent_cpmi extends MY_Controller CONCAT(TRIM(IFNULL(t.M_TitleName,'')), ' ', TRIM(IFNULL(p.M_PatientPrefix,'')), ' ', TRIM(IFNULL(p.M_PatientName,'')), ' ', TRIM(IFNULL(p.M_PatientSuffix,''))) AS patient_name, IFNULL(t.M_TitleName, '') as M_TitleName, IFNULL(p.M_PatientPrefix, '') as M_PatientPrefix, + IFNULL(p.M_PatientName, '') as M_PatientName, IFNULL(p.M_PatientSuffix, '') as M_PatientSuffix, IFNULL(s.M_SexCode, '') as sex_code, DATE_FORMAT(p.M_PatientDOB, '%d-%m-%Y') as dob, @@ -109,14 +110,19 @@ class Inform_consent_cpmi extends MY_Controller [$orderHeaderId] )->row_array(); $printName = trim($cacheRow['ppc_name'] ?? ''); - if ($printName !== '') { - $row['patient_name'] = trim( - trim((string)($row['M_TitleName'] ?? '')) . ' ' . - trim((string)($row['M_PatientPrefix'] ?? '')) . ' ' . - $printName . ' ' . - trim((string)($row['M_PatientSuffix'] ?? '')) - ); - } + $namePart = trim($printName !== '' ? $printName : ($row['M_PatientName'] ?? '')); + $title = trim((string)($row['M_TitleName'] ?? '')); + $row['patient_name'] = trim( + ($title ? $title . ' ' : '') . + trim((string)($row['M_PatientPrefix'] ?? '')) . ' ' . + $namePart . ' ' . + trim((string)($row['M_PatientSuffix'] ?? '')) + ); + $row['patient_sign_name'] = trim( + trim((string)($row['M_PatientPrefix'] ?? '')) . ' ' . + $namePart . ' ' . + trim((string)($row['M_PatientSuffix'] ?? '')) + ); $this->ibl_patient_decrypt->delete_cache($cacheId); return $row; @@ -211,7 +217,7 @@ class Inform_consent_cpmi extends MY_Controller } $pdf->SetFont('Arial', 'U', 8.5); $pdf->SetXY(149, $y); - $pdf->Cell(54, 5, $this->safe_text(trim(preg_replace('/\s+/', ' ', $patient['patient_name']))), 0, 1, 'C'); + $pdf->Cell(54, 5, $this->safe_text(trim(preg_replace('/\s+/', ' ', $patient['patient_sign_name']))), 0, 1, 'C'); $y += 8; $pdf->Line(14, $y, 196, $y);