From fbe01b90e25e840ffdeb38d0df45291ebcd0b29b Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Thu, 14 Apr 2011 10:32:56 +0000 Subject: [PATCH] missing function --- htdocs/commande/class/commande.class.php | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index bdf8184ecf9..1d008b9b1c0 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1760,6 +1760,34 @@ class Commande extends CommonObject } } } + +/** + * \brief Set delivery + * \param user Objet utilisateur qui modifie + * \param delivery delai de livraison + * \return int <0 si ko, >0 si ok + */ + function set_availability($user, $id) + { + if ($user->rights->commande->creer) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."commande "; + $sql.= " SET fk_availability = '".$id."'"; + $sql.= " WHERE rowid = ".$this->id; + + if ($this->db->query($sql)) + { + $this->fk_availability = $id; + return 1; + } + else + { + $this->error=$this->db->error(); + dol_syslog("Commande::set_availability Erreur SQL"); + return -1; + } + } + } /** * \brief Return list of orders (eventuelly filtered on a user) into an array