Amélioration formulaire, issue #0000297

This commit is contained in:
Michael RICOIS 2011-04-07 14:10:16 +00:00
parent 8aa47c1e86
commit 5b43e914cf
2 changed files with 45 additions and 37 deletions

View File

@ -30,23 +30,23 @@ foreach (array('siret',
</div> </div>
<div class="fieldgrp"> <div class="fieldgrp">
<label>NOM</label> <label>RAISON SOCIALE / NOM</label>
<input type="text" name="formR[actNom]" value="<?=$formR['actNom']?>" size="25" maxlength="40" style="vertical-align:middle;" /> <input type="text" name="formR[actNom]" value="<?=$formR['actNom']?>" size="30" maxlength="40" style="vertical-align:middle;" />
</div> </div>
<div class="fieldgrp marge"> <div class="fieldgrp">
<label>PRENOM</label> <label>PRENOM</label>
<input type="text" name="formR[actPrenom]" value="<?=$formR['actPrenom']?>" size="25" maxlength="40" /> <input type="text" name="formR[actPrenom]" value="<?=$formR['actPrenom']?>" size="30" maxlength="40" />
</div> </div>
<div class="fieldgrp marge"> <div class="fieldgrp">
<label>DATE NAISSANCE</label> <label>DATE NAISSANCE</label>
<input type="text" name="formR[naissJJ]" value="<?=$formR['naisJJ']?>" size="2" maxlength="2" /> / <input type="text" name="formR[naissJJ]" value="<?=$formR['naisJJ']?>" size="2" maxlength="2" /> /
<input type="text" name="formR[naissMM]" value="<?=$formR['naisMM']?>" size="2" maxlength="2" /> / <input type="text" name="formR[naissMM]" value="<?=$formR['naisMM']?>" size="2" maxlength="2" /> /
<input type="text" name="formR[naissAAAA]" value="<?=$formR['naisMM']?>" size="4" maxlength="4" /> <input type="text" name="formR[naissAAAA]" value="<?=$formR['naisMM']?>" size="4" maxlength="4" />
</div> </div>
<div class="fieldgrp marge"> <div class="fieldgrp">
<label>CP OU D&Eacute;P. / VILLE DE NAISSANCE</label> <label>CP OU D&Eacute;P. / VILLE DE NAISSANCE</label>
<input type="text" name="formR[cpVille]" value="<?=$formR['cpVille']?>" size="30" maxlength="250" /> <input type="text" name="formR[cpVille]" value="<?=$formR['cpVille']?>" size="30" maxlength="250" />
</div> </div>
@ -57,9 +57,9 @@ foreach (array('siret',
</div> </div>
<div class="fieldgrp"> <div class="fieldgrp">
<label>DETENTION</label> <label>PAR ACTION, DE</label>
entre <input type="text" size="3" maxlength="3" name="formR[pctMin]" id="formR-naf" value="<?=$formR['pctMin']?>" /> et <input type="text" size="3" maxlength="3" name="formR[pctMin]" id="formR-naf" value="<?=$formR['pctMin']?>" /> &Agrave;
<input type="text" size="3" maxlength="3" name="formR[pctMax]" id="formR-naf" value="<?=$formR['pctMax']?>" /> <input type="text" size="3" maxlength="3" name="formR[pctMax]" id="formR-naf" value="<?=$formR['pctMax']?>" /> %
</div> </div>
<div class="submit"> <div class="submit">

View File

@ -154,17 +154,23 @@ if ($typeRech == 'ent') {
} }
} elseif ($typeRech == 'act') { } elseif ($typeRech == 'act') {
$actNom = $formR['actNom']; $actNom = trim($formR['actNom']);
$actPrenom = $formR['actPrenom']; $actPrenom = trim($formR['actPrenom']);
$dateNaiss = $formR['naissAAAA']; $d = array();
if (!empty($formR['naissMM'])) $d[] = preg_replace('/[^0-9]/', '', trim($formR['naissAAAA']));
$dateNaiss.= '-'.$formR['naissMM']; $d[] = preg_replace('/[^0-9]/', '', trim($formR['naissMM']));
if (!empty($formR['naissJJ'])) $d[] = preg_replace('/[^0-9]/', '', trim($formR['naissJJ']));
$dateNaiss.= '-'.$formR['naissJJ']; $dateNaiss = '';
$i = 0;
foreach ($d as $item) {
if (empty($item)) break;
if ($i>0 && $i<count($d)) $dateNaiss.= '-';
$dateNaiss.= $item;
$i++;
}
$pays = $formR['pays']; $pays = $formR['pays'];
$pctMin = $formR['pctMin']; $pctMin = preg_replace('/[^0-9]/', '', trim($formR['pctMin']));
$pctMax = $formR['pctMax']; $pctMax = preg_replace('/[^0-9]/', '', trim($formR['pctMax']));
$lieuNaiss = preg_replace('/ +/',' ', preg_replace('/[^0-9A-Z]/', ' ', $lieuNaiss = preg_replace('/ +/',' ', preg_replace('/[^0-9A-Z]/', ' ',
strtoupper(cleanstring($formR['cpVille'])))); strtoupper(cleanstring($formR['cpVille']))));
@ -215,10 +221,11 @@ if ($typeRech=='ent' && $siret<>'') {
echo "<!--_typeRech=ent, $raisonSociale, ". echo "<!--_typeRech=ent, $raisonSociale, ".
"$numVoie $libVoie, $cp, $ville-->\n"; "$numVoie $libVoie, $cp, $ville-->\n";
try { try {
$O = $client->searchNomAdr($raisonSociale, $numVoie.' '.$libVoie, $O = $client->searchNomAdr(
$cp, $ville, false, false, $position, $raisonSociale, $numVoie.' '.$libVoie, $cp, $ville, false, false,
$tabInfo['nbReponses'], 200, false, false, $position, $tabInfo['nbReponses'], 200, false, false,
$naf); $naf
);
} catch (SoapFault $fault) { } catch (SoapFault $fault) {
require_once 'soaperror.php'; require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo); processSoapFault($client,$fault,$tabInfo);
@ -226,7 +233,10 @@ if ($typeRech=='ent' && $siret<>'') {
} elseif ($typeRech=='dir') { } elseif ($typeRech=='dir') {
echo "<!--_typeRech=dir, $dirNom, $dirPrenom, -->\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) {
require_once 'soaperror.php'; require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo); processSoapFault($client,$fault,$tabInfo);
@ -234,17 +244,9 @@ if ($typeRech=='ent' && $siret<>'') {
} elseif ($typeRech=='act') { } elseif ($typeRech=='act') {
try { try {
$O = $client->searchAct( $O = $client->searchAct(
$actNom, $actNom, $actPrenom, $dateNaiss, $lieuNaiss, $siret, $pays, $pctMin, $pctMax,
$actPrenom, $tabInfo['nbReponses'], 200, false
$dateNaiss, );
$lieuNaiss,
$siret,
$pays,
$pctMin,
$pctMax,
$tabInfo['nbReponses'],
200,
false);
echo '<!-- '.print_r($formR,1).' -->'; echo '<!-- '.print_r($formR,1).' -->';
echo '<!-- '.print_r($O,1).' -->'; echo '<!-- '.print_r($O,1).' -->';
@ -262,6 +264,8 @@ if($typeRech == 'ent'){
$strCriteres = '<a href="./?page=recherche&vue=ent'.$params.'">'.trim(@implode(' ', $O['results']['criteres'])).'</a>'; $strCriteres = '<a href="./?page=recherche&vue=ent'.$params.'">'.trim(@implode(' ', $O['results']['criteres'])).'</a>';
} elseif($typeRech == 'dir') { } elseif($typeRech == 'dir') {
$strCriteres = '<a href="./?page=recherche&vue=dir'.$params.'">'.trim(@implode(' ', $O['results']['criteres'])).'</a>'; $strCriteres = '<a href="./?page=recherche&vue=dir'.$params.'">'.trim(@implode(' ', $O['results']['criteres'])).'</a>';
} elseif($typeRech == 'act') {
$strCriteres = '<a href="./?page=recherche&vue=act'.$params.'">'.trim(@implode(' ', $O['results']['criteres'])).'</a>';
} }
if ( $O['results']['nbReponses']==0) if ( $O['results']['nbReponses']==0)
@ -272,7 +276,6 @@ if ( $O['results']['nbReponses']==0)
else else
{ {
$etabs = $O['results']['reponses']; $etabs = $O['results']['reponses'];
FB::log($O, 'reponses');
//Enregistrement de la première raison sociale trouvé si la recherche n'a été faite que sur un siren //Enregistrement de la première raison sociale trouvé si la recherche n'a été faite que sur un siren
if ($typeRech=='ent' && $siret!='' && $raisonSociale==''){ if ($typeRech=='ent' && $siret!='' && $raisonSociale==''){
recherche_saveinfo( array('raisonSociale' => $etabs[0]['Nom']) ); recherche_saveinfo( array('raisonSociale' => $etabs[0]['Nom']) );
@ -374,8 +377,13 @@ if ( isset($O['results']['info']) &&
echo ' ('. strWsToHtml($etab['DirNomUsage']) . ')'; echo ' ('. strWsToHtml($etab['DirNomUsage']) . ')';
echo '<i>, '.strWsToHtml($etab['DirFonction']).'</i><br/>'; echo '<i>, '.strWsToHtml($etab['DirFonction']).'</i><br/>';
} }
//Affichage spécial
if ($typeRech == 'act'){
}
//Affichage spécial
if( $_SESSION['tabInfo']['idClient']==34 ) if( $_SESSION['tabInfo']['idClient']==34 )
{ {
?> ?>