reworked to include filenames
[openemr.git] / interface / batchcom / batchcom.inc.php
blob54350bf996f105372fb0054e2f5645f18300a8cf
1 <?
2 //validation functions
3 function check_date_format ($date) {
4 $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})$";
5 if (ereg ($pat, $date) OR $date=='' OR $date=='0000-00-00') { return TRUE ; } else { RETURN FALSE; }
8 function check_age ($age) {
9 $age=trim ($age);
10 $pat="^([0-9]+)$";
11 if (ereg ($pat, $age) OR $age=='') { return TRUE ; } else { RETURN FALSE; }
14 function check_select ($select, $array) {
15 if (array_search($select,$array) OR 0===array_search($select,$array) ) { return TRUE ; } else { RETURN FALSE; }
18 function check_yes_no ($option) {
19 if ($option=='AND' OR $option=='OR') { return TRUE ; } else { RETURN FALSE; }
22 function where_or_and ($and) {
23 if ($and=='') {
24 $and='WHERE ';
25 } elseif ($and=='WHERE '){
26 $and='AND ';
27 } else {
28 $and='AND ';
30 return $and;
33 function register_email($patient_id, $sent_by, $msg_type, $msg_subject, $msg_text) {
35 $sql="INSERT INTO batchcom SET ";
36 $sql.=" patient_id='$patient_id', ";
37 $sql.="sent_by='$sent_by', ";
38 $sql.="msg_type='$msg_type', ";
39 $sql.="msg_subject='$msg_subject', ";
40 $sql.="msg_text='$msg_text', ";
41 $sql.="msg_date_sent=NOW() ";
43 echo $sql;
45 $res = sqlStatement($sql);