From 82ec6c84aaabc9271b6f9a61aecf9160c0cca5bc Mon Sep 17 00:00:00 2001 From: Brady Miller Date: Thu, 23 Mar 2023 15:20:12 +0800 Subject: [PATCH] fix: psr12 fixes (#6302) --- interface/patient_file/summary/demographics.php | 4 ++-- library/appointments.inc.php | 14 +++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/interface/patient_file/summary/demographics.php b/interface/patient_file/summary/demographics.php index e2c5e52a6..831c5d857 100644 --- a/interface/patient_file/summary/demographics.php +++ b/interface/patient_file/summary/demographics.php @@ -1778,11 +1778,11 @@ $oemr_ui = new OemrUI($arrOeUiSettings); if (isset($pid) && !$GLOBALS['disable_calendar'] && $showpast > 0 && AclMain::aclCheckCore('patients', 'appt')) { $displayPastAppts = true; - $pastAppts=fetchXPastAppts($pid, $showpast, $direction); // This line added by epsdky + $pastAppts = fetchXPastAppts($pid, $showpast, $direction); // This line added by epsdky $count = 0; - foreach($pastAppts as $row) { + foreach ($pastAppts as $row) { $count++; $dayname = date("D", strtotime($row['pc_eventDate'])); $displayMeridiem = ($GLOBALS['time_display_format'] == 0) ? "" : "am"; diff --git a/library/appointments.inc.php b/library/appointments.inc.php index d485baf22..3ebf66ac3 100644 --- a/library/appointments.inc.php +++ b/library/appointments.inc.php @@ -437,7 +437,8 @@ function fetchNextXAppts($from_date, $patient_id, $nextX = 1, $group_id = null) return $nextXAppts; } -function fetchXPastAppts($pid2, $pastApptsNumber, $orderOfAppts = '1') { +function fetchXPastAppts($pid2, $pastApptsNumber, $orderOfAppts = '1') +{ $currentDate = date("Y-m-d"); $totalAppts = []; @@ -448,7 +449,6 @@ function fetchXPastAppts($pid2, $pastApptsNumber, $orderOfAppts = '1') { $row2 = sqlFetchArray($res2); if ($row2['minDate']) { - $periodOf = '26'; $limitRight = date("Y-m-d", strtotime("$currentDate -1 day")); $limitLeft = date("Y-m-d", strtotime("$limitRight -$periodOf weeks")); @@ -456,33 +456,25 @@ function fetchXPastAppts($pid2, $pastApptsNumber, $orderOfAppts = '1') { $count2 = 0; while (($limitRight >= $apptRangeLeft) && ($count2 < $pastApptsNumber)) { - $appts2 = fetchAppointments($limitLeft, $limitRight, $pid2); $totalAppts = array_merge($appts2, $totalAppts); $limitRight = date("Y-m-d", strtotime("$limitLeft -1 day")); $limitLeft = date("Y-m-d", strtotime("$limitRight -$periodOf weeks")); $count2 = count($totalAppts); - } - if($orderOfAppts == '1') { - + if ($orderOfAppts == '1') { $eventDate = array_column($totalAppts, 'pc_eventDate'); $eventTime = array_column($totalAppts, 'pc_startTime'); array_multisort($eventDate, SORT_ASC, $eventTime, SORT_ASC, $totalAppts); $totalAppts = array_slice($totalAppts, -$pastApptsNumber, $pastApptsNumber); - } else if ($orderOfAppts == '2') { - $eventDate = array_column($totalAppts, 'pc_eventDate'); $eventTime = array_column($totalAppts, 'pc_startTime'); array_multisort($eventDate, SORT_DESC, $eventTime, SORT_ASC, $totalAppts); $totalAppts = array_slice($totalAppts, 0, $pastApptsNumber); - } - } return $totalAppts; - } // get the event slot size in seconds -- 2.11.4.GIT