Inserted missing semi-colons. Worked without them, but they should be there.
[openemr.git] / interface / forms / CAMOS / save.php
blob29238ac8b854a471eeafe9563c0c0cb959bdc271
1 <?php
2 //------------This file inserts your field data into the MySQL database
3 include_once("../../globals.php");
4 include_once("../../../library/api.inc");
5 include_once("../../../library/forms.inc");
6 include_once("../../../library/sql.inc");
7 include_once("content_parser.php");
9 $field_names = array('category' => $_POST['category'], 'subcategory' => $_POST['subcategory'], 'item' => $_POST['item'], 'content' => $_POST['content']);
11 //to add codes to billing from CAMOS content field
12 //addBilling($encounter, $type, $code, $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,$fee);
14 $multibox_array = array();
15 $camos_array = array();
16 create_multibox_array($field_names['content'],$multibox_array);
17 clean_multibox_array($multibox_array, $camos_array);
18 remove_multibox_data($field_names['content']);
20 foreach ($field_names as $k => $var) {
21 $field_names[$k] = mysql_real_escape_string($var);
22 echo "$var\n";
24 process_commands($field_names['content'],$camos_array);
26 $CAMOS_form_name = "CAMOS-".$field_names['category'].'-'.$field_names['subcategory'].'-'.$field_names['item'];
28 if ($encounter == "")
29 $encounter = date("Ymd");
30 if ($_GET["mode"] == "new"){
31 if (preg_match("/^[\s\\r\\n\\\\r\\\\n]*$/",$field_names['content']) == 0) { //make sure blanks do not get submitted
32 $newid = formSubmit("form_CAMOS", $field_names, $_GET["id"], $userauthorized);
33 addForm($encounter, $CAMOS_form_name, $newid, "CAMOS", $pid, $userauthorized);
35 //deal with embedded camos submissions here
36 foreach($camos_array as $val) {
37 if (preg_match("/^[\s\\r\\n\\\\r\\\\n]*$/",$val['content']) == 0) { //make sure blanks not submitted
38 foreach($val as $k => $v) {
39 $val[$k] = trim($v);
41 $CAMOS_form_name = "CAMOS-".$val['category'].'-'.$val['subcategory'].'-'.$val['item'];
42 $newid = formSubmit("form_CAMOS", $val, $_GET["id"], $userauthorized);
43 addForm($encounter, $CAMOS_form_name, $newid, "CAMOS", $pid, $userauthorized);
47 elseif ($_GET["mode"] == "update") {
48 sqlInsert("update form_CAMOS set pid = {$_SESSION["pid"]},groupname='".$_SESSION["authProvider"]."',user='".$_SESSION["authUser"]."',authorized=$userauthorized,activity=1, date = NOW(), category='".$field_names["category"]."',subcategory='".$field_names["subcategory"]."',item='".$field_names["item"]."',content='".$field_names['content']."' where id=$id");
50 elseif ($_GET["mode"] == "delete") {
51 sqlInsert("delete from form_CAMOS where id=$id and DATE_FORMAT(date,'%Y-%m-%d') like current_date()");
52 sqlInsert("delete from forms where form_name like 'CAMOS%' and form_id=$id and pid='".$_SESSION["pid"]."' and DATE_FORMAT(date,'%Y-%m-%d') like current_date()");
54 $_SESSION["encounter"] = $encounter;
55 formHeader("Redirecting....");
56 formJump();
57 formFooter();