suppr quelques notices

This commit is contained in:
Sebastien BEAUGRAND 2010-03-02 16:23:02 +00:00
parent f96e074bae
commit 57c11e4227
3 changed files with 57 additions and 35 deletions

View File

@ -1,3 +1,16 @@
<?php
foreach (array('dirNom',
'dirPrenom',
'dirDateNaissJJ',
'dirDateNaissMM',
'dirDateNaissAAAA',
'dirCpVille') as $label) {
if (isset($formR[$label]) == false) {
$formR[$label] = '';
}
}
?>
<br/><br/><br/><br/><br/> <br/><br/><br/><br/><br/>
<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"/>

View File

@ -14,13 +14,17 @@ $(document).ready(function(){
</script> </script>
<?php <?php
if (isset($formR['siret']) == false) { $formR['siret'] = ''; } foreach (array('siret',
if (isset($formR['raisonSociale']) == false) { $formR['raisonSociale'] = ''; } 'raisonSociale',
if (isset($formR['numVoie']) == false) { $formR['numVoie'] = ''; } 'numVoie',
if (isset($formR['voie']) == false) { $formR['voie'] = ''; } 'voie',
if (isset($formR['cpVille']) == false) { $formR['cpVille'] = ''; } 'cpVille',
if (isset($formR['telFax']) == false) { $formR['telFax'] = ''; } 'telFax',
if (isset($formR['naf']) == false) { $formR['naf'] = ''; } 'naf') as $label) {
if (isset($formR[$label]) == false) {
$formR[$label] = '';
}
}
?> ?>
<br/><br/><br/><br/><br/> <br/><br/><br/><br/><br/>

View File

@ -2,7 +2,10 @@
if ( !is_array($formR) || count($formR)==0 ) $formR=$_POST['formR']; if ( !is_array($formR) || count($formR)==0 ) $formR=$_POST['formR'];
if ( $formR['type']=='ent' || $formR['type']=='dir' ) if ( $formR['type']=='ent' || $formR['type']=='dir' )
$typeRech = $formR['type']; $typeRech = $formR['type'];
$siret = trim(strtr($formR['siret'],array(' '=>'', '.'=>'', '-'=>'', '/'=>''))); if (isset($formR['siret']) == true) {
$siret = trim(strtr($formR['siret'],
array(' ' => '', '.' => '', '-' => '', '/' => '')));
}
$pays = strtoupper(substr($siret,0,2)); $pays = strtoupper(substr($siret,0,2));
$typeId = ''; $typeId = '';
@ -68,34 +71,36 @@ if ($siret!='')
} }
} }
$telFax = trim(preg_replace('/[^0-9]/', '', $formR['telFax'])); if ($typeRech == 'ent') {
$naf = trim(preg_replace('/[^0-9A-Z]/i', '', $formR['naf'])); // Type de recherche = entreprises
//if ($telFax<>'') $typeId='T'; $telFax = trim(preg_replace('/[^0-9]/', '', $formR['telFax']));
$naf = trim(preg_replace('/[^0-9A-Z]/i', '', $formR['naf']));
//if ($telFax<>'') $typeId='T';
//Traitement des données formulaire // Traitement des données formulaire
$raisonSociale = preg_replace('/[^0-9A-Z]/', ' ', $raisonSociale =
strtoupper(cleanstring($formR['raisonSociale'])) preg_replace('/[^0-9A-Z]/', ' ',
); strtoupper(cleanstring($formR['raisonSociale'])));
$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) {
$libVoie = preg_replace('/[^0-9A-Z]/', ' ', die('Numéro de voie incorrecte !');
strtoupper(cleanstring($formR['voie'])) }
); $libVoie = preg_replace('/[^0-9A-Z]/', ' ',
$cpVille = preg_replace('/ +/',' ', preg_replace('/[^0-9A-Z]/', ' ', strtoupper(cleanstring($formR['voie'])));
strtoupper(cleanstring($formR['cpVille'])) $cpVille =
)); preg_replace('/ +/',' ',
preg_replace('/[^0-9A-Z]/', ' ',
strtoupper(cleanstring($formR['cpVille']))));
if (preg_match("/^([0-9]{2,5})([\D]*)/i", $cpVille, $matches)) { if (preg_match("/^([0-9]{2,5})([\D]*)/i", $cpVille, $matches)) {
$cp=trim($matches[1]); $cp = trim($matches[1]);
$ville=trim($matches[2]); $ville = trim($matches[2]);
} else { } else {
$cp = ''; $cp = '';
$ville = trim($cpVille); $ville = trim($cpVille);
} }
} else if ($typeRech == 'dir') {
//Type de recherche = dirigeants // Type de recherche = dirigeants
if ($typeRech=='dir')
{
$dirNom = preg_replace('/[^0-9A-Z]/', ' ', $dirNom = preg_replace('/[^0-9A-Z]/', ' ',
strtoupper(trimAccent($formR['dirNom'])) strtoupper(trimAccent($formR['dirNom']))
); );
@ -174,7 +179,7 @@ if ($typeRech=='ent' && $siret<>'') {
processSoapFault($client,$fault,$tabInfo); processSoapFault($client,$fault,$tabInfo);
} }
} elseif ($typeRech=='dir') { } elseif ($typeRech=='dir') {
echo "<!--_typeRech=dir, $nom, $prenom, -->\n"; echo "<!--_typeRech=dir, $dirNom, $dirPrenom, -->\n";
try { try {
$O = $client->searchDir($dirNom, $dirPrenom, $dirDateNaiss, $dirVille, $position, $tabInfo['nbReponses'], 200, false); $O = $client->searchDir($dirNom, $dirPrenom, $dirDateNaiss, $dirVille, $position, $tabInfo['nbReponses'], 200, false);
} catch (SoapFault $fault) { } catch (SoapFault $fault) {