fix: Update patient_tracker.php (#6595)
[openemr.git] / library / ajax / billing_tracker_ajax.php
blobbe7e61f81565d6d0e4fd178383a025ce7b551f85
1 <?php
3 /**
4 * Ajax endpoint for interface/billing/billing_tracker.php,
5 * which is the interface that provides tracking information for a claim batch
7 * @package OpenEMR
8 * @link http://www.open-emr.org
9 * @author Ken Chapple <ken@mi-squared.com>
10 * @copyright Copyright (c) 2021 Ken Chapple <ken@mi-squared.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once __DIR__ . "/../../interface/globals.php";
16 use OpenEMR\Billing\BillingProcessor\X12RemoteTracker;
17 use OpenEMR\Common\Csrf\CsrfUtils;
19 // verify csrf
20 if (!CsrfUtils::verifyCsrfToken($_GET["csrf_token_form"])) {
21 CsrfUtils::csrfNotVerified();
24 $remoteTracker = new X12RemoteTracker();
25 $claim_files = $remoteTracker->fetchAll();
26 $response = new stdClass();
27 $response->data = [];
28 foreach ($claim_files as $claim_file) {
29 $element = new stdClass();
30 $element->x12_partner_id = text($claim_file['x12_partner_id']);
31 $element->x12_partner_name = text($claim_file['name']);
32 $element->x12_filename = text($claim_file['x12_filename']);
33 $element->status = xl($claim_file['status']);
34 $element->created_at = oeFormatDateTime($claim_file['created_at']);
35 $element->updated_at = oeFormatDateTime($claim_file['updated_at']);
36 $element->claims = json_decode($claim_file['claims']);
37 $element->messages = json_decode($claim_file['messages'] ?? '');
38 $response->data[] = $element;
41 echo json_encode($response);
42 exit();