Highway to PSR2
[openemr.git] / interface / forms / transfer_summary / save.php
blob77905f82150e9d985d1744ed525150c81c13f5de
1 <?php
2 /**
4 * Copyright (C) 2012-2013 Naina Mohamed <naina@capminds.com> CapMinds Technologies
6 * LICENSE: This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
17 * @package OpenEMR
18 * @author Naina Mohamed <naina@capminds.com>
19 * @link http://www.open-emr.org
23 include_once("../../globals.php");
24 include_once("$srcdir/api.inc");
25 include_once("$srcdir/forms.inc");
27 if (! $encounter) { // comes from globals.php
28 die(xl("Internal error: we do not seem to be in an encounter!"));
32 $id = 0 + (isset($_GET['id']) ? $_GET['id'] : '');
34 $sets = "pid = {$_SESSION["pid"]},
35 groupname = '" . $_SESSION["authProvider"] . "',
36 user = '" . $_SESSION["authUser"] . "',
37 authorized = $userauthorized, activity=1, date = NOW(),
38 provider = '" . add_escape_custom($_POST["provider"]) . "',
39 client_name = '" . add_escape_custom($_POST["client_name"]) . "',
40 transfer_to = '" . add_escape_custom($_POST["transfer_to"]) . "',
41 transfer_date = '" . add_escape_custom($_POST["transfer_date"]) . "',
42 status_of_admission = '" . add_escape_custom($_POST["status_of_admission"]) . "',
43 diagnosis = '" . add_escape_custom($_POST["diagnosis"]) . "',
44 intervention_provided = '" . add_escape_custom($_POST["intervention_provided"]) . "',
45 overall_status_of_discharge = '" . add_escape_custom($_POST["overall_status_of_discharge"]) ."'";
48 if (empty($id)) {
49 $newid = sqlInsert("INSERT INTO form_transfer_summary SET $sets");
50 addForm($encounter, "Transfer Summary", $newid, "transfer_summary", $pid, $userauthorized);
51 } else {
52 sqlStatement("UPDATE form_transfer_summary SET $sets WHERE id = '". add_escape_custom("$id"). "'");
55 $_SESSION["encounter"] = $encounter;
56 formHeader("Redirecting....");
57 formJump();
58 formFooter();