90 lines
2.1 KiB
PHP
90 lines
2.1 KiB
PHP
<?php
|
|
|
|
ob_Start();
|
|
|
|
|
|
use Glpi\Event;
|
|
include ('../inc/includes.php');
|
|
Session::checkLoginUser();
|
|
|
|
|
|
function callWebService($matricule , $periode ,$Numbulletin, $operation){
|
|
|
|
$certificate_location = "/home/dsisophal/public_html/certificates/certificate.crt";
|
|
|
|
|
|
$url = "https://evaluation.sophal.net/controller/Webservices.php";
|
|
$accessKey = '4Lak&L1JZ$u2X6ctDrH*ML@g#';
|
|
|
|
$data = array(
|
|
'accessKey' => $accessKey ,
|
|
'matricule' => $matricule,
|
|
'operation' => $operation,
|
|
'PeriodePaie' => $periode,
|
|
'num' => $Numbulletin
|
|
);
|
|
|
|
$resource = curl_init();
|
|
curl_setopt($resource, CURLOPT_URL, $url);
|
|
curl_setopt($resource, CURLOPT_HTTPHEADER, array('Content-Type:multipart/form-data'));
|
|
curl_setopt($resource, CURLOPT_POST, 1);
|
|
curl_setopt($resource, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($resource, CURLOPT_POSTFIELDS, $data);
|
|
$response = curl_exec($resource);
|
|
|
|
curl_close($resource);
|
|
|
|
if ($response !== false) {
|
|
return $response;
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
function getMatricule(){
|
|
|
|
global $DB;
|
|
|
|
$query = "SELECT registration_number as matricule from glpi_users
|
|
where glpi_users.id ='".$_SESSION["glpiID"]."' ";
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
$res = $result->fetch_assoc();
|
|
return $res['matricule'];
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_GET['periode']) && !empty($_GET['periode'])){
|
|
|
|
$mat = getMatricule();
|
|
$res = callWebService($mat ,$_GET['periode'] , $_GET['numbulletin'] , "get_Bulletin");
|
|
|
|
|
|
//supprimer UTF-8-BOM
|
|
for ($i = 0; $i <= 31; ++$i) {
|
|
$res = str_replace(chr($i), "", $res);
|
|
}
|
|
$res = str_replace(chr(127), "", $res);
|
|
if (0 === strpos(bin2hex($res), 'efbbbf')) {
|
|
$res = substr($res, 3);
|
|
}
|
|
//supprimer UTF-8-BOM
|
|
|
|
$res = json_decode($res,true);
|
|
if($res != null){
|
|
include ('../lib/tcpdf/templates/bulletin_paie.php');
|
|
}else{
|
|
Html::redirect($CFG_GLPI["root_doc"]."/front/drh.bulletinPaieListe.php");
|
|
}
|
|
|
|
}else{
|
|
Html::redirect($CFG_GLPI["root_doc"]."/front/drh.bulletinPaieListe.php");
|
|
}
|