diff --git a/include/functions.inc.php b/include/functions.inc.php index be021b6f5..866bbc115 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -1099,7 +1099,7 @@ function PersonLog($person_id, $logtype_kurzbz, $logdata, $taetigkeit_kurzbz, $a } /** - * Sendet einen Request an den CaseTime Server um die Daten dort zu speichern + * Sendet einen Request an den CaseTime Server um die Zeitfehler abzufragen */ function getCaseTimeErrors($uid) { @@ -1135,4 +1135,79 @@ function getCaseTimeErrors($uid) return false; } } + +/** + * Sendet einen Request an den CaseTime Server um den Zeitsaldo abzufragen + */ +function getCaseTimeZeitsaldo($uid) +{ + $ch = curl_init(); + + $url = CASETIME_SERVER.'/sync/get_zeitsaldo'; + + $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; + } +} + +/** + * Sendet einen Request an den CaseTime Server um den Urlaubssaldo abzufragen + */ +function getCastTimeUrlaubssaldo($uid) +{ + $ch = curl_init(); + + $url = CASETIME_SERVER.'/sync/get_urlaubsaldo'; + + $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); + } + else + { + curl_close($ch); + $data = json_decode($result); + + if (isset($data->STATUS) && $data->STATUS == 'OK') + { + return $data->RESULT; + } + else + return false; + } +} ?>