From 99a727cba3e62d8fdac4b15e3a21cdda6ef80933 Mon Sep 17 00:00:00 2001 From: Rod Roark Date: Wed, 14 Mar 2012 08:16:58 -0700 Subject: [PATCH] Added time slot availability checking at appointment save time to avoid double booking errors. --- acl_setup.php | 4 +- acl_upgrade.php | 2 +- interface/main/calendar/add_edit_event.php | 45 ++++++++++++----- interface/main/calendar/find_appt_popup.php | 78 ++++++++++++++++++++++++++--- library/acl.inc | 3 +- 5 files changed, 107 insertions(+), 25 deletions(-) diff --git a/acl_setup.php b/acl_setup.php index 1b7926787..bf8d16341 100644 --- a/acl_setup.php +++ b/acl_setup.php @@ -140,8 +140,8 @@ // Create ACOs for patients. // - $gacl->add_object('patients', 'Appointments (write optional)' , 'appt' , 10, 0, 'ACO'); - // xl('Appointments (write optional)') + $gacl->add_object('patients', 'Appointments (write,wsome optional)' , 'appt' , 10, 0, 'ACO'); + // xl('Appointments (write,wsome optional)') $gacl->add_object('patients', 'Demographics (write,addonly optional)' , 'demo' , 10, 0, 'ACO'); // xl('Demographics (write,addonly optional)') $gacl->add_object('patients', 'Medical/History (write,addonly optional)' , 'med' , 10, 0, 'ACO'); diff --git a/acl_upgrade.php b/acl_upgrade.php index 3f520a90e..4c96ab09c 100644 --- a/acl_upgrade.php +++ b/acl_upgrade.php @@ -219,7 +219,7 @@ updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'language', 'La //Insert the 'ethrace' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0) updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write'); //Insert the 'appt' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0) -updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'appt', 'Appointments (write optional)', 'write'); +updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'appt', 'Appointments (write,wsome optional)', 'write'); //Insert the 'demo' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0) updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'demo', 'Demographics (write,addonly optional)', 'write'); //Insert the 'med' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0) diff --git a/interface/main/calendar/add_edit_event.php b/interface/main/calendar/add_edit_event.php index c81eb9285..e5f24f0fa 100644 --- a/interface/main/calendar/add_edit_event.php +++ b/interface/main/calendar/add_edit_event.php @@ -23,13 +23,18 @@ $fake_register_globals=false; $sanitize_all_escapes=true; - include_once("../../globals.php"); - include_once("$srcdir/patient.inc"); - include_once("$srcdir/forms.inc"); - include_once("$srcdir/calendar.inc"); - include_once("$srcdir/formdata.inc.php"); - include_once("$srcdir/options.inc.php"); - include_once("$srcdir/encounter_events.inc.php"); + require_once("../../globals.php"); + require_once("$srcdir/patient.inc"); + require_once("$srcdir/forms.inc"); + require_once("$srcdir/calendar.inc"); + require_once("$srcdir/formdata.inc.php"); + require_once("$srcdir/options.inc.php"); + require_once("$srcdir/encounter_events.inc.php"); + require_once("$srcdir/acl.inc"); + + $my_permission = acl_check('patients', 'appt'); + if ($my_permission !== 'write' && $my_permission !== 'wsome') + die(xl('Access not allowed')); // Things that might be passed by our opener. // @@ -918,7 +923,7 @@ td { font-size:0.8em; } } // Invoke the find-available popup. - function find_available() { + function find_available(extra) { top.restoreSession(); // (CHEMED) Conditional value selection, because there is no