From 758a42b3fe421b9854bd8907c05e57e06fa39727 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Sat, 1 Oct 2022 12:10:02 -0500 Subject: [PATCH] Custom patient report cleanup (Fixes: #5744, #5765, #5766) (#5751) * Initial checkbox modification workflow * Make the patient name much larger (Fixes: #5766) * Fix rendering the history form as well * Fix text alignment in PDF generation of custom reports * Remove redundant Generated on line and add a missing space (Fixes: #5765) * Minor escaping fix, thanks Brady! --- interface/patient_file/report/custom_report.php | 10 ++++--- interface/super/edit_layout_props.php | 13 +++++++++ library/options.inc.php | 38 ++++++++++++++++++------- sql/7_0_0-to-7_0_1_upgrade.sql | 4 +++ sql/database.sql | 1 + 5 files changed, 51 insertions(+), 15 deletions(-) diff --git a/interface/patient_file/report/custom_report.php b/interface/patient_file/report/custom_report.php index 52704d3d9..1f320e99e 100644 --- a/interface/patient_file/report/custom_report.php +++ b/interface/patient_file/report/custom_report.php @@ -249,7 +249,7 @@ function zip_content($source, $destination, $content = '', $create = true) /******************************************************************/ // Setup Headers and Footers for mPDF only Download // in HTML view it's just one line at the top of page 1 - echo ' ' . xlt("PATIENT") . ':' . text($titleres['lname']) . ', ' . text($titleres['fname']) . ' - ' . text($titleres['DOB_TS']) . ' '; + echo ' ' . xlt("PATIENT") . ': ' . text($titleres['lname']) . ', ' . text($titleres['fname']) . ' - ' . text($titleres['DOB_TS']) . ' '; echo '' . xlt('Generated on') . ' ' . text(oeFormatShortDate()) . ' - ' . text($facility['name']) . ' ' . text($facility['phone']) . ''; // Use logo if it exists as 'practice_logo.gif' in the site dir @@ -262,7 +262,11 @@ function zip_content($source, $destination, $content = '', $create = true) $practice_logo = $plogo[$k]; } - echo "
+ + + +
"; + echo "
"; + ?> +

+
"; if (file_exists($practice_logo)) { $logo_path = $GLOBALS['OE_SITE_WEBROOT'] . "/images/" . basename($practice_logo); echo ""; // keep size within reason @@ -274,8 +278,6 @@ function zip_content($source, $destination, $content = '', $create = true) ,

-
- :
"; ?> '0', 'grp_init_open' => '0', 'grp_referrals' => '0', + 'grp_unchecked' => '0', 'grp_services' => '', 'grp_products' => '', 'grp_diags' => '', @@ -512,6 +515,16 @@ for ($cols = 2; $cols <= 12; ++$cols) { +
+ /> + + +   +
' /> diff --git a/library/options.inc.php b/library/options.inc.php index bc8cdfdcb..9a69a2c58 100644 --- a/library/options.inc.php +++ b/library/options.inc.php @@ -2427,6 +2427,9 @@ function generate_display_field($frow, $currvalue) $field_id = isset($frow['field_id']) ? $frow['field_id'] : null; $list_id = $frow['list_id']; $backup_list = isset($frow['list_backup_id']) ? $frow['list_backup_id'] : null; + $show_unchecked_arr = array(); + getLayoutProperties($frow['form_id'], $show_unchecked_arr, 'grp_unchecked', "1"); + $show_unchecked = strval($show_unchecked_arr['']['grp_unchecked']) == "0" ? false : true; $s = ''; @@ -2564,7 +2567,7 @@ function generate_display_field($frow, $currvalue) $s = htmlspecialchars($crow['pc_catname'], ENT_NOQUOTES); } elseif ($data_type == 21) { // a single checkbox or set of labeled checkboxes if (!$list_id) { - $s .= $currvalue ? '[ x ]' : '[    ]'; + $s .= $currvalue ? '☑' : '☐'; } else { // In this special case, fld_length is the number of columns generated. $cols = max(1, $frow['fld_length']); @@ -2581,11 +2584,17 @@ function generate_display_field($frow, $currvalue) } $s .= ""; } - $s .= ""; $checked = in_array($option_id, $avalue); - $s .= $checked ? '[ x ]' : '[    ]'; - $s .= ' ' . text(xl_list_label($lrow['title'])) . '  '; - $s .= ""; + if (!$show_unchecked && $checked) { + $s .= ""; + $s .= text(xl_list_label($lrow['title'])) . '  '; + $s .= ""; + } elseif ($show_unchecked) { + $s .= ""; + $s .= $checked ? '☑' : '☐'; + $s .= ' ' . text(xl_list_label($lrow['title'])) . '  '; + $s .= ""; + } } if ($count) { $s .= ""; @@ -2711,12 +2720,18 @@ function generate_display_field($frow, $currvalue) } $s .= ""; } - $s .= ""; $checked = ((strlen($currvalue) == 0 && $lrow['is_default']) || (strlen($currvalue) > 0 && $option_id == $currvalue)); - $s .= $checked ? '[ x ]' : '[    ]'; - $s .= ' ' . text(xl_list_label($lrow['title'])) . '  '; - $s .= ""; + if (!$show_unchecked && $checked) { + $s .= ""; + $s .= text(xl_list_label($lrow['title'])) . '  '; + $s .= ""; + } elseif ($show_unchecked) { + $s .= ""; + $s .= $checked ? '☑' : '☐'; + $s .= ' ' . text(xl_list_label($lrow['title'])) . '  '; + $s .= ""; + } } if ($count) { $s .= ""; @@ -3498,13 +3513,14 @@ function isSkipped(&$frow, $currvalue) } // Load array of names of the given layout and its groups. -function getLayoutProperties($formtype, &$grparr, $sel = "grp_title") +function getLayoutProperties($formtype, &$grparr, $sel = "grp_title", $limit = null) { if ($sel != '*' && strpos($sel, 'grp_group_id') === false) { $sel = "grp_group_id, $sel"; } $gres = sqlStatement("SELECT $sel FROM layout_group_properties WHERE grp_form_id = ? " . - "ORDER BY grp_group_id", array($formtype)); + " ORDER BY grp_group_id " . + ($limit ? "LIMIT " . escape_limit($limit) : ""), array($formtype)); while ($grow = sqlFetchArray($gres)) { // TBD: Remove this after grp_init_open column is implemented. if ($sel == '*' && !isset($grow['grp_init_open'])) { diff --git a/sql/7_0_0-to-7_0_1_upgrade.sql b/sql/7_0_0-to-7_0_1_upgrade.sql index 1433a2e9f..c93cbd564 100644 --- a/sql/7_0_0-to-7_0_1_upgrade.sql +++ b/sql/7_0_0-to-7_0_1_upgrade.sql @@ -227,3 +227,7 @@ ALTER TABLE `form_questionnaire_assessments` CHANGE `code_type` `questionnaire_i #IfNotRow2D list_options list_id Document_Template_Categories option_id questionnaire INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`) VALUES ('Document_Template_Categories','questionnaire','Questionnaires',10,0,0,'','','',0,0,1); #EndIf + +#IfMissingColumn layout_group_properties grp_unchecked +ALTER TABLE `layout_group_properties` ADD `grp_unchecked` tinyint(1) NOT NULL DEFAULT 0; +#EndIf diff --git a/sql/database.sql b/sql/database.sql index c264a25c5..c85091a51 100644 --- a/sql/database.sql +++ b/sql/database.sql @@ -3384,6 +3384,7 @@ CREATE TABLE `layout_group_properties` ( grp_save_close tinyint(1) not null default 0, grp_init_open tinyint(1) not null default 0, grp_referrals tinyint(1) not null default 0, + grp_unchecked tinyint(1) not null default 0, grp_services varchar(4095) not null default '', grp_products varchar(4095) not null default '', grp_diags varchar(4095) not null default '', -- 2.11.4.GIT