log($identifier, 'identifier');
$firephp->log($CompanyProductIdentifier, 'CompanyProductIdentifier');
$pays = $_SESSION['graydon']['pays'];
$mode = $_SESSION['graydon']['mode'];
require_once 'i18n/cleanchar.php';
require_once 'graydon/graydon.php';
require_once 'dbbootstrap.php';
function dVal($value){
if($value == '' || $value == NULL){
print 'NC';
}else{
print $value;
}
}
?>
info('Fomat HTML');
$path = PATH_DATA.'/graydon';
$fileName = strtolower(str_replace( array(':',' '), '-', $identifier).'.'.$format);
//Vérifier si le rapport n'est pas disponible en base depuis une autre commandes
setDbConn('graydon');
$q = Doctrine_Query::create()
->from('Report')
->where('identifier = ?', $_REQUEST['identifier'])
->andWhere('format = ?', $format);
$firephp->log($q->getSql(), 'Requete SQL');
$firephp->log($q->getParams(), 'Params SQL');
$report = new Report();
$report = $q->fetchOne();
if($format == 'html')
{
//@TODO : si le rapport existe déjà ou que la date n'est pas très éloigné
if($report==FALSE)
{
$firephp->info('Pas en cache');
//Vérifier si le rapport en ligne à déjà été demandé
/*
$q = Doctrine_Query::create()
->from('Commandes')
->where('companyproductidentifier = ?', $CompanyProductIdentifier);
$commandes = new Commandes();
$commandes = $q->fetchOne();
$report = new Report();
$report = $commandes->Report;
if($commandes == FALSE && !isset($report->id)){
$html = getIdentite($identifier, $CompanyProductIdentifier, $path.'/'.$fileName, $format);
//La commande à déjà été demandé
}else{
$html = $report->content;
}
*/
$html = getIdentite($identifier, $CompanyProductIdentifier, $path.'/'.$fileName, $format);
//Le rapport est disponible
}
else
{
$country = Doctrine_Query::create()
->from('Country')
->where('graydon_country = ?', $pays)
->fetchOne();
//Enregistrement d'une fausse commande dans la bdd
$commandes = new Commandes();
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
$commandes->prix = 0;
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
$commandes->companyproductidentifier = $CompanyProductIdentifier;
$commandes->sessionid = $sessionID;
$commandes->transactionidentifier = $transactionIdentifier;
$commandes->user = $tabInfo['login'];
$commandes->mode = $_SESSION['graydon']['mode'];
$commandes->Country = $country;
$commandes->save();
$firephp->log($commandes->toArray(),'dataCommandes');
$commandes_id = $commandes->id;
//Assignation du contenu
$html = $report->content;
}
if(isset($html) && $html!='' && $html!==FALSE)
{
$html = str_replace('
', '', $html);
$html = str_replace('', '', $html);
$html = str_replace('', '', $html);
$html = preg_replace('@@si', '', $html);
$html = preg_replace('@
]*?>Graydon .*?
@si', '', $html);
?>
|
Aucune information disponible. |
from('Report')
->where('identifier = ?', $_REQUEST['identifier'])
->andWhere('format = ?', $format);
$report = new Report();
$report = $q->fetchOne();
//@TODO : si le rapport existe déjà ou que la date n'est pas très éloigné
if($report==FALSE)
{
$firephp->info('Pas en cache');
//Vérifier si le rapport en ligne à déjà été demandé
$q = Doctrine_Query::create()
->from('Commandes')
->where('companyproductidentifier = ?', $CompanyProductIdentifier);
$commandes = new Commandes();
$commandes = $q->fetchOne();
$report = new Report();
$report = $commandes->Report;
if($commandes == FALSE && !isset($report->id)){
$xml = getIdentite($identifier, $CompanyProductIdentifier, $path.'/'.$fileName);
//La commande à déjà été demandé
}else{
$xml = $report->content;
}
//Le rapport est disponible
}
else
{
$country = Doctrine_Query::create()
->from('Country')
->where('graydon_country = ?', $pays)
->fetchOne();
//Enregistrement d'une fausse commande dans la bdd
$commandes = new Commandes();
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
$commandes->prix = 0;
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
$commandes->companyproductidentifier = $CompanyProductIdentifier;
$commandes->sessionid = $sessionID;
$commandes->transactionidentifier = $transactionIdentifier;
$commandes->user = $tabInfo['login'];
$commandes->mode = $_SESSION['graydon']['mode'];
$commandes->Country = $country;
$commandes->save();
$firephp->log($commandes->toArray(),'dataCommandes');
$commandes_id = $commandes->id;
//Assignation du contenu
$xml = $report->content;
}
//========= Affichage des informations =========
if(isset($xml) && $xml!='' && $xml!==FALSE)
{
$tabReport = array();
//Création du DOM
$doc = new DOMDocument;
$doc->preserveWhiteSpace = false;
$doc->loadxml($xml);
$xpath = new DOMXPath($doc);
$tabReport = parseReportXML($xml);
$firephp->log($tabReport, 'tabReport');
function utf8decode_deep($value)
{
$value = is_array($value) ?
array_map('utf8decode_deep', $value) :
cleanutf8($value);
return $value;
}
?>