Transfert des données terminée, vous pouvez à présent fermer l'onglet du navigateur.
Transferencia de datos finalizada, por favor cierre el navegador y regrese a ATELIO Gest. //

// // ============================================================================================= // FICHIER DE CONFIGURATION + FONCTIONS // ============================================================================================= //include ('configuration/configuration.php'); include ('configuration/fonction.php'); if (file_exists("config_test.inc.php")) { include ('config_test.inc.php'); } $log = 1; $heure = date('h'); $min = date('i'); $sec = date('s'); //$complete = $heure.'_'.$min.'_'.$sec; $complete = 'ok'; $ip = $_SERVER['REMOTE_ADDR']; $Fnm = "log/etaiV2_recuperation_".$complete.".xml"; $inF = fopen($Fnm,"w"); fwrite($inF,'POST :'.serialize($_POST)."\r\n"); fwrite($inF,'-------------'."\r\n"); fwrite($inF,'GET :'.serialize($_GET)."\r\n"); fwrite($inF,'IP :'.$ip."\r\n"); fclose($inF); $appel = date('Y_m_d'); $Fnm = 'trace/appel_'.$appel.'.txt'; $inF = fopen($Fnm,"w"); fwrite($inF,date('H:i:s').' >> IP : '.$_SERVER['REMOTE_ADDR']."\r\n"); fclose($inF); // ============================================================================================= // RECUPERATION DE L'USERSHAREID TRANSMIS PAR L' IO // ============================================================================================= if ($_GET['sessionid'] != '') { $id_session = $_GET['sessionid']; $depot = $_GET['depot']; $c_client = $_GET['client']; $loginInovaxo = $_GET['loginInovaxo']; $loginEtai = $_GET['loginEtai']; $proxy = $_GET['adresseProxy']; $cheminINI = str_replace("\\\\","\\",$_GET['cheminINI']); $cheminRetourPanier = str_replace("\\\\","\\",$_GET['cheminRetourPanier']); $urlCatalogue = $_GET['urlCatalogue']; } // ============================================================================================= // SHUTTLE DE RECUPERATION RECHERCHE ARTICLE EN COURS DANS L'IO // ============================================================================================= $xml = ' '.$id_session.' getData '; $heure = date('h'); $min = date('i'); $sec = date('s'); //$complete = $heure.'_'.$min.'_'.$sec; $complete = 'ok'; if ($log == 1) { $Fnm = "log/etaiV2_recuperation_1.0.0_".$complete.".xml"; $inF = fopen($Fnm,"w"); fwrite($inF,$xml."\r\n"); fclose($inF); } // Définition des headers $headers = http_build_headers ( array ( 'Content-Type' => 'application/xml', 'Content-Length' => strlen( $xml ) ) ); // Définition du contexte if ($proxy == '') { $options = array( 'http' => array( 'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) Gecko/20061010 Firefox/2.0', 'method' => 'POST', 'content' => $xml, 'header' => $headers) ); } else { $options = array( 'http' => array( 'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) Gecko/20061010 Firefox/2.0', 'method' => 'POST', 'content' => $xml, 'header' => $headers, 'proxy' => $proxy, 'request_fulluri' => true) ); } // Création du contexte $contexte = stream_context_create( $options ); // Envoi du formulaire POST $reponse = file_get_contents( $urlCatalogue, false, $contexte ); $heure = date('h'); $min = date('i'); $sec = date('s'); //$complete = $heure.'_'.$min.'_'.$sec; $complete = 'ok'; if ($log == 1) { $Fnm = "log/etaiV2_recuperation_1.0.1".$complete.".xml"; $inF = fopen($Fnm,"w"); fwrite($inF,$reponse."\r\n"); fclose($inF); } // ============================================================================================= // FIN - SHUTTLE DE RECUPERATION RECHERCHE ARTICLE EN COURS DANS L'IO // ============================================================================================= $dom = new DomDocument; $dom->preserveWhiteSpace=false; $dom->loadXML(utf8_encode($reponse)); $RedirectIo = $dom->getElementsByTagName('verb')->item(0)->nodeValue; // ============================================================================================= // ON TRAITE LES PRIX ET STOCKS DES ARTICLES RETOURNES // ============================================================================================= if ($RedirectIo == 'getPriceAndStock' ) { $TabXml = array(); $listeArticle = $dom->getElementsByTagName('part'); // ON BOUCLE SUR TOUS LES ARTICLES foreach($listeArticle as $article) { $libelle = $article->getElementsByTagName('label')->item(0)->nodeValue; $marqueAbbrevation = $article->getElementsByTagName('abbreviation')->item(0)->nodeValue; $marqueLong = $article->getElementsByTagName('long-label')->item(0)->nodeValue; foreach($article->getElementsByTagName('reference-list') as $reference) { //$refCatalog = $reference->childNodes->item(0)->getAttribute("ref"); //$refClean = $reference->childNodes->item(1)->getAttribute("ref"); $cpt=0; $refCatalog = ''; $refClean = ''; foreach($reference->getElementsByTagName('classification') as $ref) { if ($cpt==0) // item(0) { $refCatalog = $ref->getAttribute("ref"); $cpt++; } else if ($cpt==1) // item(1) { $refClean = $ref->getAttribute("ref"); $cpt++; } else { $cpt++; } } } foreach($article->getElementsByTagName('classification-list') as $marque) { if ($marque->childNodes->item(0)->getAttribute("source") == 'etai') { $marqueCode = $marque->childNodes->item(0)->getAttribute("ref"); } else { $marqueCode = $marque->childNodes->item(1)->getAttribute("ref"); } } $TabXml[majuscule($refClean)][$marqueCode][] = array('libelle'=>$libelle,'refCatalog'=>$refCatalog,'refClean'=>$refClean,'marqueAbbrevation'=>$marqueAbbrevation,'marqueLong'=>$marqueLong,'marqueCode'=>$marqueCode); } // ============================================================================================= // TRAITEMENT WEBSERVICE // ============================================================================================= $xmlLogiwin = ' '; foreach($TabXml as $key => $refClean) { foreach ($refClean as $key => $marque) { //for($cptElem=0;$cptElem $value) { $xmlLogiwin .= '
'.$value['refClean'].'
'.$value['refCatalog'].' '.$value['marqueAbbrevation'].'
'; } } } $xmlLogiwin .= '
'; $heure = date('h'); $min = date('i'); $sec = date('s'); //$complete = $heure.'_'.$min.'_'.$sec; $complete = 'ok'; if ($log == 1) { $Fnm = "log/etaiV2_recuperation_1.0.2_".$complete.".xml"; $inF = fopen($Fnm,"w"); fwrite($inF,$xmlLogiwin."\r\n"); fclose($inF); } require_once('configuration/nusoap.php'); $client = new soapclient2("http://127.0.0.1:8085/WS_INOTECH/WS_INOTECH.soap"); $param = array('p_Login_ETAI'=>''.$loginEtai.'','p_Login_INOVAXO'=>''.$loginInovaxo.'','p_XMLEntree'=>''.$xmlLogiwin.'','p_Depot'=>''.$depot.'','p_Client'=>''.$c_client.'','p_CheminINI'=>''.$cheminINI.''); $namespace = "urn:WS_INOTECH"; $result = $client->call('WS_recherche_catalogue',$param,$namespace); $heure = date('h'); $min = date('i'); $sec = date('s'); //$complete = $heure.'_'.$min.'_'.$sec; if ($client->fault) { $complete = 'erreur'; } else { $complete = 'ok'; } unset($client); // ON ENREGISTRE LE XML LOGIWIN DANS UN TABLEAU $ResXml = traitementXml($result); if ($log == 1) { $Fnm = "log/etaiV2_recuperation_1.0.3_".$complete.".xml"; $inF = fopen($Fnm,"w"); fwrite($inF,$result."\r\n"); fwrite($inF,$resXML."\r\n"); fclose($inF); } // ============================================================================================= // FIN - TRAITEMENT WEBSERVICE // ============================================================================================= // ============================================================================================= // VERIFICATION DU RESULTAT SUITE AU TRAITEMENT DU WEBSERVICE // ============================================================================================= if($ResXml["erreur"] != "Erreur") { // ============================================================================================= // RENVOI DE DMS VERS IO DES PRIX ET STOCKS DES ARTICLES RETOURNES // ============================================================================================= $xml = ' '.$id_session.' postPriceAndStock '; $texte = ""; foreach($TabXml as $key=>$refClean) { foreach ($refClean as $key => $marque) { foreach ($marque as $key => $value) { $c_art_fourn = strtoupper($value['refClean']); $c_fourn = strtoupper($value['marqueAbbrevation']); $px_vente = $ResXml[$c_fourn][$c_art_fourn]["Px_Vente"]; $px_achat = $ResXml[$c_fourn][$c_art_fourn]["Px_Achat"]; $qte_stock = $ResXml[$c_fourn][$c_art_fourn]["Stock"]; $statut = $ResXml[$c_fourn][$c_art_fourn]["Statut"]; $xml .= ' '.$value['marqueAbbrevation'].' '; if ( $statut == "known") { $xml .= ' '.$qte_stock.' '.$px_vente.' '.$px_achat.' '; } $xml .= ' '; } } } $xml .= ' '; $heure = date('h'); $min = date('i'); $sec = date('s'); //$complete = $heure.'_'.$min.'_'.$sec; $complete = 'ok'; if ($log == 1) { $Fnm = "log/etaiV2_recuperation_1.0.4_".$complete.".xml"; $inF = fopen($Fnm,"w"); fwrite($inF,$xml); fclose($inF); } // Définition des headers $headers = http_build_headers ( array ( 'Content-Type' => 'application/xml', 'Content-Length' => strlen( $xml ) ) ); // Définition du contexte if ($proxy == '') { $options = array( 'http' => array( 'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) Gecko/20061010 Firefox/2.0', 'method' => 'POST', 'content' => $xml, 'header' => $headers) ); } else { $options = array( 'http' => array( 'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) Gecko/20061010 Firefox/2.0', 'method' => 'POST', 'content' => $xml, 'header' => $headers, 'proxy' => $proxy, 'request_fulluri' => true) ); } // Création du contexte $contexte = stream_context_create( $options ); // Envoi du formulaire POST $UrlCatalogue = $_GET['urlCatalogue']; $reponse3 = file_get_contents( $UrlCatalogue, false, $contexte ); $heure = date('h'); $min = date('i'); $sec = date('s'); //$complete = $heure.'_'.$min.'_'.$sec; $complete = 'ok'; if ($log == 1) { $Fnm = "log/etaiV2_recuperation_1.0.5_".$complete.".xml"; $inF = fopen($Fnm,"w"); fwrite($inF,$reponse3."\r\n"); fclose($inF); } // ============================================================================================= // FIN - RENVOI DE DMS VERS IO DES PRIX ET STOCKS DES ARTICLES RETOURNES // ============================================================================================= } else { if ($log == 1) { $Fnm = "log/etaiV2_recuperation_1.0.4_erreur.xml"; $inF = fopen($Fnm,"w"); fwrite($inF,"Vérifier le contenu du log : 'etaiV2_recuperation_1.0.3_ok.xml'"."\r\n"); fwrite($inF,"Le résultat attendu n'est pas au format XML"); fclose($inF); } } // ============================================================================================= // FIN - VERIFICATION DU RESULTAT SUITE AU TRAITEMENT DU WEBSERVICE // ============================================================================================= } else { if ($log == 1) { $Fnm = "log/etaiV2_recuperation_1.1.2_ok.xml"; $inF = fopen($Fnm,"w"); fwrite($inF,$cheminRetourPanier."\r\n"); fwrite($inF,$id_session); fclose($inF); } // if (!is_dir($cheminRetourPanier)) // { // if(mkdir($cheminRetourPanier)) // { // if ($log == 1) // { // $Fnm = "log/etaiV2_dossier_creer_ok.xml"; // $inF = fopen($Fnm,"w"); // fwrite($inF,$cheminRetourPanier."\\".$id_session.".xml"."\r\n"); // fclose($inF); // } // } // } if ($CSTcheminRetourPanier) { //configuré dans config.inc.php $cheminRetourPanier=$CSTcheminRetourPanier; } $Fnm = $cheminRetourPanier."\\".$id_session.".xml"; $inF = fopen($Fnm,"w"); fwrite($inF,$reponse); fclose($inF); if ($log == 1) { $Fnm = "log/etaiV2_recuperation_1.1.3_ok.xml"; $inF = fopen($Fnm,"w"); fwrite($inF,$reponse); fclose($inF); } } // ============================================================================================= // FIN - ON TRAITE LES PRIX ET STOCKS DES ARTICLES RETOURNES // ============================================================================================= ?>