236 lines
6.5 KiB
PHP
236 lines
6.5 KiB
PHP
<?php
|
|
if (!$_SESSION['connected']) die();
|
|
|
|
$tabInfo = $_SESSION['tabInfo'];
|
|
|
|
//$list_international = unserialize(gzuncompress($_SESSION['list_international']));
|
|
$identifier = $_REQUEST['identifier'];
|
|
$pays = $_SESSION['pays'];
|
|
|
|
/*
|
|
getCompanyProduct
|
|
Afficher les informations de getCompanyProduct (Identifiant, Activité, téléphone )
|
|
Si product.type=database alors on récupère un rapport
|
|
on traite suivant le mimetype
|
|
on affiche les informations
|
|
|
|
getCompanyMatchIdentifier
|
|
|
|
*/
|
|
require_once 'graydon/graydonws.php';
|
|
|
|
$path = PATH_DATA.'/graydon/method';
|
|
$fileName = strtolower('CompanyMatchIdentifiers-'.$pays);
|
|
|
|
if(!file_exists($path.'/'.$fileName)){
|
|
//Récupération des intitulés identifiant
|
|
$request = new StdClass();
|
|
$request->Authentication_Parameters = $authentication;
|
|
$request->Country = $pays;
|
|
$firephp->log($request,'requete');
|
|
try
|
|
{
|
|
$result = $graydon->getCompanyMatchIdentifiers($request);
|
|
$firephp->log($result,'Identifier');
|
|
$count = count($result->CompanyMatchIdentifiers);
|
|
if ($count>1){
|
|
$tabIdentifiers = $result->CompanyMatchIdentifiers->CompanyMatchIdentifier;
|
|
}elseif($count==1){
|
|
$tabIdentifiers[] = $result->CompanyMatchIdentifiers->CompanyMatchIdentifier;
|
|
}
|
|
|
|
//Stockage du résultat de la méthode en cache
|
|
file_put_contents($path.'/'.$fileName, serialize($tabIdentifiers));
|
|
|
|
}catch( SoapFault $fault ){
|
|
require_once 'soaperror.php';
|
|
processSoapFault($client,$fault,$tabInfo);
|
|
}
|
|
exit;
|
|
}else{
|
|
$tabIdentifiers = unserialize(file_get_contents($path.'/'.$fileName));
|
|
}
|
|
|
|
// Create the request parameters
|
|
$request = new StdClass();
|
|
// Initialise the request object
|
|
$request->Authentication_Parameters = $authentication;
|
|
$request->CompanyMatchIdentifier = $identifier;
|
|
$firephp->log($request,'requete');
|
|
try
|
|
{
|
|
// Make a request on the web service
|
|
$result = $graydon->getCompanyProducts($request);
|
|
// Print out the result
|
|
print "<!--";
|
|
print "Transaction Identifier : ".$result->Service_Log->TransactionIdentifier;
|
|
print "\n";
|
|
print "Partner User Id : ".$result->Service_Log->PartnerUserId;
|
|
print "\n";
|
|
print_r($result);
|
|
print "-->";
|
|
|
|
$firephp->log($result,'result');
|
|
|
|
$company = $result->Company;
|
|
$products = $result->Products->Product;
|
|
?>
|
|
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
|
|
<tr>
|
|
<td colspan="3"><img src="./img/rub_identite.png" width="577" height="36"></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Fiche identité simplifié<br/></td>
|
|
<td>
|
|
<?php
|
|
$count = count($products);
|
|
if($count==1){
|
|
$products[] = $products;
|
|
}
|
|
foreach($products as $product){
|
|
if($product->ServiceSpeed == 'Immediate' && $product->Type == 'Database'){
|
|
?>
|
|
<a href="./?page=international_identitec&identifier=<?php print $identifier;?>&pidentifier=<?php print $product->CompanyProductIdentifier;?>">Accéder à la fiche identité approfondie (payant).</a>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</td>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3"> </td>
|
|
</tr>
|
|
<?php
|
|
$count = count($company->CompanyIdentifiers->CompanyIdentifier);
|
|
if ($count>1){
|
|
$identifiers = $company->CompanyIdentifiers->CompanyIdentifier;
|
|
}elseif($count==1){
|
|
$identifiers[] = $company->CompanyIdentifiers->CompanyIdentifier;
|
|
}
|
|
foreach($identifiers as $identifier){
|
|
if($identifier->Type != 'Internal'){
|
|
?>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">
|
|
<?php
|
|
$identifierDescription = FALSE;
|
|
foreach($tabIdentifiers as $tabIdentifier){
|
|
if($tabIdentifier->CompanyMatchIdentifier->CompanyIdentifier->Type == $identifier->Type){
|
|
print $tabIdentifier->CompanyMatchIdentifier->CompanyIdentifier->Description;
|
|
$identifierDescription = TRUE;
|
|
}
|
|
}
|
|
if ($identifierDescription==FALSE){
|
|
print $identifier->Type;
|
|
}
|
|
|
|
//@TODO : Tester si la condition à bien été remplie
|
|
?>
|
|
</td>
|
|
<td width="350" class="StyleInfoData">
|
|
<?php print $identifier->Identifier; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3"> </td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
<tr>
|
|
<td colspan="3"><img src="./img/srub_id.png" width="576" height="27"></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Raison Sociale</td>
|
|
<td width="350" class="StyleInfoData"><?php print $company->Name; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Adresse Complète</td>
|
|
<td width="350" class="StyleInfoData"><?php print $company->RegisteredAddress->EntireAddress; ?></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Adresse</td>
|
|
<td width="350" class="StyleInfoData"><?php print $company->RegisteredAddress->Building.', '.$company->RegisteredAddress->Street; ?></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Code Postal</td>
|
|
<td width="350" class="StyleInfoData"><?php print $company->RegisteredAddress->PostCode; ?></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Ville</td>
|
|
<td width="350" class="StyleInfoData"><?php print $company->RegisteredAddress->City; ?></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Pays</td>
|
|
<td width="350" class="StyleInfoData">
|
|
<?php
|
|
if(isset($company->RegisteredAddress->Country)){
|
|
print $company->RegisteredAddress->Country;
|
|
}else{
|
|
print $pays;
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Téléphone</td>
|
|
<td width="350" class="StyleInfoData"><?php print $company->Telephone; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3"> </td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3"><img src="./img/srub_activite.png" width="576" height="27"></td>
|
|
</tr>
|
|
<?php
|
|
$count = count($company->Activites->Activity);
|
|
if ($count>1){
|
|
$activites = $company->Activites->Activity;
|
|
}elseif($count==1){
|
|
$activites[] = $company->Activites->Activity;
|
|
}
|
|
if ($count>0){
|
|
foreach($activites as $activity){
|
|
?>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td width="200" class="StyleInfoLib">Code <?php print $activity->Type;?></td>
|
|
<td width="350" class="StyleInfoData"><?php print $activity->Code;?> - <?php print $activity->Description;?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}else{
|
|
?>
|
|
<tr>
|
|
<td width="30"> </td>
|
|
<td colspan="2" class="StyleInfoData">Aucune information disponible</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
<tr>
|
|
<td colspan="3"> </td>
|
|
</tr>
|
|
</table>
|
|
<?php
|
|
}catch( SoapFault $fault ){
|
|
require_once 'soaperror.php';
|
|
processSoapFault($client,$fault,$tabInfo);
|
|
}
|
|
?>
|