Integration modification trunk

This commit is contained in:
Michael RICOIS 2009-08-18 06:52:32 +00:00
parent a8b92ae72c
commit 672d2e6645
3 changed files with 126 additions and 116 deletions

View File

@ -2,46 +2,51 @@
<form name="form_recherche" action="./?page=recherche&action=rechercher&vue=list" method="POST" enctype="multipart/form-data"> <form name="form_recherche" action="./?page=recherche&action=rechercher&vue=list" method="POST" enctype="multipart/form-data">
<input type="hidden" name="formR[type]" value="dir"/> <input type="hidden" name="formR[type]" value="dir"/>
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="580" height="200" align="center">
<table>
<tr> <tr>
<td valign="top" width="580" height="200" align="center"> <td align="center"><h2 align="center" class="StyleRechercheTitre">RECHERCHE PAR DIRIGEANT</h2></td>
<table>
<tr>
<td align="center"><h2 align="center" class="StyleRechercheTitre">RECHERCHE PAR DIRIGEANT</h2></td>
</tr>
</table>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>NOM</b></td>
<td width="300"><input type="text" name="formR[dirNom]" value="<?=$formR['dirNom']?>" size="25" maxlength="40" /></td>
<td width="72"><img onClick="return overlay(this, 'subcontent1')" src="./img/puce_plus_rond.gif" alt="Plus d'options de recherche..."></td>
</tr>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>PRENOM</b></td>
<td width="300"><input type="text" name="formR[dirPrenom]" value="<?=$formR['dirPrenom']?>" size="25" maxlength="40" /></td>
<td width="72">&nbsp;</td>
</tr>
</table>
<!--<div id="subcontent1" style="display:none">--><div id="subcontent1" style="display:block">
<br/>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>DATE NAISSANCE</b></td>
<td width="300" class="StyleRechercheLib"><input maxLength="2" size="3" name="formR[dirDateNaissJJ]" value="<?=$formR['dirDateNaissJJ']?>"/>&nbsp;/&nbsp;<input maxLength="2" size="3" name="formR[dirDateNaissMM]" value="<?=$formR['dirDateNaissMM']?>"/>&nbsp;/&nbsp;<input maxLength="4" size="5" name="formR[dirDateNaissAAAA]" value="<?=$formR['dirDateNaissAAAA']?>"/></td>
<td width="72">&nbsp;</td>
</tr>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>CP OU D&Eacute;P. / VILLE DE NAISSANCE</b></td>
<td width="300"><input type="text" name="formR[dirCpVille]" value="<?=$formR['dirCpVille']?>" size="25" maxlength="40"></td>
<td width="72">&nbsp;</td>
</tr>
</table>
</div>
</td>
</tr> </tr>
</table>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>NOM</b></td>
<td width="300"><input type="text" name="formR[dirNom]" value="<?=$formR['dirNom']?>" size="25" maxlength="40" /></td>
<td width="72"><img onClick="return overlay(this, 'subcontent1')" src="./img/puce_plus_rond.gif" alt="Plus d'options de recherche..."></td>
</tr>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>PRENOM</b></td>
<td width="300"><input type="text" name="formR[dirPrenom]" value="<?=$formR['dirPrenom']?>" size="25" maxlength="40" /></td>
<td width="72">&nbsp;</td>
</tr>
</table>
<!--<div id="subcontent1" style="display:none">--><div id="subcontent1" style="display:block">
<br/>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>DATE NAISSANCE</b></td>
<td width="300" class="StyleRechercheLib"><input maxLength="2" size="3" name="formR[dirDateNaissJJ]" value="<?=$formR['dirDateNaissJJ']?>"/>&nbsp;/&nbsp;<input maxLength="2" size="3" name="formR[dirDateNaissMM]" value="<?=$formR['dirDateNaissMM']?>"/>&nbsp;/&nbsp;<input maxLength="4" size="5" name="formR[dirDateNaissAAAA]" value="<?=$formR['dirDateNaissAAAA']?>"/></td>
<td width="72">&nbsp;</td>
</tr>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>CP OU D&Eacute;P. / VILLE DE NAISSANCE</b></td>
<td width="300"><input type="text" name="formR[dirCpVille]" value="<?=$formR['dirCpVille']?>" size="25" maxlength="40"></td>
<td width="72">&nbsp;</td>
</tr>
</table>
</div>
</td>
</tr>
</table> </table>
<table width="580"> <table width="580">
<tr> <tr>
<td align="center" valign="top"><input type="image" src="./img/boutton_valider_off.gif" name="submit" onmouseover="this.src='./img/boutton_valider_on.gif'" onmouseout="this.src='./img/boutton_valider_off.gif'" title="Lancer la recherche..."></td> <td align="center" valign="top"><input type="image" src="./img/boutton_valider_off.gif" name="submit" onmouseover="this.src='./img/boutton_valider_on.gif'" onmouseout="this.src='./img/boutton_valider_off.gif'" title="Lancer la recherche..."></td>
</tr> </tr>
</table> </table>
</form> </form>

View File

@ -15,66 +15,73 @@ $(document).ready(function(){
<form name="form_recherche" id="formR-id"action="./?page=recherche&action=rechercher&vue=list" method="POST" enctype="multipart/form-data"> <form name="form_recherche" id="formR-id"action="./?page=recherche&action=rechercher&vue=list" method="POST" enctype="multipart/form-data">
<input type="hidden" name="formR[type]" value="ent"/> <input type="hidden" name="formR[type]" value="ent"/>
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="580" height="200" align="center">
<table>
<tr> <tr>
<td valign="top" width="580" height="200" align="center"> <td align="center"><h2 align="center" class="StyleRechercheTitre">RECHERCHE ENTREPRISE</h2></td>
<table>
<tr>
<td align="center"><h2 align="center" class="StyleRechercheTitre">RECHERCHE ENTREPRISE</h2></td>
</tr>
</table>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>SIREN</b></td>
<td width="300"><input type="text" name="formR[siret]" value="<?=$formR['siret']?>" size="25" maxlength="20" />&nbsp;<img src="img/exclamation.png"/ title="Recherche par SIREN, SIRET, N° TVA intracommunautaire, N° RC, N° WALDEC, ISIN"></td>
<td width="72">&nbsp;</td>
</tr>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>RAISON SOCIALE<br/>ENSEIGNE / SIGLE</b></td>
<td width="300"><input type="text" name="formR[raisonSociale]" value="<?=$formR['raisonSociale']?>" size="25" maxlength="40" /></td>
<td width="72">&nbsp;</td>
</tr>
</table>
<!-- <div id="subcontent1" style="display:block"> -->
<br/>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>N&deg; &amp; VOIE</b></td>
<td width="300"><input type="text" name="formR[numVoie]" value="<?=$formR['numVoie']?>" size="4" maxlength="4" /><input type="text" name="formR[voie]" value="<?=$formR['voie']?>" size="17" maxlength="30" /></td>
<td width="72">&nbsp;</td>
</tr>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>CP OU D&Eacute;P. / VILLE</b></td>
<td width="300"><input type="text" name="formR[cpVille]" value="<?=$formR['cpVille']?>" size="25" maxlength="40" /></td>
<td width="72">&nbsp;</td>
</tr>
</table>
<br/>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>T&Eacute;L / FAX</b></td>
<td width="300"><input type="text" name="formR[telFax]" value="<?=$formR['telFax']?>" size="15" maxlength="15" /><!--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img onClick="return overlay(this, 'subcontent1')" src="./img/puce_plus_rond.gif" alt="Plus d'options de recherche..." />--></td>
<td width="72">&nbsp;</td>
</tr>
</table>
<div id="subcontent1" style="display:block">
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>NAF</b></td>
<td width="300">
<input type="text" title="Commencer à saisir le code ou le libellé du Naf, puis séléctionner l'une des propositions" size="15" name="formR[naf]" id="formR-naf" value="<?=$formR['naf']?>" />
</td>
<td width="72">&nbsp;</td>
</tr>
</table>
</div>
</td>
</tr> </tr>
</table>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>SIREN</b></td>
<td width="300"><input type="text" name="formR[siret]" value="<?=$formR['siret']?>" size="25" maxlength="20" />&nbsp;<img src="img/exclamation.png"/ title="Recherche par SIREN, SIRET, N° TVA intracommunautaire, N° RC, N° WALDEC, ISIN"></td>
<td width="72">&nbsp;</td>
</tr>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>RAISON SOCIALE<br/>ENSEIGNE / SIGLE</b></td>
<td width="300"><input type="text" name="formR[raisonSociale]" value="<?=$formR['raisonSociale']?>" size="25" maxlength="40" /></td>
<td width="72">&nbsp;</td>
</tr>
</table>
<!-- <div id="subcontent1" style="display:block"> -->
<br/>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>N&deg; &amp; VOIE</b></td>
<td width="300"><input type="text" name="formR[numVoie]" value="<?=$formR['numVoie']?>" size="4" maxlength="4" /><input type="text" name="formR[voie]" value="<?=$formR['voie']?>" size="17" maxlength="30" /></td>
<td width="72">&nbsp;</td>
</tr>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>CP OU D&Eacute;P. / VILLE</b></td>
<td width="300"><input type="text" name="formR[cpVille]" value="<?=$formR['cpVille']?>" size="25" maxlength="40" /></td>
<td width="72">&nbsp;</td>
</tr>
</table>
<br/>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>T&Eacute;L / FAX</b></td>
<td width="300"><input type="text" name="formR[telFax]" value="<?=$formR['telFax']?>" size="15" maxlength="15" /><!--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img onClick="return overlay(this, 'subcontent1')" src="./img/puce_plus_rond.gif" alt="Plus d'options de recherche..." />--></td>
<td width="72">&nbsp;</td>
</tr>
</table>
<div id="subcontent1" style="display:block">
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>NAF</b></td>
<td width="300">
<input type="text" title="Commencer à saisir le code ou le libellé du Naf, puis séléctionner l'une des propositions" size="15" name="formR[naf]" id="formR-naf" value="<?=$formR['naf']?>" />
</td>
<td width="72">&nbsp;</td>
</tr>
</table>
</div>
</td>
</tr>
</table> </table>
<table width="580"> <table width="580">
<tr> <tr>
<td align="center" valign="top"> <td align="center" valign="top">
<input type="image" src="./img/boutton_valider_off.gif" name="submit" id="formR-submit" onmouseover="this.src='./img/boutton_valider_on.gif'" onmouseout="this.src='./img/boutton_valider_off.gif'" title="Lancer la recherche..."> <input type="image" src="./img/boutton_valider_off.gif" name="submit" id="formR-submit" onmouseover="this.src='./img/boutton_valider_on.gif'" onmouseout="this.src='./img/boutton_valider_off.gif'" title="Lancer la recherche...">
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>

View File

@ -1,4 +1,10 @@
<?php <?php
if (!is_array($formR) || count($formR)==0) $formR=$_POST['formR'];
if ($formR['type']=='ent' || $formR['type']=='dir') $typeRech = $formR['type'];
$siret = trim(strtr($formR['siret'],array(' '=>'', '.'=>'', '-'=>'', '/'=>'')));
$pays = strtoupper(substr($siret,0,2));
$typeId = '';
function isUTF8($string) function isUTF8($string)
{ {
return (utf8_encode(utf8_decode($string)) == $string); return (utf8_encode(utf8_decode($string)) == $string);
@ -9,29 +15,21 @@ function isUTF8($string)
<td width="10">&nbsp;</td> <td width="10">&nbsp;</td>
<td valign="top" width="570"><br/> <td valign="top" width="570"><br/>
<?php <?php
/** On effectue la recherche **/ if ($siret<>'')
if (!is_array($formR) || count($formR)==0) $formR=$_POST['formR']; {
//Numéro WALDEC
if ($formR['type']=='ent' || $formR['type']=='dir') $typeRech=$formR['type'];
$siret=trim(strtr($formR['siret'],array(' '=>'', '.'=>'', '-'=>'', '/'=>'')));
$pays=strtoupper(substr($siret,0,2));
$typeId='';
if ($siret<>'') {
//Numéro WALDEC
if (strtoupper(substr($siret,0,1))=='W') { if (strtoupper(substr($siret,0,1))=='W') {
$typeId='W'; $typeId='W';
$autreId=$siret; $autreId=$siret;
$siret=''; $siret='';
} }
//TVA Intracommunautaire //TVA Intracommunautaire
elseif ($pays=='AT' || $pays=='BE' || $pays=='BG' || $pays=='CY' || $pays=='CZ' || $pays=='DE' || $pays=='DK' || elseif ($pays=='AT' || $pays=='BE' || $pays=='BG' || $pays=='CY' || $pays=='CZ' || $pays=='DE' || $pays=='DK' ||
$pays=='EE' || $pays=='EL' || $pays=='ES' || $pays=='FI' || $pays=='GB' || $pays=='HU' || $pays=='IE' || $pays=='EE' || $pays=='EL' || $pays=='ES' || $pays=='FI' || $pays=='GB' || $pays=='HU' || $pays=='IE' ||
$pays=='IT' || $pays=='LT' || $pays=='LU' || $pays=='LV' || $pays=='MT' || $pays=='NL' || $pays=='PL' || $pays=='IT' || $pays=='LT' || $pays=='LU' || $pays=='LV' || $pays=='MT' || $pays=='NL' || $pays=='PL' ||
$pays=='PT' || $pays=='RO' || $pays=='SE' || $pays=='SI' || $pays=='SK') $pays=='PT' || $pays=='RO' || $pays=='SE' || $pays=='SI' || $pays=='SK')
die("La recherche par numéro de TVA n'est pas encore possible sur ce pays !"); die("La recherche par numéro de TVA n'est pas encore possible sur ce pays !");
//Pour la france //Pour la france
elseif ($pays=='FR') { elseif ($pays=='FR') {
$len=strlen($siret); $len=strlen($siret);
if ($len==13) $siret=substr($siret,4,9); if ($len==13) $siret=substr($siret,4,9);
@ -44,28 +42,28 @@ if ($siret<>'') {
$firephp->info('Code ISIN'); $firephp->info('Code ISIN');
} }
} }
//Numéro RC //Numéro RC
elseif (preg_match('/A|B|C|D/i', $siret)) { elseif (preg_match('/A|B|C|D/i', $siret)) {
$typeId='R'; $typeId='R';
$autreId=$siret; $autreId=$siret;
$siret=''; $siret='';
} }
//Siren normal on enleve tout ce qui n'est pas un chiffre //Siren normal on enleve tout ce qui n'est pas un chiffre
else else
$siret=trim(preg_replace('/[^0-9]/', '', $siret)); $siret=trim(preg_replace('/[^0-9]/', '', $siret));
} }
$telFax=trim(preg_replace('/[^0-9]/', '', $formR['telFax'])); $telFax = trim(preg_replace('/[^0-9]/', '', $formR['telFax']));
$naf=trim(preg_replace('/[^0-9A-Z]/i', '', $formR['naf'])); $naf = trim(preg_replace('/[^0-9A-Z]/i', '', $formR['naf']));
//if ($telFax<>'') $typeId='T'; //if ($telFax<>'') $typeId='T';
//Traitement des données formulaire; //Traitement des données formulaire;
if (isUTF8($formR['raisonSociale'])) $formR['raisonSociale']=utf8_decode($formR['raisonSociale']); if (isUTF8($formR['raisonSociale'])) $formR['raisonSociale'] = utf8_decode($formR['raisonSociale']);
$raisonSociale = preg_replace('/[^0-9A-Z]/', ' ', strtoupper(strtr($formR['raisonSociale'], 'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝŸ', 'aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUYY'))); $raisonSociale = preg_replace('/[^0-9A-Z]/', ' ', strtoupper(strtr($formR['raisonSociale'], 'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝŸ', 'aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUYY')));
$numVoie = preg_replace('/[^0-9]/', '', $formR['numVoie']); $numVoie = preg_replace('/[^0-9]/', '', $formR['numVoie']);
if ($numVoie>9999) die('Numéro de voie incorrecte !'); if ($numVoie>9999) die('Numéro de voie incorrecte !');
$libVoie=preg_replace('/[^0-9A-Z]/', ' ', strtoupper(strtr(strtolower($formR['voie']), 'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝŸ', 'aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUYY'))); $libVoie = preg_replace('/[^0-9A-Z]/', ' ', strtoupper(strtr(strtolower($formR['voie']), 'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝŸ', 'aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUYY')));
$cpVille=preg_replace('/ +/',' ', preg_replace('/[^0-9A-Z]/', ' ', //strtoupper(trimAccent($formR['cpVille'])))); $cpVille = preg_replace('/ +/',' ', preg_replace('/[^0-9A-Z]/', ' ', //strtoupper(trimAccent($formR['cpVille']))));
strtoupper(strtr(strtolower($formR['cpVille']), 'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝŸ', 'aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUYY')))); strtoupper(strtr(strtolower($formR['cpVille']), 'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝŸ', 'aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUYY'))));
if (preg_match("/^([0-9]{2,5})([\D]*)/i", $cpVille, $matches)) { if (preg_match("/^([0-9]{2,5})([\D]*)/i", $cpVille, $matches)) {
@ -96,7 +94,7 @@ if ($typeRech=='dir')
else $dirVille=trim($dirCpVille); else $dirVille=trim($dirCpVille);
} }
$position=$formR['index']; $position = $formR['index'];
//Type de recherche = entreprise //Type de recherche = entreprise
if ($typeRech=='ent' && $siret<>'') { if ($typeRech=='ent' && $siret<>'') {