Improved/optimized CDR engine reports (and patient reminders) and added a
[openemr.git] / library / ajax / execute_pat_reminder.php
blobc3438a6080e8584767e765429f3415f7f679b9af
1 <?php
2 /**
3 * Process/send clinical reminders.
5 * Copyright (C) 2012 Brady Miller <brady@sparmy.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Brady Miller <brady@sparmy.com>
20 * @link http://www.open-emr.org
23 //SANITIZE ALL ESCAPES
24 $sanitize_all_escapes=true;
27 //STOP FAKE REGISTER GLOBALS
28 $fake_register_globals=false;
31 require_once(dirname(__FILE__) . "/../../interface/globals.php");
32 require_once(dirname(__FILE__) . "/../reminders.php");
34 //To improve performance and not freeze the session when running this
35 // report, turn off session writing. Note that php session variables
36 // can not be modified after the line below. So, if need to do any php
37 // session work in the future, then will need to remove this line.
38 session_write_close();
40 //Remove time limit, since script can take many minutes
41 set_time_limit(0);
43 // Set the "nice" level of the process for these reports. When the "nice" level
44 // is increased, these cpu intensive reports will have less affect on the performance
45 // of other server activities, albeit it may negatively impact the performance
46 // of this report (note this is only applicable for linux).
47 if (!empty($GLOBALS['pat_rem_clin_nice'])) {
48 proc_nice($GLOBALS['pat_rem_clin_nice']);
51 // Start a report, which will be stored in the report_results sql table..
52 if ( (!empty($_POST['execute_report_id']) && !empty($_POST['process_type'])) && (($_POST['process_type'] == "process" ) || ($_POST['process_type'] == "process_send")) ) {
54 if ($_POST['process_type'] == "process_send") {
55 update_reminders_batch_method('','',$_POST['execute_report_id'],TRUE);
57 else { // $_POST['process_type'] == "process"
58 update_reminders_batch_method('','',$_POST['execute_report_id']);
61 else {
62 echo "ERROR";