147 lines
4.8 KiB
PHP
147 lines
4.8 KiB
PHP
<?php
|
|
// --------------------------------------------------------------------------- //
|
|
// Recherche Giant
|
|
// --------------------------------------------------------------------------- //
|
|
$pays = $formR['pays'];
|
|
|
|
define('NUM_ROWS', 10);
|
|
define('MAX_ROWS', 200);
|
|
|
|
$gServiceHeader = new StdClass;
|
|
$gServiceHeader->ConsumerId = '006';
|
|
$gServiceHeader->Provider = new StdClass;
|
|
switch ($pays) {
|
|
case 1:
|
|
$gServiceHeader->Provider->ProviderId = '001';
|
|
$gServiceHeader->Provider->CountryCode = 'BE';
|
|
break;
|
|
case 2:
|
|
$gServiceHeader->Provider->ProviderId = '003';
|
|
$gServiceHeader->Provider->CountryCode = 'NL';
|
|
break;
|
|
default:
|
|
print 'Erreur sur le pays';
|
|
exit;
|
|
}
|
|
$gServiceHeader->TimeStamp = date('Y-m-d\TH:i:s');
|
|
$gServiceHeader->TestIndication = true;
|
|
|
|
$soap_header =
|
|
new SoapHeader('http://services.giant-net.com/'.
|
|
'schema/services/shared/1.0',
|
|
'ServiceHeader', $gServiceHeader);
|
|
$soap_client =
|
|
new SoapClient('https://giant-tst.graydon.nl/search/v1?wsdl',
|
|
array('soap_version' => SOAP_1_1,
|
|
'login' => '006',
|
|
'password' => 'ClaudeMonet',
|
|
'trace' => true));
|
|
$soap_client->__setSoapHeaders($soap_header);
|
|
|
|
$o = new StdClass;
|
|
$o->IncludePhoneticMatches = 'false';
|
|
if (empty($siret) == false) {
|
|
$o->Query = new StdClass;
|
|
$o->Query->CompanyId = $siret;
|
|
$o->IncludeSuggestions = 'false';
|
|
$fonction = 'AdvancedSearch';
|
|
} else {
|
|
$o->Query = "$raisonSociale $numVoie $libVoie $cp $ville";
|
|
$o->IncludeSuggestions = 'false';
|
|
if (isset($position) == true) {
|
|
$o->StartRow = $position;
|
|
} else {
|
|
$o->StartRow = 0;
|
|
}
|
|
$o->NumRows = NUM_ROWS;
|
|
$fonction = 'Search';
|
|
}
|
|
|
|
try {
|
|
$O = $soap_client->__call($fonction, array($o));
|
|
} catch (SoapFault $f) {
|
|
print_r($f);
|
|
print '<br/>';
|
|
print 'Requete: '.
|
|
htmlspecialchars($soap_client->__getLastRequest());
|
|
print '<br/>';
|
|
print 'Reponse: '.
|
|
htmlspecialchars($soap_client->__getLastResponse());
|
|
}
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
// afficheCompany
|
|
// --------------------------------------------------------------------------- //
|
|
function afficheCompany(&$c, $deb, $num)
|
|
{
|
|
print '<li class="StyleInfoData" type="1" value="'.($deb + $num + 1).'">';
|
|
print '<a href="?page=giant_identite&company='.
|
|
$c->CompanyId.'">'.$c->RegisteredName.'</a><br/>';
|
|
print '<b>Register number '.$c->CompanyRegisterNumber.'</b><br/>';
|
|
if (isset($c->VatNumber) == true) {
|
|
print '<b>VAT '.$c->VatNumber.'</b><br/>';
|
|
}
|
|
print
|
|
$c->Address->HouseNumber.' '.
|
|
$c->Address->AddressType.' ';
|
|
if (isset($c->Address->Street) == true) {
|
|
print $c->Address->Street;
|
|
}
|
|
print '<br/>';
|
|
print '<b>'.$c->Address->PostCode.' ';
|
|
if (isset($c->Address->City) == true) {
|
|
print $c->Address->City;
|
|
}
|
|
print '</b><br/>';
|
|
print '<i>Forme : '.$c->LegalForm.'</i><br/>';
|
|
print '<br/>';
|
|
}
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
// 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);
|
|
}
|
|
} else {
|
|
afficheCompany($O->Results->Company, 0, 0);
|
|
}
|
|
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 ($curPage != $totPage) {
|
|
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.';
|
|
}
|
|
?>
|