extranet/www/pages/annonces.php
2010-05-28 15:19:59 +00:00

435 lines
14 KiB
PHP

<?php
if (!page_checkParams()) die('Paramètres incorrects !');
require_once 'cache/cache.php';
require_once 'partenaires/classMTva.php';
require_once 'partenaires/classMMap.php';
require_once 'partenaires/classMCoface.php';
require_once 'common/dates.php';
require_once 'scoresws/scoresws.php';
if (isset($_REQUEST['idan']) && $_REQUEST['idan']*1!=0)
$idan = $_REQUEST['idan'];
else
$idan = false;
$vue = (isset($_GET['vue'])) ? $_GET['vue'] : '';
$message='';
//Récupération des infos du webservice
$annonces = scoresws_annonces($siret, $siren, $idEntreprise, $vue, $idan);
?>
<div id="center">
<h1 class="titre">ANNONCES L&Eacute;GALES</h1>
<table>
<?php if ($message<>'') { ?>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="3" class="StyleInfoData">
<h3><?=$message;?></h3>
</td>
</tr>
<?php }?>
<tr>
<td width="30">&nbsp;</td>
<td width="200" colspan="2" 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" colspan="2" class="StyleInfoLib">
Raison Sociale
</td>
<td width="350" class="StyleInfoData">
<?=$raisonSociale?>
<?php
if(hasModeEdition())
{
?>
<a href="./?page=saisie&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>">
(Edition)
</a>
<?php
}
?>
</td>
</tr>
</table>
<?php
if ($idan && ($vue=='bodacc' || $vue=='abod' || $vue=='balo' || $vue=='asso'))
{
if($vue=='asso' && $siren==0)
{
foreach($annonces as $ann){
if($ann['id']==$idan)
break;
}
}else{
$ann = $annonces[0];
}
/** AFFICHAGE D'UNE ANNONCE BODACC / BALO / ASSO **/
// Entête BALO
if ($vue=='balo')
{
?>
<h2>BALO</h2>
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="3" class="StyleInfoData">
BALO n&deg;<?=$ann['BodaccNum']?>&nbsp;du <?=WDate::dateT('Y-m-d','d/m/Y',$ann['DateParution'])?>. Entr&eacute; n&deg;<?=$ann['NumAnnonce']?>. Entr&eacute;e en base S&amp;D : <?=WDate::dateT('Y-m-d','d/m/Y',$ann['dateInsertionSD'])?>.<br/>
<a href="/?page=annonces&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>&idan=<?=$_REQUEST['idan']?>&vue=balo&mode=pdf" target="_blank">Cliquez ici pour voir cette annonce au format PDF&nbsp;(<?=adapteOCtets(@filesize(PATH_DATA.'/jo/balo/'.WDate::dateT('Y-m-d','Y',$ann['DateParution']).'/'. $ann['Lien_Annonce_Pdf']))?>)</a>
.</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="3" class="StyleInfoLib"><b><?=$ann['Categorie']?></b></td>
</tr>
<tr>
</table>
<?php
$ann['texteAnnonce']=utf8_decode($ann['texteAnnonce']);
}
elseif ($vue=='bodacc' || $vue=='abod')
{
?>
<h2>&Eacute;V&Eacute;NEMENTS L&Eacute;GAUX</h2>
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="3" class="StyleInfoData">
<?php
$tabSource=explode('-', $ann['BodaccCode']);
$source=$tabSource[0];
$idSource=@$tabSource[1];
if ($source[0] == 'B') {
if ($ann['BodaccNum']==0)
echo '<img src="./img/logo_jo.png"/>&nbsp;&nbsp;Source BODACC '.substr($ann['BodaccCode'],-1).' du '.WDate::dateT('Y-m-d','d/m/Y',$ann['DateParution']);
else
echo '<img src="./img/logo_jo.png"/>&nbsp;&nbsp;&nbsp;Source BODACC n&deg;'.$ann['BodaccNum'].'&nbsp;'.substr($ann['BodaccCode'],-1).' du '.WDate::dateT('Y-m-d','d/m/Y',$ann['DateParution']).'. D&eacute;partement n&deg;'.$ann['Departement'].'. <a href="/?page=competences&siret='.$siret.'&type=tri">'.$ann['Tribunal'].'</a>';
}elseif ($source[0] == 'G' || $source[0] == 'T'){
echo '<img src="./img/logo_greffe.png"/>&nbsp;&nbsp;Source Greffe du Tribunal';
}elseif ($source[0] == 'P'){
echo '<img src="./img/logo_inpi.png"/>&nbsp;&nbsp;Source Registre National du Commerce';
}else{
echo '<img src="./img/logo_jal.png"/>';
if( hasModeEdition() && substr($source,0,2)=='JT' ){
echo ' <b>Source TESSI</b> -';
}
echo '&nbsp;&nbsp;Source Journal Annonces L&eacute;gales';
}
if ($ann['dateInsertionSD'] <> '') {
print ' - Entr&eacute;e en base : ';
$date = new WDate;
print $date->dateT('Y-m-d', 'd/m/Y', $ann['dateInsertionSD']);
}
?>
</td>
</tr>
</table>
<?php
}
elseif ($vue=='asso')
{
?>
<h2>Associations</h2>
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="3" class="StyleInfoData">J.O. ASSOCIATION n&deg;<?=$ann['BodaccNum']?>&nbsp;du <?=WDate::dateT('Y-m-d','d/m/Y',$ann['DateParution'])?>. Annonce n&deg;<?=$ann['NumAnnonce']?>. Entr&eacute;e en base S&amp;D : <?=WDate::dateT('Y-m-d','d/m/Y',$ann['dateInsertionSD'])?>.</td>
</tr>
</table>
<?php
}
?>
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="3" class="StyleInfoLib">
<b>
<?php
foreach (@$ann['evenements'] as $i=>$even) { echo @$even['LibEven'].'<br/>'; }
?>
</b>
</td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<?php
/**Affichage du texte de l'annonce**/
$texte=preg_replace_callback("/((?:[0-9]{9,9})|(?:[0-9]{3,3} [0-9]{3,3} [0-9]{3,3})|(?:[0-9]{3,3}\.[0-9]{3,3}\.[0-9]{3,3})|(?:[0-9]{3,3}-[0-9]{3,3}-[0-9]{3,3}))/", 'replace_siren', $ann['texteAnnonce']);
?>
<td width="550" colspan="3"><code><?=$texte?></code></td>
</tr>
<tr><td colspan="4">&nbsp;</td></tr>
<tr>
<td colspan="4" align="center" class="StyleInfoData"><a href="Javascript:history.back()">Revenir à la liste des annonces</a></td>
</tr>
</table>
<?php
} else if (count($annonces) > 0) {
// Tri des annonces dans des tableaux différents
$annoncesBodacc = array();
$annoncesBalo = array();
$annoncesAsso = array();
foreach ($annonces as $i => $ann) {
if ($ann['BodaccCode'] == 'BODA' ||
$ann['BodaccCode'] == 'BODB' ||
$ann['BodaccCode'] == 'BODC') {
$annoncesBodacc[] = $ann;
} else if ($ann['BodaccCode'] == 'BALO') {
$annoncesBalo[] = $ann;
} else if ($ann['BodaccCode'] == 'ASSO') {
$annoncesAsso[] = $ann;
} else {
$annoncesBodacc[] = $ann;
}
}
/** Affichage de la liste des annonces **/
// Affiche annonces Bodacc
if (count($annoncesBodacc) > 0) {
?>
<h2>EV&Eacute;NEMENTS L&Eacute;GAUX</h2>
<table>
<?php
foreach($annoncesBodacc as $i => $ann) {
?>
<tr>
<td width="30">&nbsp;</td>
<td width="140" class="StyleInfoLib">
<span id="annoncesDate"><p>Le
<?php
$date = new WDate;
print $date->dateT('Y-m-d', 'd/m/Y', $ann['DateParution']);
?>
</p></span>
<span id="annoncesImg">
<?php
$tabSource = explode('-', $ann['BodaccCode']);
$source = $tabSource[0];
$idSource = @$tabSource[1];
if ($source[0] == 'B') {
echo '<img src="./img/logo_jo.png" title="Source BODACC '.
$ann['BodaccNum'].' '.
substr($source,-1).' '.
substr($ann['DateParution'],0,4).'"/>';
} else if ($source[0] == 'G' ||
$source[0] == 'T') {
echo '<img src="./img/logo_greffe.png"'.
' title="Source Collecte Greffe"/>';
} else if ($source[0] == 'P') {
echo '<img src="./img/logo_inpi.png"'.
' title="Source Collecte RNCS"/>';
} else {
echo '<img src="./img/logo_jal.png"'.
' title="Source Collecte JAL';
if ($idSource>0) echo ' $idSource';
echo '"/>';
}
?>
</span>
</td>
<td width="450" colspan="2" class="StyleInfoData">
<a href="/?page=annonces&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>&idan=<?=$ann['id']?>&vue=bodacc">
<?php
foreach ($ann['evenements'] as $i=>$even) {
echo $even['LibEven'];
if (hasModeEdition() && substr($source, 0, 2) == 'JT') {
echo ' <b>(Source TESSI)</b>';
}
$numEven = $even['CodeEven'] * 1;
if ($numEven > 3000 && $numEven < 3999) {
print ' (clôture au ';
$date = new WDate;
print $date->dateT('Y-m-d', 'd/m/Y', $ann['dateEffet']).
')';
}
echo '<br/>';
}
?>
</a>
</td>
</tr>
<?php
}
?>
</table>
<?php
}
// Affiche annonces Balo
if (count($annoncesBalo) > 0) {
?>
<h2>BALO</h2>
<table>
<?php
foreach ($annoncesBalo as $i => $ann) {
?>
<tr>
<td width="30">&nbsp;</td>
<td width="140" class="StyleInfoLib">
<span id="annoncesDate">Le
<?php
$date = new WDate;
print $date->dateT('Y-m-d', 'd/m/Y', $ann['DateParution']);
?>
</span>
<span id="annoncesImg">
<?php
if ($ann['BodaccCode'] == 'BALO'){
echo '<img src="./img/logo_jo.png" title="Source BALO n°'.$ann['BodaccNum'].'"/>';
}
?>
</span>
</td>
<td width="450" colspan="2" class="StyleInfoData">
<a href="/?page=annonces&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>&idan=<?=$ann['id']?>&vue=balo">
<?php
foreach ($ann['evenements'] as $i=>$even) {
print $even['LibEven'];
$numEven=$even['CodeEven']*1;
if ($numEven>3000 && $numEven<3999) print ' (clôture au '.WDate::dateT('Y-m-d','d/m/Y',$ann['dateEffet']).')';
print '<br/>';
}
?>
</a></td>
</tr>
<?php
}
?>
</table>
<?php
}
//Affiche annonces Asso
if (count($annoncesAsso)>0)
{
?>
<h2>Associations</h2>
<table>
<?php
foreach($annoncesAsso as $i => $ann)
{
?>
<tr>
<td width="30">&nbsp;</td>
<td width="140" class="StyleInfoLib">
<span id="annoncesDate">Le <?=WDate::dateT('Y-m-d','d/m/Y',$ann['DateParution']);?></span>
<span id="annoncesImg">
<?php
if ($ann['BodaccCode'] == 'ASSO'){
print '<img src="./img/logo_jo.png" title="Source JO ASSOCIATION n°'.$ann['BodaccNum'].'"/>';
}
?>
</span>
</td>
<td width="450" colspan="2" class="StyleInfoData">
<a href="/?page=annonces&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>&idan=<?=$ann['id']?>&vue=asso">
<?php
foreach ($ann['evenements'] as $i=>$even) {
print $even['LibEven'];
$numEven=$even['CodeEven']*1;
if ($numEven>3000 && $numEven<3999) print ' (clôture au '.WDate::dateT('Y-m-d','d/m/Y',$ann['dateEffet']).')';
print '<br/>';
}
?>
</a></td>
</tr>
<?php
}
?>
</table>
<?php
}
}
else
{
/** Aucune annonce bodacc pour cette entreprise **/
?>
<h2>Evénements légaux</h2>
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="100" class="StyleInfoLib">&nbsp;</td>
<td width="450" colspan="2" class="StyleInfoData">N&eacute;ant</td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
</table>
<?php
}
if (($siret*1)==0 || ($siren*1)<100){ $fileName = $page.'-'.$idEntreprise;
}else{ $fileName = $page.'-'.$siret; }
if($vue!=''){$fileName.= '-'.$idan;}
require_once 'export.php';
$parseTab = new tabExport();
$parseTab->tab = $annonces;
$parseTab->notdisplay = array('id');
$parseTab->title = array('BodaccCode' => 'Code Bodacc',
'BodaccNum' => 'Numéro Bodacc',
'NumAnnonce' => 'Numéro annonce',
'DateParution' => 'Date de parution',
'TribunalSiret' => 'Siret du tribunal',
'typeAnnonce' => 'Type annonce',
'texteRectificatif' => 'Texte rectificatif',
'texteAnnonce' => 'Texte annonce',
'dateEffet' => 'Date effet',
'dateJugement' => 'Date jugement',
'dateInsertionSD' => 'Date insertion',
'evenements' => 'Evenements');
$parseTab->type = array();
$tabForExport = $parseTab->convertTable();
$array2csv = new ExportCSV();
$array2csv->records = $tabForExport;
$array2csv->writeCSV($fileName);
$tabForExport = $annonces;
$array2xml = new ExportXML();
$array2xml->rootName = $page.'s';
$array2xml->defaultTagName = $page;
$array2xml->records = $tabForExport;
$array2xml->writeXML($fileName);
if (!$idan)
{
?>
<table>
<tr>
<td width="30">&nbsp;</td>
<td colspan="3" width="550" class="StyleInfoData">
<a class="dialogsurv" href=""></a>
<?php
require_once 'surveillance/surveillance.php';
echo getSurveillance('annonces', $siret);
?>
</td>
</tr>
</table>
<?php
}
?>
<p class="confidentiel blockh2">
<?php
require_once 'cgu/cgu.php';
echo afficheCgu();
?>
</p>
</div>