fix: set default x12 partner for item in billing manager (#7513)
[openemr.git] / interface / forms / eye_mag / taskman.php
blobac97d55f1dd55e231e22eb0c2aa418e86f708be5
1 <?php
3 /**
4 * forms/eye_mag/taskman.php
6 * This file is the gateway to a practice's fax server.
7 * It uses an email fax gateway that is behind the corporate
8 * firewall, thus it is HIPPA compliant (at least TO the fax machine)
10 * @package OpenEMR
11 * @link https://www.open-emr.org
12 * @author Ray Magauran <rmagauran@gmail.com>
13 * @copyright Copyright (c) 2016 Raymond Magauran <rmagauran@gmail.com>
14 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
17 $form_name = "eye_mag";
18 $form_folder = "eye_mag";
19 // larry :: hack add for command line version
20 if (!$_SERVER['REQUEST_URI']) {
21 $_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF'];
24 if (!$_SERVER['SERVER_NAME']) {
25 $_SERVER['SERVER_NAME'] = 'localhost';
28 if (!$_SERVER['HTTP_HOST']) {
29 $_SERVER['HTTP_HOST'] = 'default'; //need to figure out how to do this for non-default installs
32 // Check if running as a cronjob
33 if (php_sapi_name() === 'cli') {
34 $ignoreAuth = 1;
35 // Since from command line, set $sessionAllowWrite since need to set site_id session and no benefit to set to false
36 $sessionAllowWrite = true;
38 require_once(__DIR__ . "/../../globals.php");
39 require_once("$srcdir/api.inc.php");
40 require_once("$srcdir/forms.inc.php");
41 require_once("php/" . $form_name . "_functions.php");
42 require_once($srcdir . "/../controllers/C_Document.class.php");
43 require_once($srcdir . "/documents.php");
45 require_once("$srcdir/patient.inc.php");
46 require_once("$srcdir/options.inc.php");
47 require_once("$srcdir/lists.inc.php");
48 require_once("$srcdir/report.inc.php");
49 require_once("php/taskman_functions.php");
50 require_once("report.php");
54 /**
56 * Script to fax something to someone somewhere.
57 * This is currently set up for an in house secure email-fax gateway.
58 * This will need to be modified to use a HylaFax server if that is what you use.
60 * We will need these as variables then:
61 * From, To, Object(s) to send
62 * These values are already in the openEMR DB, we just have to put them together correctly.
64 * The first use case scenario is to fax the report of today's visit to a PCP/Referring doctor.
65 * The second scenario is the creation (or re-creation) of a Report of the encounter.
66 * To lighten loads, consider breaking these tasks up into separate tasks via cron or even using a different server
67 * to process these tasks, if in a multi-server environment. Or run this file with openEMR's "background_services".
68 * Use a new table (form_taskman) to delineate this process.
69 * 1. Create the Task to be performed: send it to DB table from the browser.
70 * 2. Cron job to scour this table, performing tasks as loads allow (check server load? <-- not implemented)
71 * 3. If the Object is ready to be created, create it. (e-signed required? <-- not implemented)
72 * 4. If the Object is created and it is a Report, Flag DB done (completed =1).
73 * 5. If the Object is created and it is a Fax, send it, and Flag DB done.
76 global $encounter;
77 global $pid;
78 global $visit_date;
79 global $PDF_OUTPUT;
80 global $form_id;
81 global $task;
82 global $send;
84 $PDF_OUTPUT = '1';
85 // If this is a request to make a task, make it.
86 $ajax_req = $_REQUEST;
88 if ($_REQUEST['action'] == 'make_task') {
89 make_task($ajax_req);
92 if ($_REQUEST['action'] == 'show_task') {
93 show_task($ajax_req);
96 // Get the list of Tasks and process them one-by-one
97 // unless this is a call from the web, then just do the task at hand
98 // or should the web not do these at all, leave them to the background processor?
101 $query = "SELECT * FROM form_taskman where PATIENT_ID=? AND (COMPLETED is NULL or COMPLETED != '1') order by REQ_DATE";
102 $result = sqlStatement($query, array($ajax_req['pid']));
103 while ($task = sqlFetchArray($result)) {
104 $send = process_tasks($task);
105 if ($_REQUEST['action'] == 'make_task') {
106 echo json_encode($send);
107 exit;
111 $send['comments'] = "Nothing new to do!";
112 echo json_encode($send);
113 exit;