extranet/www/pages/annonces.php
2011-02-21 17:09:22 +00:00

341 lines
9.2 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';
require_once 'annonces/annonces.php';
if (isset($_REQUEST['idan'])) {
$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);
FB::log($annonces, 'annonces');
$objAnnonces = new Annonces($annonces);
?>
<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 && in_array($vue, array('bodacc', 'abod', 'balo', 'asso', 'bomp')))
{
//Présélection des annonces
foreach($annonces as $ann){
if($ann['id']==$idan)
break;
}
FB::log($ann, 'ann');
// 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') {
$logo = 'img/logo_jo.png';
if ($ann['BodaccNum']==0){
$libelle = 'Source BODACC '.substr($ann['BodaccCode'],-1).
' du '.WDate::dateT('Y-m-d','d/m/Y',$ann['DateParution']);
} else {
$libelle = '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'){
$logo = './img/logo_greffe.png';
$libelle = 'Source Greffe du Tribunal';
}elseif ($source[0] == 'P'){
$logo = './img/logo_inpi.png';
$libelle = 'Source Registre National du Commerce';
}else{
$logo = './img/logo_jal.png';
$libelle = '';
if( hasModeEdition() &&
(substr($source,0,2)=='JT' || $source=='ANTE') ){
$libelle = '<b>Source TESSI</b> - ';
}
$libelle.= 'Source Journal Annonces L&eacute;gales';
}
if ($ann['dateInsertionSD'] <> '') {
$libelle.= ' - Entr&eacute;e en base : ';
$date = new WDate;
$libelle.= $date->dateT('Y-m-d', 'd/m/Y', $ann['dateInsertionSD']);
}
$edition = '';
if ( hasModeEdition() ){
$edition.= ' <a class="annonceEdit" href="/?page=saisieajax&q=annonces/editDialog/'.
$idan.'/'.$siret.'" title="Edition annonce">'.
'<img src="./img/interface/editer.png"/></a>';
$edition.= ' <a class="annonceDelete" href="/?page=saisieajax&q=annonces/deleteDialog/'.
$idan.'/'.$siret.'"'.' title="Suppression annonce">'.
'<img src="./img/interface/supprimer.png"/></a>';
$edition.= ' <a class="annonceCopy" href="/?page=saisieajax&q=annonces/copyDialog/'.
$idan.'/'.$siret.'"'.' title="Dupliquer sur autre Siren ">'.
'<img src="./img/save_copy.png"/></a>';
$edition.= '<script type="text/javascript" src="js/jquery.form.js"></script>';
$edition.= '<script type="text/javascript" src="js/annonces.js"></script>';
}
?>
<?='<img src="'.$logo.'" />'?> <?=$libelle?> <?=$edition?>
</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
}
elseif ($vue=='bomp')
{
?>
<h2>Marchés publics</h2>
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="550" colspan="3" class="StyleInfoData">
<?php
$libelle = 'Annonce n&deg;'.$ann['NumAnnonce'] . '. ' .
'Source ' . $ann['BodaccCode'] . ' ' .
'n&deg;' . ($ann['BodaccNum']*1) . ' ' .
' du '.WDate::dateT('Y-m-d','d/m/Y',$ann['DateParution']).
'. D&eacute;partement n&deg;'.$ann['Departement'].'.';
echo $libelle;
?>
</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">
<?php
$source = $_SESSION['tabInfo']['entrep']['Source'];
$sourceId = $_SESSION['tabInfo']['entrep']['SourceId'];
?>
<a href="./?page=annonces&siret=<?=$siret?>
&idEntreprise=<?=$idEntreprise?>
&source=<?=$source?>
<?=($siret*1==0) ? '&idan='.$sourceId : '';?>
">
Revenir à la liste des annonces
</a>
</td>
</tr>
</table>
<?php
}
elseif (count($annonces) > 0)
{
$typeAnnonces = array(
'Bodacc' => 'EV&Eacute;NEMENTS L&Eacute;GAUX',
'Balo' => 'BALO',
'Bomp' => 'March&eacute;s publics',
'Asso' => 'Associations',
);
foreach ($typeAnnonces as $type => $titre)
{
$classType = 'annonces'.$type;
if (count($objAnnonces->$classType)>0)
{
?>
<h2><?=$titre?></h2>
<table>
<?php
foreach($objAnnonces->$classType as $i => $ann)
{
$resume = $objAnnonces->getAnnonceResume($ann);
?>
<tr>
<td width="30">&nbsp;</td>
<td width="140" class="StyleInfoLib">
<span id="annoncesDate">Le <?=$resume['date']?> </span>
<span id="annoncesImg"><?=$resume['logo']?></span>
</td>
<td width="450" colspan="2" class="StyleInfoData">
<a href="/?page=annonces&siret=<?=$siret?>&idEntreprise=<?=$idEntreprise?>&<?=$resume['href']?>">
<?=$resume['lib']?>
</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
}
require_once 'export/genexport.php';
// Surveillance
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>