- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / registration_admission / include / save_immunization.inc.php
blobc027ef2d443569e29ce1c7ffa456511482b2dce3
1 <?php
2 /*------begin------ This protection code was suggested by Luki R. luki@karet.org ---- */
3 if (eregi('save_immunization.inc.php',$PHP_SELF))
4 die('<meta http-equiv="refresh" content="0; url=../">');
6 require_once($root_path.'include/care_api_classes/class_immunization.php');
7 if(!isset($imm_obj)) $imm_obj=new Immunization;
9 require_once($root_path.'include/inc_date_format_functions.php');
10 # Check date, default is today
11 if($HTTP_POST_VARS['date']) $HTTP_POST_VARS['date']=@formatDate2STD($HTTP_POST_VARS['date'],$date_format);
12 else $HTTP_POST_VARS['date']=date('Y-m-d');
13 if($HTTP_POST_VARS['refresh_date']) $HTTP_POST_VARS['refresh_date']=@formatDate2STD($HTTP_POST_VARS['refresh_date'],$date_format);
15 $imm_obj->setDataArray($HTTP_POST_VARS);
17 if($type&&$medicine&&$dosage&&$application_type_nr&&$application_by){
19 switch($mode){
20 case 'create':
21 //if($HTTP_POST_VARS['date') $HTTP_POST_VARS['date']=@formatDate2STD($HTTP_POST_VARS['date'],$date_format);
22 //if($HTTP_POST_VARS['refresh_date') $HTTP_POST_VARS['date']=@formatDate2STD($HTTP_POST_VARS['refresh_date'],$date_format);
24 if($imm_obj->insertDataFromInternalArray())
26 header("location:".$thisfile.URL_REDIRECT_APPEND."&mode=show&target=$target&pid=".$HTTP_SESSION_VARS['sess_pid']);
27 exit;
29 else echo "<br>$LDDbNoSave";
30 break;
31 case 'update':
32 //$HTTP_POST_VARS['date']=@formatDate2STD($HTTP_POST_VARS['date'],$date_format);
33 //$imm_obj->setDataArray($HTTP_POST_VARS);
34 $imm_obj->setWhereCond("nr=$imm_nr");
35 if($imm_obj->updateDataFromInternalArray($dept_nr))
37 header("location:".$thisfile.URL_REDIRECT_APPEND."&target=$target&pid=".$HTTP_SESSION_VARS['sess_pid']);
38 exit;
40 else echo "$sql<br>$LDDbNoUpdate";
41 break;
43 }// end of switch
44 } # end of if()