from('CommandesDetail')
->where('commandes_id = ?', $commande_id)
->fetchOne()->eName.'.'.$action;
header('Content-Disposition: attachment; filename="'.$nom.'"');
$report = Doctrine_Query::create()
->from('Report')
->where('order_id = ? and format = ?', array($commande_id, $action))
->fetchOne();
print $report->content;
exit;
}
?>
Commandes Internationales
from('Report')
->where('order_id = ? and format = "html"', $commande_id)
->fetchOne();
$contenu = preg_replace('/background: #FFFFFF;/', '', $rapport->content);
$contenu = preg_replace('@@si', '', $contenu);
print $contenu;
print '';
exit;
}
// --------------------------------------------------------------------------- //
// Suppression
// --------------------------------------------------------------------------- //
if ($action == 'Supprimer') {
Doctrine_Query::create()
->update('Commandes')
->set('orderstate', '?', 'Unlinked')
->where('id = ?', $commande_id)
->execute();
}
$etatsEnq = array('Toutes' => 'Toutes',
'Initialised' => 'Initialisées',
'Assigned' => 'Assignées',
'Completed' => 'Completées',
'Delivered' => 'Délivrées',
'NonD' => 'Non délivrées');
// --------------------------------------------------------------------------- //
// Mise à jour
// --------------------------------------------------------------------------- //
if (isset($_GET['maj'])) {
require_once 'graydon/graydon.php';
$commande = Doctrine_Query::create()
->from('Commandes')
->where('id = ?', $_GET['maj'])
->fetchOne();
$requete = new StdClass();
$requete->Authentication_Parameters = $authentication;
$requete->OrderReference = $commande->reference;
try {
$checkOrderResult = $graydon->checkOrders($requete);
} catch (SoapFault $e) {
print 'erreur soap';
exit;
}
$orderstate =
$checkOrderResult->CheckOrders->OrderStatus[0]->OrderState;
if ($orderstate != $commande->orderstate) {
Doctrine_Query::create()
->update('Commandes')
->set('orderstate', '?', $orderstate)
->where('id = ?', $commande->id)
->execute();
}
if (isset($checkOrderResult->CheckOrders->OrderStatus[0]->DateDue)) {
$datedue =
$checkOrderResult->CheckOrders->OrderStatus[0]->DateDue;
if ($datedue != $commande->datedue) {
Doctrine_Query::create()
->update('Commandes')
->set('datedue', '?', $datedue)
->where('id = ?', $commande->id)
->execute();
}
}
}
// --------------------------------------------------------------------------- //
// Choix de l'etat des commandes a afficher
// --------------------------------------------------------------------------- //
if (isset($_GET['id']) == false) {
print '';
print '
';
}
// --------------------------------------------------------------------------- //
// tableDebut
// --------------------------------------------------------------------------- //
function tableDebut() {
print '';
}
// --------------------------------------------------------------------------- //
// tableLigne
// --------------------------------------------------------------------------- //
function tableLigne($c1, $c2) {
print ''.$c1.' | '.$c2.' |
';
}
// --------------------------------------------------------------------------- //
// tableFin
// --------------------------------------------------------------------------- //
function tableFin() {
print '
';
}
// --------------------------------------------------------------------------- //
// boutonPost
// --------------------------------------------------------------------------- //
function boutonPost($action, $nom, $valeur, $etat_enq) {
if ($action == 'xml' ||
$action == 'pdf' ||
$action == 'doc') {
$extra = 'action="pages/international_commandes.php" ';
} else {
$extra = '';
}
print
'';
}
// --------------------------------------------------------------------------- //
// Affichage des commandes
// --------------------------------------------------------------------------- //
if (isset($_GET['id']) == true) {
$tabCommandes = Doctrine_Query::create()
->from('Commandes')
->where('user = ?', $_SESSION['tabInfo']['login'])
->andWhere('id = ?', $_GET['id'])
->execute();
} else {
$tabCommandes = Doctrine_Query::create()
->from('Commandes')
->where('user = ?', $_SESSION['tabInfo']['login'])
->orderby('id')
->execute();
}
foreach ($tabCommandes as $commande) {
if (($etat_enq != 'Toutes' &&
$etat_enq != 'NonD' &&
$etat_enq != $commande->orderstate) ||
($etat_enq == 'NonD' &&
$commande->orderstate == 'Delivered') ||
$commande->orderstate == 'Unlinked') {
continue;
}
if ($commande->orderstate == 'Completed' ||
$commande->orderstate == 'CompletedwithUpdate' ||
$commande->orderstate == 'ReCompleted' ||
$commande->orderstate == 'Delivered') {
$delivree = true;
} else {
$delivree = false;
}
$detail = Doctrine_Query::create()
->from('CommandesDetail')
->where('commandes_id = ?', $commande->id)
->fetchOne();
print ''.
'';
if ($delivree == true) {
print '';
}
print $detail->eName;
if ($delivree == true) {
print '';
}
print ' Type d\'enquête: '.$commande->servicespeed.' '.
'État: ';
if ($delivree == true) {
print '';
}
print substr($etatsEnq[$commande->orderstate], 0, -1);
if ($delivree == true) {
print ' ';
$reports = Doctrine_Query::create()
->from('Report')
->where('order_id = ?', $commande->id)
->orderby('id')
->execute();
foreach ($reports as $report) {
boutonPost($report->format, 'commande_id', $commande->id, $etat_enq);
}
if (count($reports) > 0) {
boutonPost('Supprimer', 'commande_id', $commande->id, $etat_enq);
} else {
$delivree = false;
}
}
print ' | ';
tableDebut();
tableLigne('Date de commande:', $commande->dateordered);
if ($commande->datedue == '0000-00-00' &&
$commande->servicespeed != 'Immediate') {
$datedue = 'MàJ';
} else {
$datedue = $commande->datedue;
}
tableLigne('Date de réception prévue:', $datedue);
if ($delivree == true) {
tableLigne('Date de mise à jour:', $commande->datecompleted);
}
tableFin();
print ' |
';
}
?>