f615743c9357ca303cd01c280abfea59eec8bef6
[openemr.git] / interface / forms / treatment_plan / save.php
blobf615743c9357ca303cd01c280abfea59eec8bef6
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");
32 if (! $encounter) { // comes from globals.php
33 die(xl("Internal error: we do not seem to be in an encounter!"));
36 $id = 0 + (isset($_GET['id']) ? $_GET['id'] : '');
38 $sets = "pid = {$_SESSION["pid"]},
39 groupname = '" . $_SESSION["authProvider"] . "',
40 user = '" . $_SESSION["authUser"] . "',
41 authorized = $userauthorized, activity=1, date = NOW(),
42 provider = '" . add_escape_custom(formData("provider")) . "',
43 client_name = '" . add_escape_custom(formData("client_name")) . "',
44 client_number = '" . add_escape_custom(formData("client_number")) . "',
45 admit_date = '" . add_escape_custom(formData("admit_date")) . "',
46 presenting_issues = '" . add_escape_custom(formData("presenting_issues")) . "',
47 patient_history = '" . add_escape_custom(formData("patient_history")) . "',
48 medications = '" . add_escape_custom(formData("medications")) . "',
49 anyother_relevant_information = '" . add_escape_custom(formData("anyother_relevant_information")) . "',
50 diagnosis = '" . add_escape_custom(formData("diagnosis")) . "',
51 treatment_received = '" . add_escape_custom(formData("treatment_received")) . "',
52 recommendation_for_follow_up = '" . add_escape_custom(formData("recommendation_for_follow_up")) . "'";
56 if (empty($id)) {
57 $newid = sqlInsert("INSERT INTO form_treatment_plan SET $sets");
58 addForm($encounter, "Treatment Plan", $newid, "treatment_plan", $pid, $userauthorized);
60 else {
61 sqlStatement("UPDATE form_treatment_plan SET $sets WHERE id = '". add_escape_custom("$id"). "'");
64 $_SESSION["encounter"] = htmlspecialchars($encounter);
65 formHeader("Redirecting....");
66 formJump();
67 formFooter();