couple minor bug fixes for previous commit
[openemr.git] / interface / forms / treatment_plan / save.php
blob52f7743e8e5d728113db1ea12d022188a230e128
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
22 //SANITIZE ALL ESCAPES
23 $sanitize_all_escapes=$_POST['true'];
25 //STOP FAKE REGISTER GLOBALS
26 $fake_register_globals=$_POST['false'];
28 include_once("../../globals.php");
29 include_once("$srcdir/api.inc");
30 include_once("$srcdir/forms.inc");
31 require_once("$srcdir/formdata.inc.php");
33 if (! $encounter) { // comes from globals.php
34 die(xl("Internal error: we do not seem to be in an encounter!"));
37 $id = 0 + (isset($_GET['id']) ? $_GET['id'] : '');
39 $sets = "pid = {$_SESSION["pid"]},
40 groupname = '" . $_SESSION["authProvider"] . "',
41 user = '" . $_SESSION["authUser"] . "',
42 authorized = $userauthorized, activity=1, date = NOW(),
43 provider = '" . add_escape_custom($_POST["provider"]) . "',
44 client_name = '" . add_escape_custom($_POST["client_name"]) . "',
45 client_number = '" . add_escape_custom($_POST["client_number"]) . "',
46 admit_date = '" . add_escape_custom($_POST["admit_date"]) . "',
47 presenting_issues = '" . add_escape_custom($_POST["presenting_issues"]) . "',
48 patient_history = '" . add_escape_custom($_POST["patient_history"]) . "',
49 medications = '" . add_escape_custom($_POST["medications"]) . "',
50 anyother_relevant_information = '" . add_escape_custom($_POST["anyother_relevant_information"]) . "',
51 diagnosis = '" . add_escape_custom($_POST["diagnosis"]) . "',
52 treatment_received = '" . add_escape_custom($_POST["treatment_received"]) . "',
53 recommendation_for_follow_up = '" . add_escape_custom($_POST["recommendation_for_follow_up"]) . "'";
57 if (empty($id)) {
58 $newid = sqlInsert("INSERT INTO form_treatment_plan SET $sets");
59 addForm($encounter, "Treatment Plan", $newid, "treatment_plan", $pid, $userauthorized);
61 else {
62 sqlStatement("UPDATE form_treatment_plan SET $sets WHERE id = '". add_escape_custom("$id"). "'");
65 $_SESSION["encounter"] = $encounter;
66 formHeader("Redirecting....");
67 formJump();
68 formFooter();