From 6ccff4002cf290fa456b4907f7be1063cc926902 Mon Sep 17 00:00:00 2001 From: Brady Miller Date: Sat, 2 Sep 2023 19:57:32 -0700 Subject: [PATCH] fix: several clinical_notes form fixes (#6811) --- interface/forms/clinical_notes/new.php | 4 ++-- interface/forms/clinical_notes/templates/report.html.twig | 8 ++++---- src/Common/Twig/TwigExtension.php | 6 ++++++ src/Services/ClinicalNotesService.php | 6 +++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/interface/forms/clinical_notes/new.php b/interface/forms/clinical_notes/new.php index 0b0ead666cf..f13ba03f692 100644 --- a/interface/forms/clinical_notes/new.php +++ b/interface/forms/clinical_notes/new.php @@ -208,7 +208,7 @@ function typeChange(othis) { $context = $value['title']; } ?> - + @@ -222,7 +222,7 @@ function typeChange(othis) { $context = $value['title']; } ?> - + diff --git a/interface/forms/clinical_notes/templates/report.html.twig b/interface/forms/clinical_notes/templates/report.html.twig index 7fe15db0f55..fe3f3491868 100644 --- a/interface/forms/clinical_notes/templates/report.html.twig +++ b/interface/forms/clinical_notes/templates/report.html.twig @@ -14,15 +14,15 @@ The Report template of the clinical note form.
{{ "Date"|xlt }}
- +
{{ "Type"|xlt }}
-
{{ n.codetext|default("Unspecified"|xl)|xlt }}
+
{{ n.codetext is not empty ? n.codetext|xlListLabel|text : "Unspecified"|xlt }}
{{ "Category"|xlt }}
-
{{ n.category_title|default("Unspecified"|xl)|text }}
+
{{ n.category_title is not empty ? n.category_title|xlListLabel|text : "Unspecified"|xlt }}
{{ "Author"|xlt }}
@@ -35,7 +35,7 @@ The Report template of the clinical note form.
{% endif %}
-
{{ n.description|text|nl2br }}
+
{{ n.description|text|nl2br }}
{% endfor %} diff --git a/src/Common/Twig/TwigExtension.php b/src/Common/Twig/TwigExtension.php index dbe0de100d2..ebd7f609b62 100644 --- a/src/Common/Twig/TwigExtension.php +++ b/src/Common/Twig/TwigExtension.php @@ -308,6 +308,12 @@ function ($string) { return oeFormatShortDate($string); } ), + new TwigFilter( + 'xlListLabel', + function ($string) { + return xl_list_label($string); + } + ), new TwigFilter( 'xlDocCategory', function ($string) { diff --git a/src/Services/ClinicalNotesService.php b/src/Services/ClinicalNotesService.php index 62b0ba7a143..9f13523490e 100644 --- a/src/Services/ClinicalNotesService.php +++ b/src/Services/ClinicalNotesService.php @@ -315,8 +315,8 @@ public function getClinicalNotesForPatientForm(int $formid, $pid, $encounter) $sql = "SELECT fcn.*, lo_category.title AS category_title, lo_category.notes AS category_code FROM `form_clinical_notes` fcn - LEFT JOIN list_options lo_category ON lo_category.list_id = `Clinical_Notes_Category` AND lo_category.option_id = fcn.clinical_notes_category - LEFT JOIN list_options lo_type ON lo_type.list_id = `Clinical_Notes_Type` AND lo_type.option_id = fcn.clinical_notes_type + LEFT JOIN list_options lo_category ON lo_category.list_id = 'Clinical_Note_Category' AND lo_category.option_id = fcn.clinical_notes_category + LEFT JOIN list_options lo_type ON lo_type.list_id = 'Clinical_Note_Type' AND lo_type.option_id = fcn.clinical_notes_type WHERE fcn.`form_id`=? AND fcn.`pid` = ? AND fcn.`encounter` = ?"; return QueryUtils::fetchRecords($sql, array($formid, $pid, $encounter)); } @@ -366,7 +366,7 @@ private function getListAsSelectList($optionsList) $selectList = []; foreach ($optionsList as $option) { - $selectList[] = ['value' => $option['option_id'], 'code' => $option['notes'], 'title' => $option['title']]; + $selectList[] = ['value' => $option['option_id'], 'code' => $option['notes'], 'title' => $option['title'], 'xlTitle' => xl_list_label($option['title'])]; } return $selectList; }