<?php
// --------------------------------------------------------------------------- //
// giant.php
// --------------------------------------------------------------------------- //
require_once '../config/config.inc';
require_once '../includes/giant/config.php';
require_once '../includes/giant/client.php';
require_once '../includes/dbbootstrap.php';
setDbConn('giantclient');

$date = date('Y-m-d H:i:s');
$commandes = Doctrine_Query::create()
    ->from('Commandes')
    ->where('ServiceLevelName != ?', 'Immediate')
    ->andWhere('OrderStatus = ?', 'Pending')
    ->execute();
foreach ($commandes as $c) {
    if ($date < $c->DueDateTime) {
        continue;
    }

    $status = giantEtatDeCommande($c);
    if ($status == 'Pending') {
        print $c->OrderId." pas encore disponible\n";
        continue;
    } else if ($status == 'Undeliverable') {
        continue;
    }

    print $c->OrderId." complete\n";
}
?>