From b4a332642c80e82fa398985a4c20f44559bd2fb0 Mon Sep 17 00:00:00 2001 From: Brady Miller Date: Mon, 12 Mar 2018 22:51:41 -0700 Subject: [PATCH] php fixes for #1488 #1482 #1480 #1478 #1472 #1466 #1465 #1485 --- gacl/gacl_api.class.php | 4 +-- interface/main/main_info.php | 23 +++++------------ interface/patient_file/encounter/forms.php | 16 ++++++++---- interface/patient_file/history/encounters.php | 28 ++++++-------------- interface/patient_file/report/custom_report.php | 32 ++++++++--------------- interface/patient_file/summary/immunizations.php | 33 +++++++++--------------- interface/reports/svc_code_financial_report.php | 2 +- library/html2pdf/_class/locale.class.php | 2 +- 8 files changed, 52 insertions(+), 88 deletions(-) diff --git a/gacl/gacl_api.class.php b/gacl/gacl_api.class.php index 493fbab26..78152a905 100644 --- a/gacl/gacl_api.class.php +++ b/gacl/gacl_api.class.php @@ -940,12 +940,12 @@ class gacl_api extends gacl { $this->debug_text("add_acl():"); - if (count($aco_array) == 0) { + if (empty($aco_array) || count($aco_array) == 0) { $this->debug_text("Must select at least one Access Control Object"); return false; } - if (count($aro_array) == 0 AND count($aro_group_ids) == 0) { + if ((empty($aco_array) || count($aro_array) == 0) AND (empty($aro_group_ids) || count($aro_group_ids) == 0)) { $this->debug_text("Must select at least one Access Request Object or Group"); return false; } diff --git a/interface/main/main_info.php b/interface/main/main_info.php index 76a36eb94..0744bc861 100644 --- a/interface/main/main_info.php +++ b/interface/main/main_info.php @@ -2,25 +2,14 @@ /** * Main info frame. * - * LICENSE: This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see ;. - * - * @package OpenEMR - * @author Brady Miller - * @link http://www.open-emr.org + * @package OpenEMR + * @link http://www.open-emr.org + * @author Brady Miller + * @copyright Copyright (c) 2018 Brady Miller + * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 */ - - require_once("../globals.php"); ?> @@ -63,7 +52,7 @@ if (isset($_SESSION['viewtype'])) { $pcuStr = "pc_username=".$_SESSION['authUser']; if (isset($_SESSION['pc_username'])) { $pcuStr = ""; - if (count($_SESSION['pc_username']) > 1) { + if (!empty($_SESSION['pc_username']) && is_array($_SESSION['pc_username']) && count($_SESSION['pc_username']) > 1) { // loop over the array of values in pc_username to build // a list of pc_username HTTP vars foreach ($_SESSION['pc_username'] as $pcu) { diff --git a/interface/patient_file/encounter/forms.php b/interface/patient_file/encounter/forms.php index ec0ea0be5..184c6936d 100644 --- a/interface/patient_file/encounter/forms.php +++ b/interface/patient_file/encounter/forms.php @@ -1,8 +1,14 @@ + * @copyright Copyright (c) 2018 Brady Miller + * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 + */ + require_once("../../globals.php"); require_once("$srcdir/encounter.inc"); @@ -869,7 +875,7 @@ if ($attendant_type == 'pid') { // already doesn't exist document for therapy groups $docs_list = array(); } -if (count($docs_list) > 0) { +if (!empty($docs_list) && count($docs_list) > 0) { ?>
: diff --git a/interface/patient_file/history/encounters.php b/interface/patient_file/history/encounters.php index 6639f910a..2746758fa 100644 --- a/interface/patient_file/history/encounters.php +++ b/interface/patient_file/history/encounters.php @@ -2,28 +2,16 @@ /** * Encounter list. * - * Copyright (C) 2015 Roberto Vasquez - * - * LICENSE: This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see ;. - * - * @package OpenEMR - * @author Brady Miller - * @author Roberto Vasquez - * @link http://www.open-emr.org + * @package OpenEMR + * @link http://www.open-emr.org + * @author Roberto Vasquez + * @author Brady Miller + * @copyright Copyright (c) 2015 Roberto Vasquez + * @copyright Copyright (c) 2018 Brady Miller + * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 */ - - require_once("../../globals.php"); require_once("$srcdir/forms.inc"); require_once("$srcdir/billing.inc"); @@ -94,7 +82,7 @@ function getDocListByEncID($encounter, $raw_encounter_date, $pid) global $ISSUE_TYPES, $auth_med; $documents = getDocumentsByEncounter($pid, $encounter); - if (count($documents) > 0) { + if (!empty($documents) && count($documents) > 0) { foreach ($documents as $documentrow) { if ($auth_med) { $irow = sqlQuery("SELECT type, title, begdate FROM lists WHERE id = ? LIMIT 1", array($documentrow['list_id'])); diff --git a/interface/patient_file/report/custom_report.php b/interface/patient_file/report/custom_report.php index 2c35fd7db..8af657970 100644 --- a/interface/patient_file/report/custom_report.php +++ b/interface/patient_file/report/custom_report.php @@ -1,29 +1,18 @@ ;. - * - * @package OpenEMR - * @author Brady Miller - * @author Ken Chapple - * @author Tony McCormick - * @author Jerry Padgett - * @link http://www.open-emr.org + * @package OpenEMR + * @link http://www.open-emr.org + * @author Brady Miller + * @author Ken Chapple + * @author Tony McCormick + * @author Jerry Padgett + * @copyright Copyright (c) 2018 Brady Miller + * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 */ + require_once("../../globals.php"); require_once("$srcdir/forms.inc"); require_once("$srcdir/billing.inc"); @@ -41,6 +30,7 @@ if ($GLOBALS['gbl_portal_cms_enable']) { } require_once("$srcdir/appointments.inc.php"); +use ESign\Api; use OpenEMR\Services\FacilityService; $facilityService = new FacilityService(); @@ -429,7 +419,7 @@ foreach ($ar as $key => $val) { echo "
"; echo "
"; print "

".xl('Billing Information').":

"; - if (count($ar['newpatient']) > 0) { + if (!empty($ar['newpatient']) && count($ar['newpatient']) > 0) { $billings = array(); echo ""; echo "\n"; diff --git a/interface/patient_file/summary/immunizations.php b/interface/patient_file/summary/immunizations.php index 2cbb9c94f..d6b671099 100644 --- a/interface/patient_file/summary/immunizations.php +++ b/interface/patient_file/summary/immunizations.php @@ -2,26 +2,17 @@ /** * Immunizations * - * - * LICENSE: This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 3 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see ;. - * - * @package OpenEMR - * @author Brady Miller - * @link http://www.open-emr.org + * @package OpenEMR + * @link http://www.open-emr.org + * @author Brady Miller + * @copyright Copyright (c) 2018 Brady Miller + * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 */ -include_once("../../globals.php"); -include_once("$srcdir/options.inc.php"); -include_once("$srcdir/immunization_helper.php"); + +require_once("../../globals.php"); +require_once("$srcdir/options.inc.php"); +require_once("$srcdir/immunization_helper.php"); if (isset($_GET['mode'])) { /* @@ -256,7 +247,7 @@ function getImmunizationObservationResults() function saveImmunizationObservationResults($id, $immunizationdata) { $imm_obs_data = getImmunizationObservationResults(); - if (count($imm_obs_data) > 0) { + if (!empty($imm_obs_data) && count($imm_obs_data) > 0) { foreach ($imm_obs_data as $key => $val) { if ($val['imo_id'] && $val['imo_id'] != 0) { $sql2 = " DELETE @@ -570,7 +561,7 @@ var mypcc = '
Code".xl('Fee')."
0) { + if (!empty($imm_obs_data) && count($imm_obs_data) > 0) { foreach ($imm_obs_data as $key => $value) { $key_snomed = 0; $key_cvx = 0; @@ -755,7 +746,7 @@ value="'> - + diff --git a/interface/reports/svc_code_financial_report.php b/interface/reports/svc_code_financial_report.php index 5f903cc0a..a99674158 100644 --- a/interface/reports/svc_code_financial_report.php +++ b/interface/reports/svc_code_financial_report.php @@ -342,7 +342,7 @@ if ($_POST['form_refresh'] || $_POST['form_csvexport']) { } if (! $_POST['form_csvexport']) { - if ($_POST['form_refresh'] && count($print) != 1) { + if ($_POST['form_refresh'] && empty($print)) { echo ""; echo xlt('No matches found. Try search again.'); echo ""; diff --git a/library/html2pdf/_class/locale.class.php b/library/html2pdf/_class/locale.class.php index 6170066b1..656dfbcd4 100644 --- a/library/html2pdf/_class/locale.class.php +++ b/library/html2pdf/_class/locale.class.php @@ -65,7 +65,7 @@ class HTML2PDF_locale $handle = fopen($file, 'r'); while (!feof($handle)) { $line = fgetcsv($handle); - if (count($line)!=2) continue; + if (empty($line) || count($line)!=2) continue; self::$_list[trim($line[0])] = trim($line[1]); } fclose($handle); -- 2.11.4.GIT