2009-03-06 16:29:16 +00:00
< ?
if ( ! $_SESSION [ 'connected' ]) die ();
2009-04-01 12:45:45 +00:00
$tabInfo = $_SESSION [ 'tabInfo' ];
2009-03-06 16:29:16 +00:00
include_once ( INCLUDE_PATH . '/partenaires/classMTva.php' );
include_once ( INCLUDE_PATH . '/partenaires/classMMap.php' );
//include_once(INCLUDE_PATH.'partenaires/classMCoface.php');
include_once ( FWK_PATH . '/common/dates.php' );
require_once ( realpath ( dirname ( __FILE__ ) . '/../../includes/' ) . '/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-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' ; }
//Mise en Cache
$cache = new Cache ();
2009-03-10 09:13:05 +00:00
//Forcer la cr<63> ation de la page dans le cache lorsque l'utilisateur a le mode saisie
2009-03-11 18:31:26 +00:00
if ( preg_match ( '/saisie/i' , $_SESSION [ 'tabInfo' ][ 'droits' ]) || $_SESSION [ 'tabInfo' ][ 'mode_edition' ] == 1 ) {
2009-03-10 09:13:05 +00:00
$cache -> disable = TRUE ;
}
2009-05-28 08:27:11 +00:00
$cache -> forceStart = TRUE ;
2009-03-10 09:13:05 +00:00
if ( $cache -> startCapture ( $fileName . '.html' ) == FALSE ){
2009-03-06 16:29:16 +00:00
print $cache -> displayCache ();
} else {
2009-03-25 14:38:22 +00:00
2009-03-06 16:29:16 +00:00
try {
$O = $client -> getDirigeants ( $siren , $histo );
$dirs = $O [ 'result' ];
} catch ( SoapFault $fault ) {
include_once ( realpath ( dirname ( __FILE__ ) . '/../../' ) . '/includes/soaperror.php' );
processSoapFault ( $client , $fault , $tabInfo );
die ();
}
2009-05-27 10:27:21 +00:00
$firephp -> log ( $dirs , 'dirs' );
2009-02-17 13:14:53 +00:00
$raisonSociale = $tabInfo [ 'entrep' ][ 'raisonSociale' ];
2009-03-06 16:29:16 +00:00
2009-06-04 16:30:12 +00:00
?>
2009-03-06 16:29:16 +00:00
< table width = " 580 " border = " 0 " align = " left " bgcolor = " #FFFFFF " >
< tr >
< td colspan = " 3 " >< img src = " ./img/rub_dirigeant.png " width = " 577 " height = " 36 " ></ 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 >
< ? if ( $histo ) { ?>
< tr >
< td colspan = " 3 " >< img src = " ./img/srub_dirhisto.png " width = " 576 " height = " 27 " ></ td >
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
2009-05-28 08:27:11 +00:00
< td colspan = " 2 " width = " 550 " class = " StyleInfoData " >< table >
< ? php
2009-03-06 16:29:16 +00:00
foreach ( $dirs as $i => $dir ) {
$nom = $dir [ 'Societe' ] . ' ' . $dir [ 'Nom' ] . ' ' . $dir [ 'Prenom' ];
2009-05-28 08:27:11 +00:00
?>
2009-06-04 16:30:12 +00:00
< tr >< td class = " StyleInfoData " width = " 100 " >< ? = $dir [ 'Titre' ] ?> </td>
2009-05-28 08:27:11 +00:00
< td class = " StyleInfoData " width = " 200 " >< ? = $nom ?> </td>
< td class = " StyleInfoData " width = " 200 " >
< ? php
2009-03-06 16:29:16 +00:00
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' ]);
}
?> </td></tr><?
2009-02-17 13:14:53 +00:00
}
2009-03-06 16:29:16 +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 >
< ? } else { ?>
< tr >
< td colspan = " 3 " >< img src = " ./img/srub_dirliste.png " width = " 576 " height = " 27 " ></ td >
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
2009-06-04 16:30:12 +00:00
< td colspan = " 2 " width = " 550 " class = " StyleInfoData " >
< table >
< ?
2009-03-06 16:29:16 +00:00
foreach ( $dirs as $i => $dir ) {
2009-05-27 10:27:21 +00:00
$nom = str_replace ( '&#160;' , ' ' , $dir [ 'Societe' ] . ' ' . $dir [ 'Nom' ] . ' ' . $dir [ 'Prenom' ]);
2009-06-04 16:30:12 +00:00
if ( isset ( $dir [ 'Civilite' ]) && $dir [ 'Civilite' ] != '' ){ $nom = $dir [ 'Civilite' ] . '. ' . $nom ;}
2009-05-27 10:27:21 +00:00
?>
< tr >
2009-06-04 16:30:12 +00:00
< td class = " StyleInfoData " width = " 120 " >< ? php print $dir [ 'Titre' ]; ?> </td>
< td class = " StyleInfoData " width = " 200 " >
2009-06-16 16:07:50 +00:00
< p >
< 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 >
</ p >
2009-05-28 08:27:11 +00:00
</ td >
2009-06-04 16:30:12 +00:00
< td class = " StyleInfoData " width = " 230 " >< ?
2009-05-27 10:27:21 +00:00
if ( trim ( $dir [ 'NaissDate' ]) <> '' && trim ( $dir [ 'NaissVille' ] . ' ' . $dir [ 'NaissDepPays' ]) <> '' ) {
2009-03-06 16:29:16 +00:00
echo 'né(e) le ' . $dir [ 'NaissDate' ] . ' à ' . $dir [ 'NaissVille' ];
2009-05-27 10:27:21 +00:00
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
}
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 >
< ?
//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 ;
2009-02-17 13:14:53 +00:00
}
2009-03-06 16:29:16 +00:00
$firephp -> log ( $dirs , 'Etablissements' );
$tabForExport = htmldecode ( $dirs );
2009-03-06 17:12:26 +00:00
if ( count ( $tabForExport ) > 0 ){
require_once ( realpath ( dirname ( __FILE__ ) . '/../../includes/' ) . '/export.php' );
$array2csv = new ExportCSV ();
$array2csv -> records = $tabForExport ;
$array2csv -> writeCSV ( $fileName );
2009-03-06 16:29:16 +00:00
2009-03-06 17:12:26 +00:00
$array2xml = new ExportXML ();
2009-03-10 15:07:24 +00:00
$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
$array2xml -> records = $tabForExport ;
$array2xml -> writeXML ( $fileName );
}
2009-03-06 16:29:16 +00:00
} //Fin test mise en cache
$cache -> stopCapture (); //On arrete la capture pour le cache
2009-02-17 13:14:53 +00:00
?>