Add back popup dialogs for tabs U.I. (#1434)
[openemr.git] / portal / account / account.php
blobd40bf03b7510e1ba3abbaf03db66af2e1b8a8bd6
1 <?php
2 /**
3 * Ajax Handler for Register
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Jerry Padgett <sjpadgett@gmail.com>
8 * @copyright Copyright (c) 2017 Jerry Padgett <sjpadgett@gmail.com>
9 * @license https://www.gnu.org/licenses/agpl-3.0.en.html GNU Affero General Public License 3
12 session_start();
13 if ($_SESSION['patient_portal_onsite_two'] && $_SESSION['pid']) {
14 $ignoreAuth_onsite_portal_two = true;
17 require_once("../../interface/globals.php");
18 require_once("$srcdir/patient.inc");
19 require_once(dirname(__FILE__) . "/../lib/portal_mail.inc");
20 require_once("$srcdir/pnotes.inc");
21 require_once("./account.lib.php");
23 $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
25 if ($action == 'set_lang') {
26 $_SESSION['language_choice'] = (int) $_REQUEST['value'];
27 echo 'okay';
28 exit();
29 } elseif ($action == 'get_newpid') {
30 $email = isset($_REQUEST['email']) ? $_REQUEST['email'] : '';
31 $rtn = isNew($_REQUEST['dob'], $_REQUEST['last'], $_REQUEST['first'], $email);
32 if ((int) $rtn != 0) {
33 echo xlt("This account already exists.") . "\r\n\r\n" . xlt("If you are having troubles logging into your account.") . "\r\n" . xlt("Please contact your provider.") . "\r\n" . xlt("Reference this Account Id: ") . $rtn;
34 exit();
36 $rtn = getNewPid();
37 echo "$rtn";
39 exit();
40 } elseif ($action == 'is_new') {
41 $email = isset($_REQUEST['email']) ? $_REQUEST['email'] : '';
42 $rtn = isNew($_REQUEST['dob'], $_REQUEST['last'], $_REQUEST['first'], $email);
43 echo "$rtn";
45 exit();
46 } elseif ($action == 'do_signup') {
47 $rtn = doCredentials($_REQUEST['pid']);
48 echo "$rtn";
50 exit();
51 } elseif ($action == 'new_insurance') {
52 $pid = $_REQUEST['pid'];
53 saveInsurance($pid);
55 exit();
56 } elseif ($action == 'notify_admin') {
57 $pid = $_REQUEST['pid'];
58 $provider = $_REQUEST['provider'];
59 $rtn = notifyAdmin($pid, $provider);
60 echo "$rtn";
62 exit();
63 } elseif ($action == 'cleanup') {
64 unset($_SESSION['patient_portal_onsite_two']);
65 unset($_SESSION['authUser']);
66 unset($_SESSION['pid']);
67 unset($_SESSION['site_id']);
68 unset($_SESSION['register']);
69 echo 'gone';
70 session_destroy(); // I know, makes little sense.
71 } else {
72 exit();
74 die(); //too be sure