2009-08-27 07:20:05 +00:00
< ? php
if ( ! $_SESSION [ 'connected' ]) die ();
$tabInfo = $_SESSION [ 'tabInfo' ];
$identifier = $_REQUEST [ 'identifier' ];
$pays = $_SESSION [ 'graydon' ][ 'pays' ];
$mode = $_SESSION [ 'graydon' ][ 'mode' ];
require_once 'i18n/cleanchar.php' ;
2009-11-03 16:14:32 +00:00
require_once 'graydon/graydon.php' ;
2009-08-27 07:20:05 +00:00
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-11-03 16:14:32 +00:00
if ( isset ( $company ))
{
2009-08-27 07:20:05 +00:00
$firephp -> log ( $products , 'products' );
?>
< 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 >
2009-11-03 16:14:32 +00:00
< ? php $noReport = TRUE ; ?>
2009-08-27 07:20:05 +00:00
< u >< b > Acc<EFBFBD> s <EFBFBD> la fiche identit<EFBFBD> approfondie :</ b ></ u >
< ? php
$tabReport = array ();
$tabProductIdentifier = array ();
$countProducts = 0 ;
2009-11-03 16:14:32 +00:00
foreach ( $products as $product )
{
2009-08-27 07:20:05 +00:00
//Rapport en mode normal
2009-11-03 16:14:32 +00:00
if ( $product -> ServiceSpeed == 'Normal' && $product -> Type == 'Investigation' && $product -> Level == 4 )
{
2009-08-27 07:20:05 +00:00
$tabReport [ $countProducts ] = 'Normal' ;
$tabProducts [ $countProducts ][ 'identifier' ] = $product -> CompanyProductIdentifier ;
$tabProducts [ $countProducts ][ 'DaysFrom' ] = $product -> DaysFrom ;
$tabProducts [ $countProducts ][ 'DaysTo' ] = $product -> DaysTo ;
$countProducts ++ ;
}
2009-11-03 16:14:32 +00:00
2009-08-27 07:20:05 +00:00
//Rapport en mode Superflash
2009-11-03 16:14:32 +00:00
if ( $product -> ServiceSpeed == 'Superflash' && $product -> Type == 'Investigation' && $product -> Level == 4 )
{
2009-08-27 07:20:05 +00:00
$tabReport [] = 'Superflash' ;
$tabProducts [ $countProducts ][ 'identifier' ] = $product -> CompanyProductIdentifier ;
$tabProducts [ $countProducts ][ 'DaysFrom' ] = $product -> DaysFrom ;
$tabProducts [ $countProducts ][ 'DaysTo' ] = $product -> DaysTo ;
$countProducts ++ ;
}
2009-11-03 16:14:32 +00:00
2009-08-27 07:20:05 +00:00
//Rapport disponible avec mise <20> jour
if ( $product -> ServiceSpeed == 'ImmediateWithUpdate' && $product -> Type == 'Database' && $product -> Level == 3 ){
require_once 'phpmailer/class.phpmailer.php' ;
$mail = new PHPMailer ();
$mail -> From = " contact@scores-decisions.com " ;
$mail -> FromName = " Serveur SD-13408 " ;
$mail -> Host = " mail.scores-decisions.com " ;
$mail -> Mailer = " smtp " ;
$mail -> Subject = " Rapport International " ;
$body = " ImmediateWithUpdate disponible \n " ;
$body .= " Identifiant : " . $identifier . " " ;
$mail -> MsgHTML ( $body );
$mail -> AddAddress ( EMAIL_SUPPORTDEV , " Support " );
$mail -> Send ();
//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 ){
$tabReport [] = 'ImmediateWithUpdate' ;
$tabProducts [ $countProducts ][ 'identifier' ] = $product -> CompanyProductIdentifier ;
$tabProducts [ $countProducts ][ 'DaysFrom' ] = $product -> DaysFrom ;
$tabProducts [ $countProducts ][ 'DaysTo' ] = $product -> DaysTo ;
$countProducts ++ ;
}
*/
}
2009-11-03 16:14:32 +00:00
2009-08-27 07:20:05 +00:00
//Rapport disponible en ligne
2009-11-03 16:14:32 +00:00
if ( $product -> ServiceSpeed == 'Immediate' && $product -> Type == 'Database' && $product -> Level == 3 )
{
2009-08-27 07:20:05 +00:00
$mimetype = FALSE ;
2009-11-03 16:14:32 +00:00
if ( ! is_array ( $product -> MimeTypes -> MimeType )){ $productMimeTypes = array ( $product -> MimeTypes -> MimeType ); }
else { $productMimeTypes = $product -> MimeTypes -> MimeType ; }
foreach ( reportFormat () as $format )
{
if ( in_array ( $format , $product -> MimeTypes -> MimeType ))
{
$mimetype = TRUE ;
break ;
2009-08-27 07:20:05 +00:00
}
2009-11-03 16:14:32 +00:00
else
{
2009-08-27 07:20:05 +00:00
require_once 'phpmailer/class.phpmailer.php' ;
$mail = new PHPMailer ();
$mail -> From = " contact@scores-decisions.com " ;
$mail -> FromName = " Serveur SD-13408 " ;
$mail -> Host = " mail.scores-decisions.com " ;
$mail -> Mailer = " smtp " ;
$mail -> Subject = " Rapport International " ;
$body = " Rapport international disponible dans un autre format que le XML \n " ;
$body .= " Identifiant : " . $identifier . " " ;
$mail -> MsgHTML ( $body );
$mail -> AddAddress ( EMAIL_SUPPORTDEV , " Support " );
$mail -> Send ();
}
}
2009-11-03 16:14:32 +00:00
if ( $mimetype == TRUE )
{
2009-08-27 07:20:05 +00:00
$tabReport [] = 'Immediate' ;
$tabProducts [ $countProducts ][ 'identifier' ] = $product -> CompanyProductIdentifier ;
2009-11-03 16:14:32 +00:00
$tabProducts [ $countProducts ][ 'format' ] = $format ;
2009-08-27 07:20:05 +00:00
$countProducts ++ ;
}
}
2009-11-03 16:14:32 +00:00
} // Fin boucle d'affichage des produits
2009-08-27 07:20:05 +00:00
$firephp -> log ( $tabProducts , 'tabProducts' );
2009-11-03 16:14:32 +00:00
if ( count ( $tabReport ) == 0 )
{
2009-08-27 07:20:05 +00:00
?>
( Aucun rapport disponible pour cette soci<EFBFBD> t<EFBFBD> )
< ? php
2009-11-03 16:14:32 +00:00
}
else
{
2009-08-27 07:20:05 +00:00
//R<> cup<75> ration des tarifs propre au pays
setDbConn ( 'graydon' );
$q = Doctrine_Query :: create ( $conn )
-> from ( 'Price p' )
-> leftJoin ( 'p.Country c' )
-> where ( 'c.graydon_country = ?' , $pays );
$tabPaysPrix = $q -> fetchArray ();
$firephp -> log ( $tabPaysPrix , 'tableau' );
2009-11-03 16:14:32 +00:00
$href = array ();
if ( in_array ( 'Normal' , $tabReport ))
{
2009-08-27 07:20:05 +00:00
$key = array_search ( 'Normal' , $tabReport );
$pidentifier = $tabProducts [ $key ][ 'identifier' ];
$daysFrom = $tabProducts [ $key ][ 'DaysFrom' ];
$daysTo = $tabProducts [ $key ][ 'DaysTo' ];
//V<> rification des droits
if ( preg_match ( '/international/i' , $_SESSION [ 'tabInfo' ][ 'droits' ])){
2009-11-03 16:14:32 +00:00
$href [ 'normal' ] = './?page=international_enquete&speed=normal&identifier=' . $identifier . '&pidentifier=' . $pidentifier ;
2009-08-27 07:20:05 +00:00
} else {
2009-11-03 16:14:32 +00:00
$href [ 'normal' ] = '#' ;
}
}
if ( isset ( $href [ 'normal' ]))
{
if ( $href [ 'normal' ] == '#' ){
2009-08-27 07:20:05 +00:00
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 . ' <20> ' . $daysTo . ' Jours, Tarif : ' . $tabPaysPrix [ 0 ][ 'normal' ] . ' €)</i>' ;
2009-11-03 16:14:32 +00:00
} else {
print '<br/><br/><a href="' . $href [ 'normal' ] . '">Commander le rapport en mode normal</a><br/><i>(D<> lais : ' . $daysFrom . ' <20> ' . $daysTo . ' Jours, Tarif : ' . $tabPaysPrix [ 0 ][ 'normal' ] . ' €)</i>' ;
//print '<br/><br/><a href="#" title="Fonctionnalit<69> s d<> sactiv<69> es">Commander le rapport en mode normal</a><br/><i>(D<> lais : '.$daysFrom.' <20> '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['normal'].' €)</i>';
2009-08-27 07:20:05 +00:00
}
}
2009-11-03 16:14:32 +00:00
else
{
print '<br/><br/><a href="#" title="Type de commande indisponible">Rapport en mode normal indisponible</a><br/><i>(D<> lais : ' . $daysFrom . ' <20> ' . $daysTo . ' Jours, Tarif : ' . $tabPaysPrix [ 0 ][ 'normal' ] . ' €)</i>' ;
}
2009-08-27 07:20:05 +00:00
//Affichage des diff<66> rents rapports dans l'ordre
2009-11-03 16:14:32 +00:00
if ( in_array ( 'Superflash' , $tabReport ))
{
2009-08-27 07:20:05 +00:00
$key = array_search ( 'Superflash' , $tabReport );
$pidentifier = $tabProducts [ $key ][ 'identifier' ];
$daysFrom = $tabProducts [ $key ][ 'DaysFrom' ];
$daysTo = $tabProducts [ $key ][ 'DaysTo' ];
//V<> rification des droits
if ( preg_match ( '/international/i' , $_SESSION [ 'tabInfo' ][ 'droits' ])){
2009-11-03 16:14:32 +00:00
$href [ 'superflash' ] = './?page=international_enquete&speed=superflash&identifier=' . $identifier . '&pidentifier=' . $pidentifier ;
2009-08-27 07:20:05 +00:00
} else {
2009-11-03 16:14:32 +00:00
$href [ 'superflash' ] = '#' ;
}
}
if ( isset ( $href [ 'superflash' ]))
{
if ( $href [ 'normal' ] == '#' ){
2009-08-27 07:20:05 +00:00
print '<br/><br/><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 . ' <20> ' . $daysTo . ' Jours, Tarif : ' . $tabPaysPrix [ 0 ][ 'superflash' ] . ' €)</i>' ;
2009-11-03 16:14:32 +00:00
} else {
print '<br/><br/><a href="' . $href [ 'superflash' ] . '">Commander le rapport en mode rapide</a><br/><i>(D<> lais : ' . $daysFrom . ' <20> ' . $daysTo . ' Jours, Tarif : ' . $tabPaysPrix [ 0 ][ 'superflash' ] . ' €)</i>' ;
2009-08-27 07:20:05 +00:00
}
}
2009-11-03 16:14:32 +00:00
else
{
print '<br/><br/><a href="#" title="Type de commande indisponible">Rapport imm<6D> diat indisponible</a><br/><i>(D<> lais : ' . $daysFrom . ' <20> ' . $daysTo . ' Jours, Tarif : ' . $tabPaysPrix [ 0 ][ 'normal' ] . ' €)</i>' ;
}
if ( in_array ( 'Immediate' , $tabReport ))
{
2009-08-27 07:20:05 +00:00
$key = array_search ( 'Immediate' , $tabReport );
$pidentifier = $tabProducts [ $key ][ 'identifier' ];
2009-11-03 16:14:32 +00:00
isset ( $tabProducts [ $key ][ 'format' ]) ? $format = $tabProducts [ $key ][ 'format' ] : $format = '' ;
2009-08-27 07:20:05 +00:00
//V<> rification des droits
if ( preg_match ( '/international/i' , $_SESSION [ 'tabInfo' ][ 'droits' ])){
2009-11-03 16:14:32 +00:00
$href [ 'immediate' ] = './?page=international_identitec&identifier=' . $identifier . '&pidentifier=' . $pidentifier ;
if ( ! empty ( $format ) ) { $href [ 'immediate' ] .= '&format=xml' ; }
2009-08-27 07:20:05 +00:00
} else {
2009-11-03 16:14:32 +00:00
$href [ 'immediate' ] = '#' ;
}
}
if ( isset ( $href [ 'immediate' ]))
{
if ( $href [ 'immediate' ] == '#' ){
2009-08-27 07:20:05 +00:00
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<6D> diat, Tarif : ' . $tabPaysPrix [ 0 ][ 'immediate' ] . ' €)</i>' ;
2009-11-03 16:14:32 +00:00
} else {
print '<br/><br/><a href="' . $href [ 'immediate' ] . '">Consutler le rapport disponible</a><br/><i>(D<> lais : Imm<6D> diat, Tarif : ' . $tabPaysPrix [ 0 ][ 'immediate' ] . ' €)</i>' ;
2009-08-27 07:20:05 +00:00
}
}
2009-11-03 16:14:32 +00:00
else
{
print '<br/><br/><a href="#" title="Type de commande indisponible">Rapport imm<6D> diat indisponible</a><br/><i>(D<> lais : ' . $daysFrom . ' <20> ' . $daysTo . ' Jours, Tarif : ' . $tabPaysPrix [ 0 ][ 'normal' ] . ' €)</i>' ;
}
2009-08-27 07:20:05 +00:00
}
?>
</ td >
</ tr >
< tr >
< td colspan = " 3 " >& nbsp ; </ td >
</ tr >
< ? php
2009-11-03 16:14:32 +00:00
$identifiers = $company -> CompanyIdentifiers -> CompanyIdentifier ;
2009-08-27 07:20:05 +00:00
foreach ( $identifiers as $identifier ){
if ( $identifier -> Type != 'Internal' ){
?>
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " >
< ? php
$identifierDescription = FALSE ;
if ( is_array ( $tabIdentifiers )){
foreach ( $tabIdentifiers as $tabIdentifier ){
if ( $tabIdentifier -> Type == $identifier -> Type ){
print $tabIdentifier -> 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 " >
2009-11-03 16:14:32 +00:00
< ? php print $identifier -> Identifier ; ?> </td>
2009-08-27 07:20:05 +00:00
</ tr >
< tr >
< td colspan = " 3 " >& nbsp ; </ td >
</ tr >
< ? php
}
}
?>
</ table >
< h2 > Raison sociale et coordonn<EFBFBD> es : </ h2 >
< table >
2009-11-03 16:14:32 +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 >
2009-08-27 07:20:05 +00:00
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Adresse Compl<EFBFBD> te </ td >
2009-11-03 16:14:32 +00:00
< td width = " 350 " class = " StyleInfoData " >< ? = cleanutf8 ( $company -> RegisteredAddress -> EntireAddress ); ?> </td>
2009-08-27 07:20:05 +00:00
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Adresse </ td >
2009-11-03 16:14:32 +00:00
< td width = " 350 " class = " StyleInfoData " >< ? = cleanutf8 ( $company -> RegisteredAddress -> Building . ', ' . $company -> RegisteredAddress -> Street ); ?> </td>
2009-08-27 07:20:05 +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>
</ 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 >
< ? php
2009-11-03 16:14:32 +00:00
if ( count ( $company -> Activites ) > 0 )
{
foreach ( $company -> Activites as $activity )
{
2009-08-27 07:20:05 +00:00
?>
< 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>
</ tr >
< ? php
}
} else {
?>
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td colspan = " 2 " class = " StyleInfoData " > Aucune information disponible </ td >
</ tr >
< ? php
}
?>
< tr >
< td colspan = " 3 " >& nbsp ; </ td >
</ tr >
</ table >
< h2 > G<EFBFBD> olocalisation : </ h2 >
< ? php
/*
$adresse = $company -> RegisteredAddress -> Building ;
$codePostal = $company -> RegisteredAddress -> PostCode ;
$ville = $company -> RegisteredAddress -> City ;
*/
/*
try {
$geoCodeResult = $client -> geoCode ( '19 rue de saulnier' , '75009' , 'paris' , 'france' );
$firephp -> log ( $geoCodeResult , 'geocode' );
} catch ( SoapFault $fault ){
print '<pre>' ;
print $client -> __getLastResponse ();
print '</pre>' ;
}
*/
/*
* R<EFBFBD> cup<EFBFBD> ration du geoCode
* La page est charg<EFBFBD> alors par javascript on load en ajax
* Chargement de la carte ( nouvelle page loadMap . php ? ? )
* loadMap => On v<EFBFBD> rifie la session
* => On envoi le geocode ? ? les markers suppl<EFBFBD> mentaires
*/
?>
< ? php
} else {
?>
< table >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td colspan = " 2 " class = " StyleInfoData " > Aucune information disponible </ td >
</ tr >
</ table >
< ? php
}
?>
</ div >