From 4d99e67130dd1d9400aa051de6eb1a1a3eccb43e Mon Sep 17 00:00:00 2001 From: lemonsoftwarero Date: Fri, 26 Oct 2007 11:07:05 +0000 Subject: [PATCH] Add facilities filter in calendar view. --- interface/main/calendar/add_edit_event.php | 73 +++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 11 deletions(-) diff --git a/interface/main/calendar/add_edit_event.php b/interface/main/calendar/add_edit_event.php index b72993fc8..d4581ee5f 100644 --- a/interface/main/calendar/add_edit_event.php +++ b/interface/main/calendar/add_edit_event.php @@ -53,6 +53,33 @@ $info_msg = ""; +// =========================== +// EVENTS TO FACILITIES (lemonsoftware) +// edit event case - if there is no association made, then insert one with the first facility +if ( $eid ) { + $selfacil = ''; + $facility = sqlQuery("SELECT pc_facility, pc_multiple FROM openemr_postcalendar_events WHERE pc_eid = $eid"); + if ( !$facility['pc_facility'] ) { + $qmin = sqlQuery("SELECT MIN(id) as minId FROM facility"); + $min = $qmin['minId']; + + // multiple providers case + if ( $GLOBALS['select_multi_providers'] ) { + $mul = $facility['pc_multiple']; + sqlStatement("UPDATE openemr_postcalendar_events SET pc_facility = $min WHERE pc_multiple = $mul"); + } + // EOS multiple + + sqlStatement("UPDATE openemr_postcalendar_events SET pc_facility = $min WHERE pc_eid = $eid"); + $e2f = $minId; + } else { + $e2f = $facility['pc_facility']; + } +} +// EOS E2F +// =========================== + + // If we are saving, then save and close the window. // if ($_POST['form_save']) { @@ -136,7 +163,7 @@ $r2 = array_diff ($providers_new, $providers_current); if (count ($r2)) { foreach ($r2 as $to_be_inserted) { - sqlInsert("INSERT INTO openemr_postcalendar_events ( pc_catid, pc_multiple, pc_aid, pc_pid, pc_title, pc_time, pc_hometext, pc_informant, pc_eventDate, pc_endDate, pc_duration, pc_recurrtype, pc_recurrspec, pc_startTime, pc_endTime, pc_alldayevent, pc_apptstatus, pc_prefcatid, pc_location, pc_eventstatus, pc_sharing) + sqlInsert("INSERT INTO openemr_postcalendar_events ( pc_catid, pc_multiple, pc_aid, pc_pid, pc_title, pc_time, pc_hometext, pc_informant, pc_eventDate, pc_endDate, pc_duration, pc_recurrtype, pc_recurrspec, pc_startTime, pc_endTime, pc_alldayevent, pc_apptstatus, pc_prefcatid, pc_location, pc_eventstatus, pc_sharing, pc_facility) VALUES ( " . "'" . $_POST['form_category'] . "', " . "'" . $row['pc_multiple'] . "', " . @@ -158,7 +185,7 @@ "'" . $_POST['form_prefcat'] . "', " . "'$locationspec', " . "1, " . - "1 )"); + "1, " .(int)$_POST['facility']. " )"); // FF stuff } // foreach } //if count @@ -183,6 +210,7 @@ "pc_alldayevent = '" . $_POST['form_allday'] . "', " . "pc_apptstatus = '" . $_POST['form_apptstatus'] . "', " . "pc_prefcatid = '" . $_POST['form_prefcat'] . "' " . + "pc_facility = '" .(int)$_POST['facility'] ."' " . // FF stuff "WHERE pc_aid = '$provider' AND pc_multiple={$row['pc_multiple']}"); } // foreach @@ -220,6 +248,13 @@ } +// ======================================= +// EOS multi providers case +// ======================================= + + // EVENTS TO FACILITIES + $e2f = (int)$eid; + /* ======================================================= // INSERT EVENTS ========================================================*/ @@ -241,7 +276,7 @@ if (is_array($_POST['form_provider'])) { "pc_catid, pc_multiple, pc_aid, pc_pid, pc_title, pc_time, pc_hometext, " . "pc_informant, pc_eventDate, pc_endDate, pc_duration, pc_recurrtype, " . "pc_recurrspec, pc_startTime, pc_endTime, pc_alldayevent, " . - "pc_apptstatus, pc_prefcatid, pc_location, pc_eventstatus, pc_sharing " . + "pc_apptstatus, pc_prefcatid, pc_location, pc_eventstatus, pc_sharing, pc_facility " . ") VALUES ( " . "'" . $_POST['form_category'] . "', " . "'" . $new_multiple_value . "', " . @@ -263,14 +298,10 @@ if (is_array($_POST['form_provider'])) { "'" . $_POST['form_prefcat'] . "', " . "'$locationspec', " . "1, " . - "1 )"); + "1, " .(int)$_POST['facility']. " )"); // FF stuff } // foreach -// ======================================= -// EOS multi providers case -// ======================================= - } else { sqlInsert("INSERT INTO openemr_postcalendar_events ( " . "pc_catid, pc_aid, pc_pid, pc_title, pc_time, pc_hometext, " . @@ -297,11 +328,10 @@ sqlInsert("INSERT INTO openemr_postcalendar_events ( " . "'" . $_POST['form_prefcat'] . "', " . "'$locationspec', " . "1, " . - "1 )"); - } + "1," .(int)$_POST['facility']. ")"); // FF stuff + } // INSERT single } // else - insert - // Save new DOB if it's there. $patient_dob = trim($_POST['form_dob']); if ($patient_dob && $_POST['form_pid']) { @@ -716,6 +746,27 @@ td { font-size:10pt; } + + : + + + + + : -- 2.11.4.GIT