[CORE] ajout d'une fonction pour mettre à jour l'id de projet lors de la création d'une commande depuis la demande de prix (#new_ask_price).

This commit is contained in:
phf 2015-02-03 15:22:03 +01:00
parent f15d18dbb1
commit 1e71b01016

View File

@ -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