6 * @link http://www.open-emr.org
7 * @author Sherwin Gaddis <sherwingaddis@gmail.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2016-2017 Sherwin Gaddis <sherwingaddis@gmail.com>
10 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once('../globals.php');
17 use OpenEMR\Rx\Weno\TransmitData
;
19 if (!verifyCsrfToken($_GET["csrf_token_form"])) {
24 $pid = $GLOBALS['pid'];
25 $uid = $_SESSION['authUserID'];
27 $validation = new TransmitData();
29 $patient = $validation->validatePatient($pid);
30 $pharmacy = $validation->patientPharmacyInfo($pid);
32 if (empty($GLOBALS['weno_account_id'])) {
33 print xlt("Weno Account ID information missing")."<br>";
36 if (empty($GLOBALS['weno_provider_id'])) {
37 print xlt("Weno Account Clinic ID information missing")."<br>";
40 if (empty($patient['DOB'])) {
41 print xlt("Patient DOB missing"). "<br>";
44 if (empty($patient['street'])) {
45 print xlt("Patient street missing"). "<br>";
48 if (empty($patient['postal_code'])) {
49 print xlt("Patient Zip Code missing"). "<br>";
52 if (empty($patient['city'])) {
53 print xlt("Patient city missing"). "<br>";
56 if (empty($patient['state'])) {
57 print xlt("Patient state missing"). "<br>";
60 if (empty($patient['sex'])) {
61 print xlt("Patient sex missing"). "<br>";
64 if (empty($pharmacy['name'])) {
65 print xlt("Pharmacy not assigned to the patient"). "<br>";
68 $ncpdpLength = strlen($pharmacy['ncpdp']);
69 if (empty($pharmacy['ncpdp']) ||
$ncpdpLength < 10) {
70 print xlt("Pharmacy missing NCPDP ID or less than 10 digits"). "<br>";
73 $npiLength = strlen($pharmacy['npi']);
74 if (empty($pharmacy['npi'] ||
$npiLength < 7)) {
75 print xlt("Pharmacy missing NPI or less than 7 digits"). "<br>";
79 //Test if the NPI is a valid number on file
80 $seekvalidation = $validation->validateNPI($pharmacy['npi']);
81 if ($seekvalidation == 0) {
82 print xlt("Please use valid NPI");
85 header('Location: confirm.php');