'Toutes', 'Pending' => 'En attente ', // Espace pour le pluriel 'Completed' => 'Completées', 'Delivered' => 'Délivrées', 'Undeliverable' => 'Non délivrables', 'NonD' => 'Non délivrées'); // --------------------------------------------------------------------------- // // afficheElem // --------------------------------------------------------------------------- // function afficheElem($obj, $retrait = '') { if (is_object($obj) == true) { $tab = get_object_vars($obj); } else if (is_array($obj) == true) { $tab = $obj; } else { $obj = str_replace('&', '&', $obj); print "$retrait$obj\n"; return; } foreach ($tab as $label => $valeur) { if (is_object($valeur) == true) { print "$retrait<$label>\n"; afficheElem($valeur, $retrait.' '); print "$retrait\n"; } else if (is_array($valeur) == true) { foreach ($valeur as $indice => $elem) { print "$retrait<$label>\n"; afficheElem($elem, $retrait.' '); print "$retrait\n"; } } else { $valeur = str_replace('&', '&', $valeur); print "$retrait<$label>$valeur\n"; } } } // --------------------------------------------------------------------------- // // Affichage du document // --------------------------------------------------------------------------- // if ($action == 'xml' || $action == 'txt') { $commande = Doctrine_Query::create() ->from('Commandes') ->where('OrderId = ?', $commande_id) ->andWhere('User = ?', $_SESSION['tabInfo']['login']) ->fetchOne(); $nom = $commande->CompanyName.'.'.$action; $rapport = Doctrine_Query::create() ->from('Rapports') ->where('OrderId = ?', $commande_id) ->andWhere('User = ?', $_SESSION['tabInfo']['login']) ->fetchOne(); $obj = unserialize($rapport->DataSet); if ($action == 'xml') { header('Content-type: text/xml'); header('Content-Disposition: attachment; filename="'.$nom.'"'); afficheElem($obj); } else { header('Content-type: text/plain'); header('Content-Disposition: attachment; filename="'.$nom.'"'); print_r($obj); } if ($commande->OrderStatus == 'Completed') { $commande->OrderStatus = 'Delivered'; $commande->save(); } exit; } // --------------------------------------------------------------------------- // // Affichage du document HTML // --------------------------------------------------------------------------- // if ($action == 'html') { $commande = Doctrine_Query::create() ->from('Commandes') ->where('OrderId = ?', $commande_id) ->andWhere('User = ?', $_SESSION['tabInfo']['login']) ->fetchOne(); if ($commande->OrderStatus == 'Completed') { $commande->OrderStatus = 'Delivered'; $commande->save(); } $r = Doctrine_Query::create() ->from('Rapports') ->where('OrderId = ?', $commande_id) ->andWhere('User = ?', $_SESSION['tabInfo']['login']) ->fetchOne(); header('Location: /?page=giant_rapport&OrderId='.$commande_id); print 'Veuillez suivre ce lien'; exit; } ?>

Commandes Internationales

update('Commandes') ->set('OrderStatus', '?', 'Unlinked') ->where('OrderId = ?', $commande_id) ->execute(); } // --------------------------------------------------------------------------- // // Choix de l'etat des commandes a afficher // --------------------------------------------------------------------------- // if (isset($_GET['OrderId']) == false) { print '
'; print ''; print ''; print '
'; print '
'; } // --------------------------------------------------------------------------- // // tableDebut // --------------------------------------------------------------------------- // function tableDebut() { print ''; } // --------------------------------------------------------------------------- // // tableLigne // --------------------------------------------------------------------------- // function tableLigne($c1, $c2) { print ''; } // --------------------------------------------------------------------------- // // tableFin // --------------------------------------------------------------------------- // function tableFin() { print '
'.$c1.''.$c2.'
'; } // --------------------------------------------------------------------------- // // boutonPost // --------------------------------------------------------------------------- // function boutonPost($action, $nom, $valeur, $etat_enq) { if ($action == 'xml' || $action == 'txt') { print '
'. ''. ''. ''. ''. '
'; } // --------------------------------------------------------------------------- // // datetime2date // --------------------------------------------------------------------------- // function datetime2date($datetime) { return preg_replace('/([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/', '$1', $datetime); } // --------------------------------------------------------------------------- // // Affichage des commandes // --------------------------------------------------------------------------- // if (isset($_GET['OrderId']) == true) { $tabCommandes = Doctrine_Query::create() ->from('Commandes') ->where('OrderId = ?', $_GET['OrderId']) ->andWhere('User = ?', $_SESSION['tabInfo']['login']) ->execute(); } else { $tabCommandes = Doctrine_Query::create() ->from('Commandes') ->where('User = ?', $_SESSION['tabInfo']['login']) ->orderby('OrderId') ->execute(); } foreach ($tabCommandes as $commande) { if (($etat_enq != 'Toutes' && $etat_enq != 'NonD' && $etat_enq != $commande->OrderStatus) || ($etat_enq == 'NonD' && $commande->OrderStatus == 'Delivered') || $commande->OrderStatus == 'Unlinked') { continue; } if ($commande->OrderStatus == 'Completed' || $commande->OrderStatus == 'Delivered') { $delivree = true; } else { $delivree = false; } print ''. '
'; if ($delivree == true) { print ''; } print $commande->CompanyName; if ($delivree == true) { print ''; } print '
'. 'Type d\'enquête: '. ''.$commande->ServiceLevelName.', '. ''.$commande->DataSetType.'. '. 'Langage: '. ''.$commande->LanguageCode.'
'. 'État: '; if ($delivree == true) { print ''; } print substr($etatsEnq[$commande->OrderStatus], 0, -1); if ($delivree == true) { print '
'; $reports = Doctrine_Query::create() ->from('Rapports') ->where('OrderId = ?', $commande->OrderId) ->andWhere('User = ?', $_SESSION['tabInfo']['login']) ->orderby('ReportId') ->execute(); foreach ($reports as $report) { boutonPost('html', 'commande_id', $commande->OrderId, $etat_enq); boutonPost('xml', 'commande_id', $commande->OrderId, $etat_enq); boutonPost('txt', 'commande_id', $commande->OrderId, $etat_enq); } if (count($reports) > 0) { boutonPost('Supprimer', 'commande_id', $commande->OrderId, $etat_enq); } else { $delivree = false; } } print '
'; tableDebut(); tableLigne('Date de commande:', datetime2date($commande->OrderDateTime)); if ($commande->DueDateTime == '0000-00-00 00:00:00' && $commande->ServiceLevelName != 'Immediate') { $datedue = 'MàJ'; } else { $datedue = datetime2date($commande->DueDateTime); } tableLigne('Date de réception prévue:', $datedue); if ($delivree == true) { tableLigne('Date de mise à jour:', datetime2date($commande->DateTimeCompleted)); } tableFin(); print '
'; } ?>