extranet/www/pages/etablissements.php
Michael RICOIS 8847079109 Modification liens
Intégration include_path (prepend.php)
2009-02-20 13:04:46 +00:00

87 lines
3.5 KiB
PHP

<? if (!$_SESSION['connected']) die();
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
if (strlen($siret)<>0 && strlen($siret)<>9 && strlen($siret)<>14) die('Paramètres incorrects !');
$id=trim(preg_replace('/[^0-9]/', '', $_REQUEST['id']))*1; // Si id=0 alors non communiqué
if (($siret*1)==0 && $id==0) die('Paramètres incorrects !');
$siren=substr($siret,0,9);
$mil=false;
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');
/** Utilisation du WS **/
$client = new SoapClient(null, array( 'trace' => 1,
'soap_version' => SOAP_1_1,
'location' => WEBSERVICE_URL,
'uri' => WEBSERVICE_URI,
'login' => $_SESSION['tabInfo']['login'],
'password' => $_SESSION['tabInfo']['password']));
try {
$O = $client->getListeEtablissements($siren);
$etabs=$O['result'];
} catch (SoapFault $fault) {
echo '<pre>'.$client->__getLastResponse().'</pre>';
echo 'ERREUR SOAP :'.EOL;
print_r($fault);
die();
}
$raisonSociale=$tabInfo['entrep']['raisonSociale'];
?>
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
<tr>
<td colspan="3" align="center"><img src="./img/rub_etablissements.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>
<tr>
<td colspan="3"><img src="./img/srub_etablissements.png" width="576" height="27" /></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData"><table><?foreach ($etabs as $i=>$etab) {
if ($etab['Siege']==1) $type='siège ';
else $type='établissement ';
if ($etab['Actif']==1) $type.='actif';
else $type.='inactif';
$lien='<a title="Voir la fiche d\'identité" href="/?page=identite&siret='.$siren.$etab['Nic'].'">';
?><tr><td class="StyleInfoData" width="30"><b><?=$lien.$etab['Nic']?></a></b></td>
<td class="StyleInfoData" width="120"><?=$type?></td>
<td class="StyleInfoData" width="150"><?
if ($etab['Enseigne']<>'') echo '<b>'.$etab['Enseigne'].'</b><br/>';
echo $etab['Adresse'] .'<br/>';
if ($etab['Adresse2']<>'') echo $etab['Adresse2'].'<br/>';
echo '<b>'.$etab['CP'].' '.$etab['Ville'].'</b>';
if ($etab['Tel']<>'') echo '<br/><i>T&eacute;l : '.$etab['Tel'].'</i>&nbsp;&nbsp;&nbsp;';
if ($etab['Fax']<>'') echo '<br/><i>Fax : '.$etab['Fax'].'</i>';
?></td>
<td class="StyleInfoData" width="260"><?=$etab['NafEtab'].' : '.$etab['NafEtabLib']?></td>
</tr><?
}
if (count($etabs)==0)
echo '<tr><td class="StyleInfoData" width="580">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Aucun &eacute;tablissement n\'est pr&eacute;sente dans notre base</td></tr>';
elseif (preg_match('/CARTES/i', $_SESSION['tabInfo']['pref']))
echo '<tr><td colspan="4">&nbsp;</td></tr><tr><td class="StyleInfoData" colspan="4" width="580" align="center"><iframe src="/?page=carte&siret='.$siren.'" width=505 height=505 marginheight="1" marginwidth="1" scrolling="No" frameborder=1></iframe></td></tr>';
?></table></td>
</tr>
</td>
</tr>
<tr>
</table>