139 lines
4.3 KiB
PHP
139 lines
4.3 KiB
PHP
<?php
|
|
// --------------------------------------------------------------------------- //
|
|
// Recherche Giant
|
|
// --------------------------------------------------------------------------- //
|
|
$pays = $formR['pays'];
|
|
|
|
define('NUM_ROWS', 10);
|
|
define('MAX_ROWS', 200);
|
|
|
|
require_once 'giant/config.php';
|
|
require_once 'giant/Client.php';
|
|
|
|
$soap_client = getClient($pays, 'Search');
|
|
$o = new StdClass;
|
|
$o->IncludePhoneticMatches = 'false';
|
|
$o->IncludeSuggestions = 'false';
|
|
|
|
if (empty($siret) == false) {
|
|
$o->Query = new StdClass;
|
|
$o->Query->CompanyId = $siret;
|
|
$fonction = 'AdvancedSearch';
|
|
} else {
|
|
$o->Query = "$raisonSociale $numVoie $libVoie $cp $ville";
|
|
if (isset($position) == true) {
|
|
$o->StartRow = $position;
|
|
} else {
|
|
$o->StartRow = 0;
|
|
}
|
|
$o->NumRows = NUM_ROWS;
|
|
$fonction = 'Search';
|
|
}
|
|
|
|
try {
|
|
$O = $soap_client->AdvancedSearch($o);
|
|
} catch (SoapFault $f) {
|
|
getErreurSoap($soap_client, $f);
|
|
}
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
// afficheCompany
|
|
// --------------------------------------------------------------------------- //
|
|
function IssetObject($var)
|
|
{
|
|
if (isset($var))
|
|
return ($var);
|
|
}
|
|
|
|
function InformationChecked($information, $object)
|
|
{
|
|
switch($information)
|
|
{
|
|
case 'VatNumber':
|
|
IssetObject($object);
|
|
break;
|
|
case 'IssetStreet':
|
|
return IssetObject($object);
|
|
break;
|
|
case 'PostCode':
|
|
return(IssetObject($object));
|
|
break;
|
|
case 'City' :
|
|
return (IssetObject($object));
|
|
break;
|
|
default:
|
|
return(FALSE);
|
|
}
|
|
}
|
|
|
|
function afficheCompany(&$c, $deb, $num, $pays)
|
|
{
|
|
echo '
|
|
<li class="StyleInfoData" type="1" value="'.($deb + $num + 1).'">
|
|
<a href="?page=giant_identite&pays='.$pays.'&company='.$c->CompanyId.'">'.$c->RegisteredName.'</a><br/>
|
|
<b>Register number '.$c->CompanyRegisterNumber.'</b><br/>'.
|
|
'<b>'.InformationChecked('VatNumber', $c->VatNumber).'</b>
|
|
'.$c->Address->HouseNumber . ' '.$c->Address->AddressType.'
|
|
'.InformationChecked('IssetStreet', $c->Address->Street).'<br />
|
|
<b>'.InformationChecked('PostCode', $c->Address->PostCode).' '
|
|
.InformationChecked('City', $c->Address->City).'</b><br />
|
|
<i>Forme : '.$c->LegalForm.'</i>
|
|
</li>
|
|
<hr style="border:1px dashed silver" />
|
|
';
|
|
}
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
// affichage
|
|
// --------------------------------------------------------------------------- //
|
|
if (isset($O->Results->Company) == true) {
|
|
print '<ol>';
|
|
if (is_array($O->Results->Company) == true) {
|
|
foreach ($O->Results->Company as $i => $c) {
|
|
afficheCompany($c, $O->StartRow, $i, $pays);
|
|
}
|
|
} else {
|
|
afficheCompany($O->Results->Company, 0, 0, $pays);
|
|
}
|
|
print '</ol>';
|
|
print '<table><tr>';
|
|
print '<td width="40%" align="right">';
|
|
if ($O->StartRow >= NUM_ROWS) {
|
|
print '<a href="./?page=recherche&vue=list&p='.($O->StartRow - NUM_ROWS).
|
|
'" title="Page précédente...">';
|
|
print '<img src="./img/boutton_precedent_off.gif"'.
|
|
' onmouseover="this.src=\'./img/boutton_precedent_on.gif\'"'.
|
|
' onmouseout="this.src=\'./img/boutton_precedent_off.gif\'"/>';
|
|
print '</a>';
|
|
}
|
|
print '</td>';
|
|
$curPage = $O->StartRow / NUM_ROWS + 1;
|
|
$totPage = min(intval($O->NumberOfHits / NUM_ROWS), MAX_ROWS / NUM_ROWS);
|
|
print '<td width="20%" align="center">';
|
|
if ($totPage > 1) {
|
|
print 'Page '.$curPage.'/'.$totPage;
|
|
}
|
|
print '</td>';
|
|
print '<td width="40%">';
|
|
if ($O->NumberOfHits - $O->StartRow > NUM_ROWS &&
|
|
$O->StartRow + NUM_ROWS < MAX_ROWS) {
|
|
print '<a href="./?page=recherche&vue=list&p='.($O->StartRow + NUM_ROWS).
|
|
'" title="Page suivante...">';
|
|
print '<img src="./img/boutton_suivant_off.gif"'.
|
|
' onmouseover="this.src=\'./img/boutton_suivant_on.gif\'"'.
|
|
' onmouseout="this.src=\'./img/boutton_suivant_off.gif\'"/>';
|
|
print '</a>';
|
|
}
|
|
print '</td>';
|
|
print '</tr><table>';
|
|
} else {
|
|
print 'Aucun résultat.';
|
|
if (DEBUG_SOAP) {
|
|
print '<br/><br/>';
|
|
print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest());
|
|
print '<br/><br/>';
|
|
print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse());
|
|
}
|
|
}
|
|
?>
|