Interim autoloaded library/classes via composer classmap, take 4. (#422)
[openemr.git] / interface / forms / eye_mag / taskman.php
blob4b64397c82182abf21c9ce496911e7a0413fdc36
1 <?php
2 /**
3 * forms/eye_mag/taskman.php
5 * This file is the gateway to a practice's fax server.
6 * It uses an email fax gateway that is behind the corporate
7 * firewall, thus it is HIPPA compliant (at least TO the fax machine)
9 * Copyright (C) 2016 Raymond Magauran <magauran@MedFetch.com>
11 * LICENSE: This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 3
14 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @package OpenEMR
23 * @author Ray Magauran <magauran@MedFetch.com>
24 * @link http://www.open-emr.org
28 $fake_register_globals=false;
29 $sanitize_all_escapes=true;
31 $form_name = "eye_mag";
32 $form_folder="eye_mag";
33 // larry :: hack add for command line version
34 if (!$_SERVER['REQUEST_URI']) $_SERVER['REQUEST_URI']=$_SERVER['PHP_SELF'];
35 if (!$_SERVER['SERVER_NAME']) $_SERVER['SERVER_NAME']='localhost';
36 if (!$_SERVER['HTTP_HOST']) $_SERVER['HTTP_HOST']='default'; //need to figure out how to do this for non-default installs
37 $ignoreAuth=1;
39 require_once("../../globals.php");
40 require_once("$srcdir/acl.inc");
41 require_once("$srcdir/html2pdf/vendor/autoload.php");
42 require_once("$srcdir/api.inc");
43 require_once("$srcdir/forms.inc");
44 require_once("php/".$form_name."_functions.php");
45 require_once("$srcdir/formatting.inc.php");
46 require_once($srcdir . "/../controllers/C_Document.class.php");
47 require_once($srcdir . "/documents.php");
49 require_once("$srcdir/patient.inc");
50 require_once("$srcdir/options.inc.php");
51 require_once("$srcdir/acl.inc");
52 require_once("$srcdir/lists.inc");
53 require_once("$srcdir/report.inc");
54 require_once("$srcdir/html2pdf/html2pdf.class.php");
55 require_once("php/taskman_functions.php");
56 require_once("report.php");
60 /**
62 * Script to fax something to someone somewhere.
63 * This is currently set up for an in house secure email-fax gateway.
64 * This will need to be modified to use a HylaFax server if that is what you use.
66 * We will need these as variables then:
67 * From, To, Object(s) to send
68 * These values are already in the openEMR DB, we just have to put them together correctly.
70 * The first use case scenario is to fax the report of today's visit to a PCP/Referring doctor.
71 * The second scenario is the creation (or re-creation) of a Report of the encounter.
72 * To lighten loads, consider breaking these tasks up into separate tasks via cron or even using a different server
73 * to process these tasks, if in a multi-server environment. Or run this file with openEMR's "background_services".
74 * Use a new table (form_taskman) to delineate this process.
75 * 1. Create the Task to be performed: send it to DB table from the browser.
76 * 2. Cron job to scour this table, performing tasks as loads allow (check server load? <-- not implemented)
77 * 3. If the Object is ready to be created, create it. (e-signed required? <-- not implemented)
78 * 4. If the Object is created and it is a Report, Flag DB done (completed =1).
79 * 5. If the Object is created and it is a Fax, send it, and Flag DB done.
82 global $encounter;
83 global $pid;
84 global $visit_date;
85 global $PDF_OUTPUT;
86 global $form_id;
87 global $task;
88 global $send;
90 $PDF_OUTPUT='1';
91 // If this is a request to make a task, make it.
92 $ajax_req = $_REQUEST;
94 if ($_REQUEST['action']=='make_task') make_task($ajax_req);
95 if ($_REQUEST['action']=='show_task') show_task($ajax_req);
97 // Get the list of Tasks and process them one-by-one
98 // unless this is a call from the web, then just do the task at hand
99 // or should the web not do these at all, leave them to the background processor?
102 $query = "SELECT * FROM form_taskman where PATIENT_ID=? AND (COMPLETED is NULL or COMPLETED != '1') order by REQ_DATE";
103 $result = sqlStatement($query,array($ajax_req['pid']));
104 while ($task= sqlFetchArray($result)) {
105 $send = process_tasks($task);
106 if ($_REQUEST['action']=='make_task') {
107 echo json_encode($send);
108 exit;
111 $send['comments'] = "Nothing new to do!";
112 echo json_encode($send);
113 exit;