From 1e71b0101663be8f5179fe1d9e1db0575a42ae84 Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 3 Feb 2015 15:22:03 +0100 Subject: [PATCH] =?UTF-8?q?[CORE]=20ajout=20d'une=20fonction=20pour=20mett?= =?UTF-8?q?re=20=C3=A0=20jour=20l'id=20de=20projet=20lors=20de=20la=20cr?= =?UTF-8?q?=C3=A9ation=20d'une=20commande=20depuis=20la=20demande=20de=20p?= =?UTF-8?q?rix=20(#new=5Fask=5Fprice).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../class/fournisseur.commande.class.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f07e9be9bba..3c8e77051b1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1641,6 +1641,40 @@ class CommandeFournisseur extends CommonOrder return -2; } } + + /** + * Set the id projet + * + * @param User $user Objet utilisateur qui modifie + * @param int $id_projet Date de livraison + * @return int <0 si ko, >0 si ok + */ + function set_id_projet($user, $id_projet) + { + if ($user->rights->fournisseur->commande->creer) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; + $sql.= " SET fk_projet = ".($id_projet > 0 ? (int)$id_projet : 'null'); + $sql.= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::set_id_projet", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $this->fk_projet = $id_projet; + return 1; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } + else + { + return -2; + } + } /** * Update a supplier order from a customer order