From 22b0e0eebfdd24f72b721d0e6a79705481fa83aa Mon Sep 17 00:00:00 2001 From: bradymiller Date: Fri, 26 Apr 2013 23:12:34 -0700 Subject: [PATCH] Added active toggle to the Issue Type settings and modularized pertinent code a bit more --- interface/super/edit_list.php | 50 ++++++++++++++++-------------------------- library/lists.inc | 2 +- sql/4_1_1-to-4_1_2_upgrade.sql | 4 ++++ sql/database.sql | 1 + version.php | 2 +- 5 files changed, 26 insertions(+), 33 deletions(-) diff --git a/interface/super/edit_list.php b/interface/super/edit_list.php index ca8623cb9..7d7876a85 100644 --- a/interface/super/edit_list.php +++ b/interface/super/edit_list.php @@ -112,6 +112,7 @@ if ($_POST['formaction']=='save' && $list_id) { sqlStatement("DELETE FROM issue_types"); for ($lino = 1; isset($opt["$lino"]['category']); ++$lino) { $iter = $opt["$lino"]; + $it_active = formTrim($iter['active']); $it_category = formTrim($iter['category']); $it_ordering = formTrim($iter['ordering']); $it_type = formTrim($iter['type']); @@ -123,8 +124,9 @@ if ($_POST['formaction']=='save' && $list_id) { if ( (strlen($it_category) > 0) && (strlen($it_type) > 0) ) { sqlInsert("INSERT INTO issue_types ( " . - "`category`,`ordering`, `type`, `plural`, `singular`, `abbreviation`, `style`, `force_show` " . + "`active`,`category`,`ordering`, `type`, `plural`, `singular`, `abbreviation`, `style`, `force_show` " . ") VALUES ( " . + "'$it_active' , " . "'$it_category' , " . "'$it_ordering' , " . "'$it_type' , " . @@ -402,12 +404,10 @@ function writeFSLine($category, $option, $codes) { /** - * Helper function for writeITLine(). - * itGenCell() generates cells for data display (Issue Type list). + * Helper functions for writeITLine() and writeCTLine(). */ - -function itGenCell($opt_line_no, $it_array, $name, $size, $maxlength, $title='') { - $value = isset($it_array[$name]) ? $it_array[$name] : ''; +function ctGenCell($opt_line_no, $data_array, $name, $size, $maxlength, $title='') { + $value = isset($data_array[$name]) ? $data_array[$name] : ''; $s = " \n"; - echo itGenCell($opt_line_no, $it_array, 'category' , 20, 20, xl('OpenEMR Application Category (Default vs Sports Teams vs IPPF)')); - echo itGenCell($opt_line_no, $it_array, 'ordering' , 10, 10, xl('Order')); - echo itGenCell($opt_line_no, $it_array, 'type' , 20, 75, xl('Issue Type')); - echo itGenCell($opt_line_no, $it_array, 'plural' , 20, 75, xl('Plural')); + echo ctGenCell($opt_line_no, $it_array, 'category' , 20, 20, xl('OpenEMR Application Category (Default vs Sports Teams vs IPPF)')); + echo ctGenCBox($opt_line_no, $it_array, 'active', xl('Is this active?')); + echo ctGenCell($opt_line_no, $it_array, 'ordering' , 10, 10, xl('Order')); + echo ctGenCell($opt_line_no, $it_array, 'type' , 20, 75, xl('Issue Type')); + echo ctGenCell($opt_line_no, $it_array, 'plural' , 20, 75, xl('Plural')); // if not english and translating lists then show the translation if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) { echo " " . xlt($it_array['plural']) . "\n"; } - echo itGenCell($opt_line_no, $it_array, 'singular' , 20, 75, xl('Singular')); + echo ctGenCell($opt_line_no, $it_array, 'singular' , 20, 75, xl('Singular')); // if not english and translating lists then show the translation if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) { echo " " . xlt($it_array['singular']) . "\n"; } - echo itGenCell($opt_line_no, $it_array, 'abbreviation' , 10, 10, xl('Abbreviation')); + echo ctGenCell($opt_line_no, $it_array, 'abbreviation' , 10, 10, xl('Abbreviation')); // if not english and translating lists then show the translation if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) { echo " " . xlt($it_array['abbreviation']) . "\n"; } - echo itGenCell($opt_line_no, $it_array, 'style', 6, 6, xl('0 - Normal; 1 - Simplified: only title, start date, comments and an Active checkbox;no diagnosis, occurrence, end date, referred-by or sports fields.; 2 - Football Injury;')); - echo itGenCell($opt_line_no, $it_array, 'force_show', 10, 10, xl('0 - Do not show this category on the patient summary screen if there have been no issues entered in for this category; 1 - Show this category on the patient summary screen even if no issues have been entered for this category.')); + echo ctGenCell($opt_line_no, $it_array, 'style', 6, 6, xl('0 - Normal; 1 - Simplified: only title, start date, comments and an Active checkbox;no diagnosis, occurrence, end date, referred-by or sports fields.; 2 - Football Injury;')); + echo ctGenCBox($opt_line_no, $it_array, 'force_show', xl('Show this category on the patient summary screen even if no issues have been entered for this category.')); echo " \n"; } @@ -809,6 +796,7 @@ while ($row = sqlFetchArray($res)) { + diff --git a/library/lists.inc b/library/lists.inc index cffeabb4a..c454735b7 100644 --- a/library/lists.inc +++ b/library/lists.inc @@ -55,7 +55,7 @@ function collect_issue_type_category() { } // Build the $ISSUE_TYPES array (see script header for description) -$res = sqlStatement("SELECT * FROM `issue_types` WHERE `category`=? ORDER BY `ordering` ASC", array( collect_issue_type_category() )); +$res = sqlStatement("SELECT * FROM `issue_types` WHERE active=1 AND `category`=? ORDER BY `ordering` ASC", array( collect_issue_type_category() )); while($row = sqlFetchArray($res)){ $ISSUE_TYPES[$row['type']] = array(xl($row['plural']),xl($row['singular']),xl($row['abbreviation']),$row['style'],$row['force_show']); } diff --git a/sql/4_1_1-to-4_1_2_upgrade.sql b/sql/4_1_1-to-4_1_2_upgrade.sql index 095e160fc..9a8866140 100644 --- a/sql/4_1_1-to-4_1_2_upgrade.sql +++ b/sql/4_1_1-to-4_1_2_upgrade.sql @@ -402,3 +402,7 @@ INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbrev INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('60','ippf_specific','contraceptive','Contraception','Contraception','C','4','0'); #EndIf +#IfMissingColumn issue_types active +ALTER TABLE `issue_types` ADD COLUMN `active` tinyint(1) NOT NULL DEFAULT '1'; +#EndIf + diff --git a/sql/database.sql b/sql/database.sql index 740a7fccc..4e3a0cab4 100644 --- a/sql/database.sql +++ b/sql/database.sql @@ -2360,6 +2360,7 @@ CREATE TABLE `issue_encounter` ( DROP TABLE IF EXISTS `issue_types`; CREATE TABLE `issue_types` ( + `active` tinyint(1) NOT NULL DEFAULT '1', `category` varchar(75) NOT NULL DEFAULT '', `type` varchar(75) NOT NULL DEFAULT '', `plural` varchar(75) NOT NULL DEFAULT '', diff --git a/version.php b/version.php index cf4bed9c7..0fb437665 100644 --- a/version.php +++ b/version.php @@ -17,7 +17,7 @@ $v_realpatch = '0'; // is a database change in the course of development. It is used // internally to determine when a database upgrade is needed. // -$v_database = 92; +$v_database = 93; // Access control version identifier, this is to be incremented whenever there // is a access control change in the course of development. It is used -- 2.11.4.GIT