3 * Functions to globally validate and prepare data for sql database insertion.
6 * @link http://www.open-emr.org
7 * @author MMF Systems, Inc
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @author Jerry Padgett <sjpadgett@gmail.com>
10 * @copyright Copyright (c) 2010 MMF Systems, Inc
11 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
12 * @copyright Copyright (c) 2019 Jerry Padgett <sjpadgett@gmail.com>
13 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
16 require_once(dirname(__file__
)."/../globals.php");
17 require_once("$srcdir/forms.inc");
18 require_once("$srcdir/patient.inc");
19 require_once("$srcdir/report.inc");
20 require_once("$srcdir/calendar.inc");
21 require_once("$srcdir/edi.inc");
23 use OpenEMR\Core\Header
;
26 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
31 // File location (URL or server path)
32 $target = $GLOBALS['edi_271_file_path'];
35 if (isset($_FILES) && !empty($_FILES)) {
36 $target = $target .time().basename($_FILES['uploaded']['name']);
38 if ($_FILES['uploaded']['size'] > 350000) {
39 $message .= xlt('Your file is too large')."<br>";
41 if ($_FILES['uploaded']['type']!="text/plain") {
42 $message .= xlt('You may only upload .txt files')."<br>";
44 if (!isset($message)) {
45 $file_location = move_uploaded_file($_FILES['uploaded']['tmp_name'], $target);
46 $message = xlt('The following EDI file has been uploaded') . ': "' . text(basename($_FILES['uploaded']['name'])) . '"';
47 $Response271 = file($_FILES['uploaded']['tmp_name']);
48 $batch_log = parseEdi271($Response271);
50 $message .= xlt('Sorry, there was a problem uploading your file') . "<br><br>";
53 if ($batch_log && !$GLOBALS['disable_eligibility_log']) {
55 'elig-batch_log_%s.txt',
58 $batch_log = str_replace('~', "~\r", $batch_log);
59 while (@ob_end_flush
()) {
61 header('Content-Type: text/plain');
62 header("Content-Length: " . strlen($batch_log));
63 header('Content-Disposition: attachment; filename="' . $fn . '"');
71 <title
><?php
echo xlt('EDI-271 Response File Upload'); ?
></title
>
73 <?php Header
::setupHeader(['no_bootstrap', 'no_fontawesome']); ?
>
75 <style type
="text/css">
76 /* specifically include & exclude from printing */
82 #report_parameters_daterange {
86 #report_results table {
90 /* specifically exclude some from the screen */
92 #report_parameters_daterange {
98 <script type
="text/javascript">
99 function edivalidation() {
100 var mypcc
= <?php
echo xlj('Required Field Missing: Please choose the EDI-271 file to upload'); ?
>;
101 if (document
.getElementById('uploaded').value
== "") {
105 $
("#theform").trigger("submit");
110 <body
class="body_top">
111 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
112 <?php
if (isset($message) && !empty($message)) { ?
>
113 <div style
="margin-left:25%;width:50%;color:RED;text-align:center;font-family:arial;font-size:15px;background:#ECECEC;border:1px solid;" ><?php
echo $message; ?
></div
>
117 if (isset($messageEDI)) { ?
>
118 <div style
="margin-left:25%;width:50%;color:RED;text-align:center;font-family:arial;font-size:15px;background:#ECECEC;border:1px solid;" >
119 <?php
echo xlt('Please choose the proper formatted EDI-271 file'); ?
>
125 <span
class='title'><?php
echo xlt('EDI-271 File Upload'); ?
></span
>
126 <form enctype
="multipart/form-data" name
="theform" id
="theform" action
="edi_271.php" method
="POST" onsubmit
="return top.restoreSession()">
127 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
128 <div id
="report_parameters">
132 <div style
='float:left'>
135 <td style
='width:125px;' class='label_custom'> <?php
echo xlt('Select EDI-271 file'); ?
>: </td
>
136 <td
> <input name
="uploaded" id
="uploaded" type
="file" size
=37 /></td
>
141 <td align
='left' valign
='middle' height
="100%">
142 <table style
='border-left:1px solid; width:100%; height:100%' >
145 <div style
='margin-left:15px'>
146 <a href
='#' class='css_button' onclick
='return edivalidation(); '><span
><?php
echo xlt('Upload'); ?
></span
>
156 <input type
="hidden" name
="form_orderby" value
="<?php echo attr($form_orderby); ?>" />
157 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>