Committed football_injury_report.php for bug where Warning message is displayed when...
[openemr.git] / interface / batchcom / batchcom.inc.php
blobc7892909297e2788d28e3d560b3ca8d59047dffa
1 <?php
3 //validation functions
4 function check_date_format ($date) {
5 $pat="^(19[0-9]{2}|20[0-1]{1}[0-9]{1})-(0[1-9]|1[0-2])-(0[1-9]{1}|1[0-9]{1}|2[0-9]{1}|3[0-1]{1})$";
6 if (ereg ($pat, $date) OR $date=='' OR $date=='0000-00-00') { return TRUE ; } else { RETURN FALSE; }
9 function check_age ($age) {
10 $age=trim ($age);
11 $pat="^([0-9]+)$";
12 if (ereg ($pat, $age) OR $age=='') { return TRUE ; } else { RETURN FALSE; }
15 function check_select ($select, $array) {
16 if (array_search($select,$array) OR 0===array_search($select,$array) ) { return TRUE ; } else { RETURN FALSE; }
19 function check_yes_no ($option) {
20 if ($option=='AND' OR $option=='OR') { return TRUE ; } else { RETURN FALSE; }
23 function where_or_and ($and) {
24 if ($and=='') {
25 $and='WHERE ';
26 } elseif ($and=='WHERE '){
27 $and='AND ';
28 } else {
29 $and='AND ';
31 return $and;
34 function register_email($patient_id, $sent_by, $msg_type, $msg_subject, $msg_text) {
36 $sql="INSERT INTO batchcom SET ";
37 $sql.=" patient_id='$patient_id', ";
38 $sql.="sent_by='$sent_by', ";
39 $sql.="msg_type='$msg_type', ";
40 $sql.="msg_subject='$msg_subject', ";
41 $sql.="msg_text='$msg_text', ";
42 $sql.="msg_date_sent=NOW() ";
44 echo $sql;
46 $res = sqlStatement($sql);