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/>
<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"/>

View File

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

View File

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