Fix: bug #28055 : Unable to modify the date of a cloned command

This commit is contained in:
Laurent Destailleur
2009-12-04 19:02:55 +00:00
parent 90e041f404
commit 2931ed08c8
3 changed files with 79 additions and 2 deletions

View File

@@ -1468,6 +1468,40 @@ class Commande extends CommonObject
}
/**
* \brief Set the order date
* \param user Objet utilisateur qui modifie
* \param date_livraison Date de livraison
* \return int <0 si ko, >0 si ok
*/
function set_date($user, $date)
{
if ($user->rights->commande->creer)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
$sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null');
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
dol_syslog("Commande::set_date sql=$sql",LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$this->date = $date;
return 1;
}
else
{
$this->error=$this->db->error();
dol_syslog("Commande::set_date ".$this->error,LOG_ERR);
return -1;
}
}
else
{
return -2;
}
}
/**
* \brief Definit une date de livraison
* \param user Objet utilisateur qui modifie