2009-07-20 16:17:33 +00:00
< ?
2009-03-06 16:29:16 +00:00
if ( ! $_SESSION [ 'connected' ]) die ();
2009-07-20 16:17:33 +00:00
require_once 'partenaires/classMTva.php' ;
require_once 'partenaires/classMMap.php' ;
require_once 'common/dates.php' ;
2009-08-17 14:35:28 +00:00
require_once 'cache/cache.php' ;
2009-02-17 13:14:53 +00:00
$siret = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'siret' ]));
if ( strlen ( $siret ) <> 0 && strlen ( $siret ) <> 9 && strlen ( $siret ) <> 14 ) die ( 'Param<61> tres incorrects !' );
2009-03-11 07:51:18 +00:00
$idEntreprise = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'idEntreprise' ])) * 1 ; // Si id=0 alors non communiqu<71>
if (( $siret * 1 ) == 0 && $idEntreprise == 0 ) die ( 'Param<61> tres incorrects !' );
2009-02-17 13:14:53 +00:00
$siren = substr ( $siret , 0 , 9 );
if ( $_REQUEST [ 'vue' ] == 'histo' )
$histo = true ;
else
$histo = false ;
2009-07-20 16:17:33 +00:00
2009-03-06 16:29:16 +00:00
//G<> n<EFBFBD> rer un nom de fichier pour le cache et l'export des fichiers
2009-03-10 15:07:24 +00:00
if (( $siret * 1 ) == 0 && ( $siren * 1 ) < 100 ){
2009-03-06 16:29:16 +00:00
$fileName = $page2 . '-' . $idEntreprise ;
} else {
2009-03-10 15:07:24 +00:00
$fileName = $page2 . '-' . $siret ;
2009-03-06 16:29:16 +00:00
}
if ( $_REQUEST [ 'vue' ] == 'histo' ){ $fileName .= '-histo' ; }
2009-08-17 14:35:28 +00:00
cache_filename ( $fileName );
2009-03-06 16:29:16 +00:00
2009-08-17 14:35:28 +00:00
if ( cache_exist () && ! ( preg_match ( '/saisie/i' , $_SESSION [ 'tabInfo' ][ 'droits' ]) || $_SESSION [ 'tabInfo' ][ 'mode_edition' ] == 1 ) ){
$dirs = cache_get ( 'dirs' );
//Affichage d'un message d'erreur
if ( $dirs === FALSE ) exit ;
$firephp -> info ( 'CACHE' );
2009-07-20 16:17:33 +00:00
} else {
2009-03-06 16:29:16 +00:00
try {
$O = $client -> getDirigeants ( $siren , $histo );
2009-08-17 14:35:28 +00:00
$dirs = $O [ 'result' ];
cache_delete ();
cache_add ( 'dirs' , $dirs );
2009-03-06 16:29:16 +00:00
} catch ( SoapFault $fault ) {
2009-07-21 07:17:54 +00:00
require_once 'soaperror.php' ;
2009-08-17 14:35:28 +00:00
processSoapFault ( $client , $fault , $_SESSION [ 'tabInfo' ]);
2009-03-06 16:29:16 +00:00
die ();
}
2009-08-17 14:35:28 +00:00
}
$firephp -> log ( $dirs , 'dirs' );
$raisonSociale = $_SESSION [ 'tabInfo' ][ 'entrep' ][ 'raisonSociale' ];
?>
< table width = " 580 " border = " 0 " align = " left " bgcolor = " #FFFFFF " id = " center " >
< tr >< td colspan = " 3 " >< h1 > DIRIGEANTS </ h1 ></ td ></ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Num & eacute ; ro identifiant Siren </ td >
< td width = " 350 " class = " StyleInfoData " >< ? = substr ( $siren , 0 , 3 ) . ' ' . substr ( $siren , 3 , 3 ) . ' ' . substr ( $siren , 6 , 3 ) ?> </td>
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Raison Sociale </ td >
< td width = " 350 " class = " StyleInfoData " >< ? = $raisonSociale ?> </td>
</ tr >
< tr >
< td colspan = " 3 " >& nbsp ; </ td >
</ tr >
< ? php
if ( $histo )
{
?>
< tr >< td colspan = " 3 " >< h2 > Historique des dirigeants </ h2 ></ td ></ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td colspan = " 2 " width = " 550 " class = " StyleInfoData " >
< table >
< ? php
foreach ( $dirs as $i => $dir )
{
$nom = $dir [ 'Societe' ] . ' ' . $dir [ 'Nom' ] . ' ' . $dir [ 'Prenom' ];
2009-07-20 16:17:33 +00:00
?>
2009-08-17 14:35:28 +00:00
< tr >< td class = " StyleInfoData " width = " 100 " >< ? = $dir [ 'Titre' ] ?> </td>
< td class = " StyleInfoData " width = " 200 " >< ? = $nom ?> </td>
< td class = " StyleInfoData " width = " 200 " >
< ? php
if ( $dir [ 'DateFct' ] <> '' ) {
//if ($dir['Ancien']) echo 'Fonction abandonée le ';
//else echo 'Prise de fonction le ';
echo 'Modification le ' ;
echo WDate :: dateT ( 'Y-m-d' , 'd/m/Y' , $dir [ 'DateFct' ]);
2009-05-27 10:27:21 +00:00
}
?>
2009-08-17 14:35:28 +00:00
</ td >
</ tr >
2009-07-20 16:17:33 +00:00
< ? php
}
2009-08-17 14:35:28 +00:00
if ( count ( $dirs ) == 0 )
echo '<tr><td class="StyleInfoData" width="550"> Aucune donnée n\'est présente dans notre base</td></tr>' ;
2009-03-06 16:29:16 +00:00
?>
</ table >
2009-08-17 14:35:28 +00:00
</ td >
</ tr >
< ? php
} else {
?>
< tr >< td colspan = " 3 " >< h2 > Liste des dirigeants actifs </ h2 ></ td ></ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td colspan = " 2 " width = " 550 " class = " StyleInfoData " >
< table >
< ? php
foreach ( $dirs as $i => $dir )
{
2009-08-24 07:31:04 +00:00
$societe = str_replace ( '&#160;' , ' ' , $dir [ 'Societe' ]);
2009-08-17 14:35:28 +00:00
$nom = str_replace ( '&#160;' , ' ' , $dir [ 'Societe' ] . ' ' . $dir [ 'Nom' ] . ' ' . $dir [ 'Prenom' ]);
if ( isset ( $dir [ 'Civilite' ]) && $dir [ 'Civilite' ] != '' ){ $nom = $dir [ 'Civilite' ] . '. ' . $nom ;}
?>
< tr >
< td class = " StyleInfoData " width = " 120 " >< ? php print $dir [ 'Titre' ]; ?> </td>
< td class = " StyleInfoData " width = " 200 " >
2009-08-24 07:07:40 +00:00
< ? php
if ( $societe != '' ){
?>
2009-08-24 07:31:04 +00:00
< a href = " /?page=recherche&vue=list&formR[type]=ent&formR[raisonSociale]=<?php print $societe ;?> " title = " Recherche <20> partir de la raison sociale " >
< ? php print $societe ; ?>
</ a >
2009-07-20 16:17:33 +00:00
< ? php
}
2009-03-06 16:29:16 +00:00
?>
2009-08-24 07:31:04 +00:00
& nbsp ;
< ? php
if ( $nom != '' ){
?>
2009-08-17 14:35:28 +00:00
< a href = " /?page=recherche&vue=list&formR[type]=dir&formR[dirNom]=<?php print $dir['Nom'] ;?>&formR[dirPrenom]=<?php print $dir['Prenom'] ;?>&formR[dirDateNaissJJ]=<?php print substr( $dir['NaissDate'] ,0,2);?>&formR[dirDateNaissMM]=<?php print substr( $dir['NaissDate'] ,3,2);?>&formR[dirDateNaissAAAA]=<?php print substr( $dir['NaissDate'] ,6,4);?> " title = " Recherche <20> partir du nom du dirigeant " >
< ? php print $nom ; ?>
</ a >
2009-08-24 07:31:04 +00:00
< ? php
}
?>
2009-08-17 14:35:28 +00:00
</ p >
</ td >
< td class = " StyleInfoData " width = " 230 " >< ?
if ( trim ( $dir [ 'NaissDate' ]) <> '' && trim ( $dir [ 'NaissVille' ] . ' ' . $dir [ 'NaissDepPays' ]) <> '' ) {
echo 'né(e) le ' . $dir [ 'NaissDate' ] . ' à ' . $dir [ 'NaissVille' ];
if ( trim ( $dir [ 'NaissDepPays' ]) <> '' )
echo ' (' . $dir [ 'NaissDepPays' ] . ')' ;
} elseif ( trim ( $dir [ 'NaissDate' ]) <> '' ) {
echo 'né(e) le ' . $dir [ 'NaissDate' ];
} elseif ( trim ( $dir [ 'NaissVille' ] . ' ' . $dir [ 'NaissDepPays' ]) <> '' ) {
echo 'né(e) à ' . $dir [ 'NaissVille' ];
echo ' (' . $dir [ 'NaissDepPays' ] . ')' ;
}
?>
</ td >
</ tr >
2009-03-06 16:29:16 +00:00
< ?
2009-02-17 13:14:53 +00:00
}
2009-08-17 14:35:28 +00:00
if ( count ( $dirs ) == 0 )
echo '<tr><td class="StyleInfoData" width="550"> Aucune donnée n\'est présente dans notre base</td></tr>' ;
?>
</ table >
</ td >
</ tr >
< ? php
}
?>
</ table >
< ? php
//Exportation des donn<6E> es sous forme de fichier
function htmldecode ( $value ){
$value = is_array ( $value ) ? array_map ( 'htmldecode' , $value ) : html_entity_decode ( $value , ENT_QUOTES , 'UTF-8' );
return $value ;
}
$firephp -> log ( $dirs , 'Etablissements' );
$tabForExport = htmldecode ( $dirs );
if ( count ( $tabForExport ) > 0 ){
require_once 'export.php' ;
2009-07-20 16:17:33 +00:00
2009-08-17 14:35:28 +00:00
$array2csv = new ExportCSV ();
$array2csv -> records = $tabForExport ;
$array2csv -> writeCSV ( $fileName );
2009-07-20 16:17:33 +00:00
2009-08-17 14:35:28 +00:00
$array2xml = new ExportXML ();
$array2xml -> rootName = $page . 's' ;
$array2xml -> defaultTagName = $page ;
if ( $_REQUEST [ 'vue' ] == 'histo' ){
$array2xml -> rootName = 'historique' . $page . 's' ;
$array2xml -> defaultTagName = 'historique' . $page ;
2009-03-06 17:12:26 +00:00
}
2009-08-17 14:35:28 +00:00
$array2xml -> records = $tabForExport ;
$array2xml -> writeXML ( $fileName );
}
2009-02-17 13:14:53 +00:00
?>