extranet/www/pages/international_identite.php

293 lines
7.6 KiB
PHP
Raw Normal View History

2009-04-07 17:44:17 +00:00
<?php
session_start();
2009-04-07 17:44:17 +00:00
if (!$_SESSION['connected']) die();
$tabInfo = $_SESSION['tabInfo'];
2009-04-07 17:44:17 +00:00
$identifier = $_REQUEST['identifier'];
$pays = $_SESSION['graydon']['pays'];
2009-04-07 17:44:17 +00:00
/*
getCompanyProduct
Afficher les informations de getCompanyProduct (Identifiant, Activit<EFBFBD>, t<EFBFBD>l<EFBFBD>phone )
Si product.type=database alors on r<EFBFBD>cup<EFBFBD>re un rapport
on traite suivant le mimetype
on affiche les informations
getCompanyMatchIdentifier
*/
require_once 'i18n/cleanchar.php';
2009-04-07 17:44:17 +00:00
require_once 'graydon/graydonws.php';
$path = PATH_DATA.'/graydon/method';
$fileName = strtolower('CompanyMatchIdentifiers-'.$pays);
2009-04-07 17:44:17 +00:00
/** Recup des types d'identifiants pour le pays **/
if(!file_exists($path.'/'.$fileName)){
//R<>cup<75>ration des intitul<75>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);
}
}else{
$tabIdentifiers = unserialize(file_get_contents($path.'/'.$fileName));
}
/** Recup des produits de la company **/
$path = PATH_DATA.'/graydon';
$fileName = strtolower('CompanyProducts-'.$identifier);
$fileName = str_replace(':', '-', $fileName);
$now = mktime(date('G'), date('i'), date('s'), date("m") , date("d"), date("Y"));
$debug = TRUE;
if(!file_exists($path.'/'.$fileName) || filemtime($path.'/'.$fileName)>$now+16 && $debug){
// 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');
file_put_contents($path.'/'.$fileName, serialize($result));
}catch( SoapFault $fault ){
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo);
die();
}
}else{
$result = unserialize(file_get_contents($path.'/'.$fileName));
}
if(isset($result)){
$firephp->log($result,'result');
2009-04-07 17:44:17 +00:00
$company = $result->Company;
$products = $result->Products->Product;
?>
<div id="center">
<h1 class="titre">IDENTIT&Eacute; INTERNATIONALE DE L'ENTREPRISE</h1>
<table >
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Fiche identit<EFBFBD> simplifi<EFBFBD><br/></td>
<td>
<?php
2009-04-07 17:44:17 +00:00
$count = count($products);
if($count==1){
$products[] = $products;
}
$noReport = TRUE;
2009-04-07 17:44:17 +00:00
foreach($products as $product){
if ($product->ServiceSpeed == 'Immediate' && $product->Type == 'Database' && $product->Level == 3 ){
$mimetype = FALSE;
if (is_array($product->MimeTypes->MimeType)){
if (in_array('xml', $product->MimeTypes->MimeType)){$mimetype = TRUE;}
}else{
if ($product->MimeTypes->MimeType == 'xml' ){$mimetype = TRUE;}
}
if ($mimetype == TRUE ){
$noReport = FALSE;
$pidentifier = $product->CompanyProductIdentifier;
?>
<a href="./?page=international_identitec&identifier=<?php print $identifier;?>&pidentifier=<?php print $pidentifier;?>">Acc<EFBFBD>der <EFBFBD> la fiche identit<EFBFBD> approfondie (payant).</a>
<?php
}
2009-04-07 17:44:17 +00:00
}
}
if($noReport){
?>
(Rapport imm<EFBFBD>diat indisponible)
<?php
}
?>
2009-04-07 17:44:17 +00:00
</td>
</td>
</tr>
<tr>
<td colspan="3">&nbsp;</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">&nbsp;</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 <20> bien <20>t<EFBFBD> remplie
?>
</td>
<td width="350" class="StyleInfoData">
<?php print $identifier->Identifier; ?></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<?php
}
}
?>
</table>
<h2>Raison sociale et coordonn<EFBFBD>es : </h2>
<table>
2009-04-07 17:44:17 +00:00
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="350" class="StyleInfoData"><?php print cleanutf8($company->Name); ?></td>
2009-04-07 17:44:17 +00:00
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Adresse Compl<EFBFBD>te</td>
<td width="350" class="StyleInfoData"><?php print cleanutf8($company->RegisteredAddress->EntireAddress); ?></td>
2009-04-07 17:44:17 +00:00
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Adresse</td>
<td width="350" class="StyleInfoData"><?php print cleanutf8($company->RegisteredAddress->Building.', '.$company->RegisteredAddress->Street); ?></td>
2009-04-07 17:44:17 +00:00
</tr>
<tr>
<td width="30">&nbsp;</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">&nbsp;</td>
<td width="200" class="StyleInfoLib">Ville</td>
<td width="350" class="StyleInfoData"><?php print cleanutf8($company->RegisteredAddress->City); ?></td>
2009-04-07 17:44:17 +00:00
</tr>
<tr>
<td width="30">&nbsp;</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">&nbsp;</td>
<td width="200" class="StyleInfoLib">T<EFBFBD>l<EFBFBD>phone</td>
<td width="350" class="StyleInfoData"><?php print $company->Telephone; ?></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
<h2>Activit<EFBFBD>(s) de l'entreprise : </h2>
<table>
2009-04-07 17:44:17 +00:00
<?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">&nbsp;</td>
<td width="200" class="StyleInfoLib">Code <?php print $activity->Type;?></td>
<td width="350" class="StyleInfoData"><?php print $activity->Code;?> - <?php print cleanutf8($activity->Description);?></td>
2009-04-07 17:44:17 +00:00
</tr>
<?php
}
}else{
?>
<tr>
2009-04-07 17:44:17 +00:00
<td width="30">&nbsp;</td>
<td colspan="2" class="StyleInfoData">Aucune information disponible</td>
</tr>
<?php
}
?>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
<?php
}else{
?>
<table>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" class="StyleInfoData">Aucune information disponible</td>
</tr>
</table>
<?php
}
2009-04-07 17:44:17 +00:00
?>
</div>