extranet/www/pages/international_identite.php

457 lines
14 KiB
PHP
Raw Normal View History

2009-04-07 17:44:17 +00:00
<?php
2009-07-21 15:08:08 +00:00
if (!$_SESSION['connected']) die();
2009-04-07 17:44:17 +00:00
$tabInfo = $_SESSION['tabInfo'];
2009-04-07 17:44:17 +00:00
$identifier = $_REQUEST['identifier'];
$pays = $_SESSION['graydon']['pays'];
2009-05-11 09:52:19 +00:00
$mode = $_SESSION['graydon']['mode'];
2009-04-07 17:44:17 +00:00
require_once 'i18n/cleanchar.php';
2009-10-28 14:18:22 +00:00
require_once 'graydon/graydon.php';
require_once 'dbbootstrap.php';
$tabIdentifiers = getCompanyMatchIdentifiers($pays);
$firephp->log($tabIdentifiers,'tabIdentifiers');
/** Recup des produits de la company **/
$Companyproducts = getCompanyProducts($identifier);
$company = $Companyproducts['Company'];
$products = $Companyproducts['Products'];
2009-10-28 14:18:22 +00:00
if(isset($company))
{
$firephp->log($products,'products');
2009-07-21 15:08:08 +00:00
?>
<div id="center">
<h1 class="titre">IDENTIT&Eacute; INTERNATIONALE DE L'ENTREPRISE</h1>
2009-07-21 15:08:08 +00:00
2010-02-15 10:50:44 +00:00
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Fiche identité simplifié<br/></td>
<td>
2009-10-28 14:18:22 +00:00
<?php $noReport = TRUE; ?>
<u><b>Accès à la fiche identité approfondie :</b></u>
2009-07-21 15:08:08 +00:00
<?php
2009-04-23 06:53:26 +00:00
$tabReport = array();
$tabProductIdentifier = array();
$countProducts = 0;
foreach($products as $product) {
// Rapport en mode normal
if ($product->ServiceSpeed == 'Normal' &&
$product->Type == 'Investigation' &&
$product->Level == 4) {
$tabReport[$countProducts] = 'Normal';
$tabProducts[$countProducts]['identifier'] =
$product->CompanyProductIdentifier;
$tabProducts[$countProducts]['DaysFrom'] = $product->DaysFrom;
$tabProducts[$countProducts]['DaysTo'] = $product->DaysTo;
$countProducts++;
}
// Rapport en mode Superflash
if ($product->ServiceSpeed == 'Superflash' &&
$product->Type == 'Investigation' &&
$product->Level == 4) {
$tabReport[] = 'Superflash';
$tabProducts[$countProducts]['identifier'] =
$product->CompanyProductIdentifier;
if (isset($product->DaysFrom) == true) {
$tabProducts[$countProducts]['DaysFrom'] = $product->DaysFrom;
}
$tabProducts[$countProducts]['DaysTo'] = $product->DaysTo;
$countProducts++;
}
// Rapport disponible avec mise à jour
if ($product->ServiceSpeed == 'ImmediateWithUpdate' &&
$product->Type == 'Database' &&
$product->Level == 3) {
require_once 'mail/mail.php';
sendMail('Rapport International',
"ImmediateWithUpdate disponible\n" .
"Identifiant : ".$identifier,
array('email' => 'contact@scores-decisions.com',
'name' => 'Serveur SD-13408'),
array(0 => array('email' => EMAIL_SUPPORTDEV,
'name' => 'Support'), ));
2009-07-21 15:08:08 +00:00
2009-04-27 15:16:02 +00:00
//Don't display ImmediateWithUpdate
/*
$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 ){
2009-04-23 06:53:26 +00:00
$tabReport[] = 'ImmediateWithUpdate';
$tabProducts[$countProducts]['identifier'] = $product->CompanyProductIdentifier;
$tabProducts[$countProducts]['DaysFrom'] = $product->DaysFrom;
$tabProducts[$countProducts]['DaysTo'] = $product->DaysTo;
$countProducts++;
}
2009-04-27 15:16:02 +00:00
*/
2009-04-07 17:44:17 +00:00
}
2009-04-23 06:53:26 +00:00
//Rapport disponible en ligne
2009-10-28 14:18:22 +00:00
if ($product->ServiceSpeed == 'Immediate' && $product->Type == 'Database' && $product->Level == 3 )
{
2009-04-23 06:53:26 +00:00
$mimetype = FALSE;
2009-10-28 14:18:22 +00:00
if (!is_array($product->MimeTypes->MimeType)){ $productMimeTypes = array($product->MimeTypes->MimeType); }
else{ $productMimeTypes = $product->MimeTypes->MimeType; }
2009-10-28 14:18:22 +00:00
foreach( reportFormat() as $format )
{
if (in_array($format, $product->MimeTypes->MimeType))
{
2009-10-28 14:18:22 +00:00
$mimetype = TRUE;
break;
2009-04-27 15:16:02 +00:00
}
else
2009-10-28 14:18:22 +00:00
{
require_once 'mail/mail.php';
sendMail(
'Rapport International',
"Rapport international disponible dans un autre format que le XML\n" .
"Identifiant : ".$identifier,
array(
'email'=>'contact@scores-decisions.com',
'name'=>'Serveur SD-13408'),
array(
0 => array(
'email'=>EMAIL_SUPPORTDEV,
'name'=>'Support'),
)
);
2009-04-27 15:16:02 +00:00
}
2009-04-23 06:53:26 +00:00
}
2009-10-28 14:18:22 +00:00
if ($mimetype == TRUE )
{
2009-04-23 06:53:26 +00:00
$tabReport[] = 'Immediate';
$tabProducts[$countProducts]['identifier'] = $product->CompanyProductIdentifier;
2009-10-28 14:18:22 +00:00
$tabProducts[$countProducts]['format'] = $format;
2009-04-23 06:53:26 +00:00
$countProducts++;
}
2009-07-21 15:08:08 +00:00
}
2009-10-28 14:18:22 +00:00
} // Fin boucle d'affichage des produits
2009-07-21 15:08:08 +00:00
$firephp->log($tabProducts,'tabProducts');
2009-04-23 06:53:26 +00:00
2009-10-28 14:18:22 +00:00
if(count($tabReport)==0)
{
2009-07-21 15:08:08 +00:00
?>
(Aucun rapport disponible pour cette société)
2009-06-03 09:36:53 +00:00
<?php
2009-10-13 16:34:46 +00:00
}
else
{
//Récupération des tarifs propre au pays
2009-05-13 16:05:50 +00:00
setDbConn('graydon');
$q = Doctrine_Query::create()
->from('Price p')
->leftJoin('p.Country c')
->where('c.graydon_country = ?', $pays);
2009-07-21 15:08:08 +00:00
$tabPaysPrix = $q->fetchArray();
$firephp->log($tabPaysPrix, 'tableau');
2009-10-13 16:34:46 +00:00
$href = array();
2009-10-28 14:18:22 +00:00
if(in_array('Normal',$tabReport))
{
$key = array_search('Normal', $tabReport);
2009-04-23 06:53:26 +00:00
$pidentifier = $tabProducts[$key]['identifier'];
$daysFrom = $tabProducts[$key]['DaysFrom'];
$daysTo = $tabProducts[$key]['DaysTo'];
//Vérification des droits
if(preg_match('/\binternational\b/i', $_SESSION['tabInfo']['droits'])){
2009-10-13 16:34:46 +00:00
$href['normal'] = './?page=international_enquete&speed=normal&identifier='.$identifier.'&pidentifier='.$pidentifier;
2009-06-03 09:36:53 +00:00
}else{
2009-10-13 16:34:46 +00:00
$href['normal'] = '#';
}
}
if(isset($href['normal']))
{
if($href['normal']=='#'){
print '<br/><br/><a href="#" title="Vous n\'avez pas les droits nécessaires pour commander un rapport international">Commander le rapport en mode normal</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['normal'].' &euro;)</i>';
2009-10-13 16:34:46 +00:00
}else{
print '<br/><br/><a href="'.$href['normal'].'">Commander le rapport en mode normal</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['normal'].' &euro;)</i>';
//print '<br/><br/><a href="#" title="Fonctionnalités désactivées">Commander le rapport en mode normal</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['normal'].' &euro;)</i>';
2009-06-03 09:36:53 +00:00
}
2009-04-23 06:53:26 +00:00
}
2009-10-13 16:34:46 +00:00
else
{
print '<br/><br/><a href="#" title="Type de commande indisponible">Rapport en mode normal indisponible</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['normal'].' &euro;)</i>';
2009-10-13 16:34:46 +00:00
}
// Affichage des différents rapports dans l'ordre
if (in_array('Superflash', $tabReport)) {
$key = array_search('Superflash', $tabReport);
$pidentifier = $tabProducts[$key]['identifier'];
$daysFrom = (isset($tabProducts[$key]['DaysFrom'])) ?
$tabProducts[$key]['DaysFrom'] : '';
$daysTo = $tabProducts[$key]['DaysTo'];
// Vérification des droits
if (preg_match('/\binternational\b/i',
$_SESSION['tabInfo']['droits'])) {
$href['superflash'] =
'./?page=international_enquete&speed=superflash&identifier='.
$identifier.'&pidentifier='.$pidentifier;
} else {
$href['superflash'] = '#';
}
}
if(isset($href['superflash'])) {
print '<br/><br/>';
if ($href['normal'] == '#') {
print '<a href="#" title="Vous n\'avez pas les droits nécessaires'.
' pour commander un rapport international">Commander le rapport'.
' en mode rapide</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.
' Jours, Tarif : '.$tabPaysPrix[0]['superflash'].' &euro;)</i>';
} else {
print '<a href="'.$href['superflash'].
'">Commander le rapport en mode rapide</a><br/><i>(Délais : '.
$daysFrom.' à '.$daysTo.' Jours, Tarif : '.
$tabPaysPrix[0]['superflash'].' &euro;)</i>';
}
} else {
print '<a href="#" title="Type de commande indisponible">'.
'Rapport immédiat indisponible</a><br/><i>(Délais : '.$daysFrom.
' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['normal'].
' &euro;)</i>';
}
if (in_array('Immediate', $tabReport)) {
$key = array_search('Immediate', $tabReport);
$pidentifier = $tabProducts[$key]['identifier'];
// Vérification des droits
if (preg_match('/\binternational\b/i', $_SESSION['tabInfo']['droits'])) {
$href['immediate'] = './?page=international_identitec&identifier='.
$identifier.'&pidentifier='.$pidentifier;
} else {
$href['immediate'] = '#';
}
}
if (isset($href['immediate'])) {
if ($href['immediate'] == '#') {
print '<br/><br/><a href="#" title="'.
'Vous n\'avez pas les droits nécessaires pour commander'.
' un rapport international">Consutler le rapport disponible'.
'</a><br/><i>(Délais : Immédiat, Tarif : '.
$tabPaysPrix[0]['immediate'].' &euro;)</i>';
} else {
print '<br/><br/><a href="'.$href['immediate'].'">'.
'Consutler le rapport disponible'.
'</a><br/><i>(Délais : Immédiat, Tarif : '.
$tabPaysPrix[0]['immediate'].' &euro;)</i>';
}
} else {
print '<br/><br/><a href="#" title="Type de commande indisponible">'.
'Rapport immédiat indisponible'.
'</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.
$tabPaysPrix[0]['normal'].' &euro;)</i>';
}
}
?>
2009-04-07 17:44:17 +00:00
</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
2009-07-21 15:08:08 +00:00
<?php
2009-10-28 14:18:22 +00:00
$identifiers = $company->CompanyIdentifiers->CompanyIdentifier;
2009-04-07 17:44:17 +00:00
foreach($identifiers as $identifier){
if($identifier->Type != 'Internal'){
2009-07-21 15:08:08 +00:00
?>
2009-04-07 17:44:17 +00:00
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">
2009-07-21 15:08:08 +00:00
<?php
2009-04-07 17:44:17 +00:00
$identifierDescription = FALSE;
if(is_array($tabIdentifiers)){
2009-04-07 17:44:17 +00:00
foreach($tabIdentifiers as $tabIdentifier){
if($tabIdentifier->Type == $identifier->Type){
print $tabIdentifier->Description;
2009-04-07 17:44:17 +00:00
$identifierDescription = TRUE;
}
}
2009-06-03 09:36:53 +00:00
}
2009-07-21 15:08:08 +00:00
if ($identifierDescription==FALSE){
2009-04-07 17:44:17 +00:00
print $identifier->Type;
}
//@TODO : Tester si la condition à bien été remplie
2009-04-07 17:44:17 +00:00
?>
</td>
<td width="350" class="StyleInfoData">
2009-10-28 14:18:22 +00:00
<?php print $identifier->Identifier; ?></td>
2009-07-21 15:08:08 +00:00
</tr>
2009-04-07 17:44:17 +00:00
<tr>
<td colspan="3">&nbsp;</td>
2009-07-21 15:08:08 +00:00
</tr>
<?php
2009-04-07 17:44:17 +00:00
}
}
?>
</table>
<h2>Raison sociale et coordonnées : </h2>
<table>
2009-10-13 16:34:46 +00:00
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="350" class="StyleInfoData">
<?php
if ($company->Name != '') {
$name = $company->Name;
} else {
$name = $_REQUEST['name'];
}
$_SESSION['graydon']['name'] = $name;
print cleanutf8($name);
?>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Adresse Complète</td>
<td width="350" class="StyleInfoData">
<?php print cleanutf8($company->RegisteredAddress->EntireAddress); ?>
</td>
</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);
if (isset($company->RegisteredAddress->Street) == true) {
print cleanutf8(', '.$company->RegisteredAddress->Street);
}
?>
</td>
</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>
</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) == true) {
print $company->RegisteredAddress->Country;
} else {
print $pays;
}
?>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Téléphone</td>
<td width="350" class="StyleInfoData">
<?php
if (isset($company->Telephone) == true) {
print $company->Telephone;
}
?>
</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
2009-10-13 16:34:46 +00:00
</tr>
2009-07-21 15:08:08 +00:00
</table>
<h2>Activité(s) de l'entreprise : </h2>
2009-07-21 15:08:08 +00:00
<table>
<?php
if (count($company->Activites) > 0) {
foreach($company->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.' - '.cleanutf8($activity->Description);?>
</td>
</tr>
<?php
}
} else {
2009-04-07 17:44:17 +00:00
?>
<tr>
2009-04-07 17:44:17 +00:00
<td width="30">&nbsp;</td>
<td colspan="2" class="StyleInfoData">Aucune information disponible</td>
</tr>
2009-07-21 15:08:08 +00:00
<?php
2009-04-07 17:44:17 +00:00
}
?>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
<h2>Géolocalisation : </h2>
2009-07-21 15:08:08 +00:00
<?php
/*
$adresse = $company->RegisteredAddress->Building;
$codePostal = $company->RegisteredAddress->PostCode;
$ville = $company->RegisteredAddress->City;
*/
2009-07-21 15:08:08 +00:00
/*
try {
2009-07-21 15:08:08 +00:00
$geoCodeResult = $client->geoCode('19 rue de saulnier', '75009', 'paris', 'france');
$firephp->log($geoCodeResult, 'geocode');
}catch(SoapFault $fault){
print '<pre>';
print $client->__getLastResponse();
print '</pre>';
}
*/
2009-07-21 15:08:08 +00:00
/*
* Récupération du geoCode
* La page est chargé alors par javascript on load en ajax
* Chargement de la carte (nouvelle page loadMap.php ??)
* loadMap => On vérifie la session
* => On envoi le geocode ?? les markers supplémentaires
*/
2009-07-21 15:08:08 +00:00
?>
2010-02-15 10:50:44 +00:00
</div>
2009-07-21 15:08:08 +00:00
<?php
}else{
2009-07-21 15:08:08 +00:00
?>
2010-02-15 10:50:44 +00:00
<div id="center">
<table>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" class="StyleInfoData">Aucune information disponible</td>
</tr>
</table>
2010-02-15 10:50:44 +00:00
</div>
<?php
2009-07-21 15:08:08 +00:00
}
2009-04-07 17:44:17 +00:00
?>
2010-02-15 10:50:44 +00:00