garancia/L4/tibo.php

97 lines
2.6 KiB
PHP

<?php
require_once(dirname(dirname(__FILE__)).'/config/config.inc.php');
$document_xml = new DomDocument();
$resultat_html = '';
$document_xml->load('OUT/CRPCMD150107223317.xml');
$elements = $document_xml->getElementsByTagName('CRORDERS');
$element = $elements->item(0);
$enfants = $element->childNodes;
$conn = mysql_connect('localhost', 'garanciab_prod', 'yoeLB4Znn1E1');
mysql_select_db('garanciab_prod');
foreach($enfants as $enfant2)
{
if($enfant2->hasChildNodes() == true)
{
$enfant3 = $enfant2->childNodes;
foreach($enfant3 as $enfant){
$nom = $enfant->nodeName;
if ($nom == 'CODACTI')
$CODACTI= $enfant->nodeValue;
if ($nom == 'IDORDER')
{
$IDORDER= $enfant->nodeValue;
$id=explode(date('Y'),$IDORDER);
$IDORDER=$id[0];
}
if ($nom == 'DATETRT'){
$DATETRT= $enfant->nodeValue;
}
if($nom == 'ETAPREP'){
$ETAPREP = (int) $enfant->nodeValue;
}
if ($nom == 'COLIS'){
if($enfant->hasChildNodes() == true){
$enfant4=$enfant->childNodes;
foreach($enfant4 as $enfant0){
$nom = $enfant0->nodeName;
if ($nom == 'IDCOLIS')
{
// $IDCOLIS= $enfant0->nodeValue;
// $sql="update ps_orders set shipping_number='".$IDCOLIS."' where id_order=".(int)$IDORDER;
// if($result = mysql_query($sql, $conn))
// echo "<br/>Mise a jour effectuee pour la commande tracking #".$IDORDER." : ID COLIS = ".$IDCOLIS." ( ".$sql.")";
// $sql="update ps_order_carrier set tracking_number='".$IDCOLIS."' where id_order=".(int)$IDORDER;
// if($result = mysql_query($sql, $conn))
// echo "<br/>Mise a jour effectuee pour la commande livraison #".$IDORDER." : ID COLIS = ".$IDCOLIS." ( ".$sql.")<br/><br/>";
// $log.="CRPCMD traité pour la commande #".$IDORDER.", tracking_number = ".$IDCOLIS."\n";
}
}
}
}
// if($ETAPREP == 10)
// {
// include_once(dirname(__FILE__) .'/../config/config.inc.php');
// $history = new OrderHistory();
// $history->id_order = $IDORDER;
// $history->id_employee = 7;
// $use_existings_payment = false;
// $e_order = new Order($IDORDER);
// $e_current_order_state=$e_order->current_state;
// // commande envoyée
// if($e_current_order_state != 4
// && $e_current_order_state != 5
// && $e_current_order_state != 6
// && $e_current_order_state != 7
// && $e_current_order_state != 8)
// {
// $templateVars = array();
// $history->changeIdOrderState2(4, $IDORDER, $use_existings_payment);
// $history->addWithemail();
// }
// }
}
}
}
?>