2009-07-21 07:17:54 +00:00
< ?
2009-05-20 15:49:08 +00:00
if ( ! $_SESSION [ 'connected' ]) die ();
2009-03-05 16:19:38 +00:00
2009-05-20 15:49:08 +00:00
require_once 'partenaires/classMTva.php' ;
require_once 'partenaires/classMMap.php' ;
require_once 'common/dates.php' ;
2009-08-27 07:39:27 +00:00
require_once 'cache/cache.php' ;
2009-03-05 16:19:38 +00:00
2009-02-17 13:14:53 +00:00
$siret = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'siret' ]));
2010-02-10 17:27:03 +00:00
if ( strlen ( $siret ) <> 0 && strlen ( $siret ) <> 9 && strlen ( $siret ) <> 14 ) die ( 'Paramètres incorrects !' );
2009-02-17 13:14:53 +00:00
2010-02-10 17:27:03 +00:00
$idEntreprise = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'idEntreprise' ])) * 1 ; // Si id=0 alors non communiqué
if (( $siret * 1 ) == 0 && $idEntreprise == 0 ) die ( 'Paramètres incorrects !' );
2009-02-17 13:14:53 +00:00
$siren = substr ( $siret , 0 , 9 );
2010-03-18 14:57:23 +00:00
$raisonSociale = etabSession ( $siren );
2009-02-17 13:14:53 +00:00
$mil = false ;
2009-05-20 15:49:08 +00:00
?>
2009-08-27 07:39:27 +00:00
< div id = " center " >
< h1 class = " titre " > LISTE DES & Eacute ; V & Eacute ; NEMENTS </ h1 >
< table >
< tr >
2009-05-20 15:49:08 +00:00
< 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>
2009-08-27 07:39:27 +00:00
</ tr >
< tr >
2009-05-20 15:49:08 +00:00
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Raison Sociale </ td >
2010-03-18 14:57:23 +00:00
< td width = " 350 " class = " StyleInfoData " >< ? = $raisonSociale ?> </td>
2009-08-27 07:39:27 +00:00
</ tr >
</ table >
2009-11-05 13:49:08 +00:00
< h2 >& Eacute ; v & eacute ; nements INSEE </ h2 >
2009-08-27 07:39:27 +00:00
< table >
2009-05-20 15:49:08 +00:00
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td colspan = " 2 " width = " 550 " class = " StyleInfoData " >
< ? php
2010-02-10 17:27:03 +00:00
//Géné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-05 16:19:38 +00:00
$fileName = $page2 . '-' . $idEntreprise ;
} else {
2009-03-10 15:07:24 +00:00
$fileName = $page2 . '-' . $siret ;
2009-03-10 09:13:05 +00:00
}
2009-08-27 07:39:27 +00:00
cache_filename ( $fileName );
2009-12-10 09:54:47 +00:00
if ( cache_exist () && ! ( preg_match ( '/\bsaisie\b/i' , $_SESSION [ 'tabInfo' ][ 'droits' ]) || $_SESSION [ 'tabInfo' ][ 'mode_edition' ] == 1 ) )
2009-08-27 07:39:27 +00:00
{
$evens = cache_get ( 'evens' );
//Affichage d'un message d'erreur
if ( $evens === FALSE ) exit ;
2009-03-05 16:19:38 +00:00
} else {
try {
$O = $client -> getListeEvenements ( $siren );
2009-08-27 07:39:27 +00:00
$evens = $O [ 'result' ];
cache_delete ();
cache_add ( 'evens' , $evens );
2009-03-05 16:19:38 +00:00
} catch ( SoapFault $fault ) {
2009-05-20 15:49:08 +00:00
require_once 'soaperror.php' ;
2009-08-27 07:39:27 +00:00
processSoapFault ( $client , $fault , $_SESSION [ 'tabInfo' ]);
2009-03-05 16:19:38 +00:00
die ();
}
2009-08-27 07:39:27 +00:00
}
2009-05-20 15:49:08 +00:00
?>
< table >
< ? php
2009-08-27 07:39:27 +00:00
foreach ( $evens as $i => $even )
{
2010-02-10 17:27:03 +00:00
if ( $even [ 'Siege' ] == 1 ) $type = 'siège' ;
else $type = 'établissement' ;
$lien = '<a title="Voir la fiche d\'identité" href="/?page=identite&siret=' . $siren . $even [ 'Nic' ] . '&idEntreprise=' . $idEntreprise . '">' ;
$lien2 = '<a title="Voir la fiche d\'identité" href="/?page=identite&siret=' . $even [ 'SiretAss' ] . '&idEntreprise=' . $idEntreprise . '">' ;
2009-08-27 07:39:27 +00:00
?>
< tr >
< td class = " StyleInfoLib " width = " 60 " >< ? = WDate :: dateT ( 'Ymd' , 'd/m/Y' , $even [ 'DateInfo' ]) ?> </td>
< td class = " StyleInfoData " width = " 480 " >< b >< ? = $even [ 'EvenLib' ] ?> </b> <i> - NIC <?=$lien.$even['Nic'].'</a>'?> le <?=WDate::dateT('Ymd','d/m/Y',$even['EvenDate'])?></i>
< ?
if ( trim ( $even [ 'EvenLibDet' ]) <> '' ) echo '<br/>' . str_replace ( ', ' , '<br/>' , $even [ 'EvenLibDet' ]);
if ( $even [ 'SiretAss' ] * 1 <> 0 && $even [ 'TypeSiretAss' ] <> '' ) echo '<br/>Siret du ' . $even [ 'TypeSiretAss' ] . ' : ' . $lien2 . substr ( $even [ 'SiretAss' ], 0 , 9 ) . ' ' . substr ( $even [ 'SiretAss' ], 9 , 5 ) . '</a>' ;
elseif ( $even [ 'SiretAss' ] * 1 <> 0 && $even [ 'TypeSiretAss' ] == '' ) echo '<br/>Siret associé : ' . $lien2 . substr ( $even [ 'SiretAss' ], 0 , 9 ) . ' ' . substr ( $even [ 'SiretAss' ], 9 , 5 ) . '</a>' ;
?>
</ td >
</ tr >
2009-05-20 15:49:08 +00:00
< ?
}
if ( count ( $evens ) == 0 )
2009-05-26 10:07:52 +00:00
echo '<tr><td class="StyleInfoData" width="580"> Aucun évènement n\'est présent dans notre base</td></tr>' ;
2009-05-20 15:49:08 +00:00
?>
</ table >
2009-07-21 07:17:54 +00:00
< ? php
2010-02-10 17:27:03 +00:00
//Exportation des données sous forme de fichier
2009-08-27 07:39:27 +00:00
function htmldecode ( $value ){
$value = is_array ( $value ) ? array_map ( 'htmldecode' , $value ) : html_entity_decode ( $value , ENT_QUOTES , 'UTF-8' );
return $value ;
}
2009-07-21 07:17:54 +00:00
2009-08-27 07:39:27 +00:00
//$firephp->log($evens, 'Evenements');
$tabForExport = htmldecode ( $evens );
//$firephp->log($tabForExport, 'tabForExport');
2009-07-21 07:17:54 +00:00
2009-08-27 07:39:27 +00:00
if ( count ( $tabForExport ) > 0 )
{
require_once 'export.php' ;
2009-07-21 07:17:54 +00:00
2009-08-27 07:39:27 +00:00
$array2csv = new ExportCSV ();
$array2csv -> records = $tabForExport ;
$array2csv -> writeCSV ( $fileName );
2009-07-21 07:17:54 +00:00
2009-08-27 07:39:27 +00:00
$array2xml = new ExportXML ();
$array2xml -> rootName = $page . 's' ;
$array2xml -> defaultTagName = $page ;
$array2xml -> records = $tabForExport ;
$array2xml -> writeXML ( $fileName );
}
2009-05-20 15:49:08 +00:00
?>
2009-07-21 07:17:54 +00:00
</ td >
2009-05-20 15:49:08 +00:00
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
2009-05-22 09:53:48 +00:00
< td colspan = " 3 " width = " 550 " class = " StyleInfoData " >
2009-07-21 07:17:54 +00:00
< ? php
2009-05-20 15:49:08 +00:00
require_once 'surveillance/surveillance.php' ;
2009-12-15 17:14:21 +00:00
echo getSurveillance ( 'insee' , $siret );
2009-05-20 15:49:08 +00:00
?>
</ td >
</ tr >
2009-08-27 07:39:27 +00:00
</ table >
</ div >