diff --git a/include/functions.inc.php b/include/functions.inc.php index 6f6c5cc3b..be021b6f5 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -1097,4 +1097,42 @@ function PersonLog($person_id, $logtype_kurzbz, $logdata, $taetigkeit_kurzbz, $a $personlog = new personlog(); $personlog->log($person_id, $logtype_kurzbz, $logdata, $taetigkeit_kurzbz, $app, $oe_kurzbz, $user); } + +/** + * Sendet einen Request an den CaseTime Server um die Daten dort zu speichern + */ +function getCaseTimeErrors($uid) +{ + $ch = curl_init(); + + $url = CASETIME_SERVER.'/sync/get_zeitfehler'; + + $params = 'sachb='.$uid; + + curl_setopt($ch, CURLOPT_URL, $url.'?'.$params ); //Url together with parameters + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Return data instead printing directly in Browser + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT , 7); //Timeout after 7 seconds + curl_setopt($ch, CURLOPT_USERAGENT , "FH-Complete CaseTime Addon"); + curl_setopt($ch, CURLOPT_HEADER, 0); + + $result = curl_exec($ch); + + if(curl_errno($ch)) + { + return 'Curl error: ' . curl_error($ch); + curl_close($ch); + } + else + { + curl_close($ch); + $data = json_decode($result); + + if(isset($data->STATUS) && $data->STATUS=='OK') + { + return $data->RESULT; + } + else + return false; + } +} ?>