diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index c56d95c38ef..d1f4d8798a5 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -100,8 +100,6 @@ class CommandeStats extends Stats */ public function __construct($db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0) { - global $user, $conf; - $this->db = $db; $this->socid = ($socid > 0 ? $socid : 0); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 2a20981a423..6132be45b79 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -409,8 +409,6 @@ class Expedition extends CommonObject */ public function create($user, $notrigger = 0) { - global $conf, $hookmanager; - $now = dol_now(); require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; @@ -421,6 +419,9 @@ class Expedition extends CommonObject if (empty($this->fk_project)) { $this->fk_project = 0; } + if (empty($this->date_creation)) { + $this->date_creation = $now; + } if (empty($this->date_shipping) && !empty($this->date_expedition)) { $this->date_shipping = $this->date_expedition; } @@ -460,7 +461,7 @@ class Expedition extends CommonObject $sql .= ", ".((int) $this->entity); $sql .= ", ".($this->ref_customer ? "'".$this->db->escape($this->ref_customer)."'" : "null"); $sql .= ", ".($this->ref_ext ? "'".$this->db->escape($this->ref_ext)."'" : "null"); - $sql .= ", '".$this->db->idate($now)."'"; + $sql .= ", '".$this->db->idate($this->date_creation)."'"; $sql .= ", ".((int) $user->id); $sql .= ", ".($this->date_shipping > 0 ? "'".$this->db->idate($this->date_shipping)."'" : "null"); $sql .= ", ".($this->date_delivery > 0 ? "'".$this->db->idate($this->date_delivery)."'" : "null");