Modification pour intégration nouvelle méthode graydon

This commit is contained in:
Michael RICOIS 2009-10-27 11:19:10 +00:00
parent cfb39f2303
commit 5797885404

View File

@ -1,12 +1,15 @@
#!/usr/bin/php -q #!/usr/bin/php -q
<?php <?php
$version = '0.2'; $version = '0.3';
$argc = $_SERVER['argc']; $argc = $_SERVER['argc'];
$argv = $_SERVER['argv']; $argv = $_SERVER['argv'];
if($argc > 1){ if($argc > 1)
foreach($argv as $value){ {
switch($value){ foreach($argv as $value)
{
switch($value)
{
case 'availability': case 'availability':
$availability = FALSE; $availability = FALSE;
break; break;
@ -44,7 +47,7 @@ require_once '../config/prepend.php';
//Inclure la base de données //Inclure la base de données
require_once 'dbbootstrap.php'; require_once 'dbbootstrap.php';
//Inclure la config graydon //Inclure la config graydon
require_once 'graydon/graydonws.php'; require_once 'graydon/graydon.php';
setDbConn('graydon'); setDbConn('graydon');
@ -59,20 +62,15 @@ if($availability == TRUE)
//Enregistrement de l'action dans les logs //Enregistrement de l'action dans les logs
$transactionIdentifier = $result->Service_Log->TransactionIdentifier; $transactionIdentifier = $result->Service_Log->TransactionIdentifier;
$sessionID = $result->Service_Log->SessionID; $sessionID = $result->Service_Log->SessionID;
foreach($result->CountryAvailablity->CountryAndProduct as $item){ foreach($result->CountryAvailablity->CountryAndProduct as $item)
{
$availability = array(); $availability = array();
$count = count($item->Products->Product); $availability = $item->Products->Product;
if ($count>1){
$availability = $item->Products->Product;
}elseif($count==1){
$availability[] = $item->Products->Product;
}
//Enregistrement pour chaque pays de la disponibilité des services //Enregistrement pour chaque pays de la disponibilité des services
$countryavailability = new Countryavailability(); $countryavailability = new Countryavailability();
$countryavailability->country = $item->Country; $countryavailability->country = $item->Country;
$countryavailability->availability = serialize($availability); $countryavailability->availability = serialize($availability);
$countryavailability->replace(); $countryavailability->replace();
} }
}catch( SoapFault $fault ){} }catch( SoapFault $fault ){}
} }