Fix: Due date was wrong when cloning

This commit is contained in:
Laurent Destailleur 2011-03-05 00:37:46 +00:00
parent da785fad43
commit 12d7a9686e

View File

@ -118,8 +118,10 @@ class FactureFournisseur extends Facture
{ {
global $langs,$conf; global $langs,$conf;
$now=dol_now();
// Clear parameters // Clear parameters
if (empty($this->date)) $this->date=gmmktime(); if (empty($this->date)) $this->date=$now;
$socid = $this->socid; $socid = $this->socid;
$number = $this->ref_supplier?$this->ref_supplier:$this->ref; $number = $this->ref_supplier?$this->ref_supplier:$this->ref;
@ -148,7 +150,7 @@ class FactureFournisseur extends Facture
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->escape($this->libelle)."'"; $sql.= ", '".$this->db->escape($this->libelle)."'";
$sql.= ", ".$this->socid; $sql.= ", ".$this->socid;
$sql.= ", ".$this->db->idate(gmmktime()); $sql.= ", ".$this->db->idate($now);
$sql.= ", '".$this->db->idate($this->date)."'"; $sql.= ", '".$this->db->idate($this->date)."'";
$sql.= ", '".$this->db->escape($this->note)."'"; $sql.= ", '".$this->db->escape($this->note)."'";
$sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'";
@ -1332,10 +1334,10 @@ class FactureFournisseur extends Facture
} }
/** /**
* \brief Load an object from its id and create a new one in database * Load an object from its id and create a new one in database
* \param fromid Id of object to clone * @param fromid Id of object to clone
* \param invertdetail Reverse sign of amounts for lines * @param invertdetail Reverse sign of amounts for lines
* \return int New id of clone * @return int New id of clone
*/ */
function createFromClone($fromid,$invertdetail=0) function createFromClone($fromid,$invertdetail=0)
{ {
@ -1360,6 +1362,7 @@ class FactureFournisseur extends Facture
$object->date_creation = ''; $object->date_creation = '';
$object->date_validation = ''; $object->date_validation = '';
$object->date = ''; $object->date = '';
$object->date_echeance = '';
$object->ref_client = ''; $object->ref_client = '';
$object->close_code = ''; $object->close_code = '';
$object->close_note = ''; $object->close_note = '';