FIX alert for supplier order wasn't on delivery_date if exist

This commit is contained in:
Alexis Algoud 2014-05-15 11:43:55 +02:00
parent 45067c63d8
commit 2f78446433

View File

@ -1917,7 +1917,7 @@ class CommandeFournisseur extends CommonOrder
$this->nbtodo=$this->nbtodolate=0; $this->nbtodo=$this->nbtodolate=0;
$clause = " WHERE"; $clause = " WHERE";
$sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut"; $sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut,c.date_livraison as delivery_date";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
@ -1935,7 +1935,9 @@ class CommandeFournisseur extends CommonOrder
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $this->nbtodo++;
if ($obj->fk_statut != 3 && $this->db->jdate($obj->datec) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++;
$date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date;
if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++;
} }
return 1; return 1;
} }