Hello,
Suite à mon message d'hier, je vous propose la modification suivante de
project.class.php :
function Project($DB)
{
$this->db = $DB;
$this->societe = new Societe($DB);
// definit module code projet
$varprojet = $conf->global->PROJET_CODEPROJET_ADDON;
require_once
DOL_DOCUMENT_ROOT.'/includes/modules/projet/'.$varprojet.'.php';
$this->mod_codeprojet = new $varprojet;
}
/*
* \brief Crée un projet en base
* \param user Id utilisateur qui crée
* \return int <0 si ko, id du projet crée si ok
*/
function create($user)
{
if (trim($this->ref))
{
if(($rescode =
$this->mod_codeprojet->verif($this->db, $this->ref, $this))
<> 0)
{
if ($rescode == -1)
{
$this->error .= "La syntaxe du code projet est
incorrecte.\n";
}
if ($rescode == -2)
{
$this->error .= "Vous devez saisir un code
projet.\n";
}
if ($rescode == -3)
{
$this->error .= "Ce code projet est déjà
utilisé.\n";
}
dolibarr_syslog("Project::Create : $this->error");
$result = -1;
}
else
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref,
title, fk_soc, fk_user_creat, dateo) ";
$sql .= " VALUES ('".addslashes($this->ref)."',
'".addslashes($this->title)."', $this->socid,
".$user->id.",now()) ;";
if ($this->db->query($sql) )
{
$this->id =
$this->db->last_insert_id(MAIN_DB_PREFIX."projet");
$result = $this->id;
}
else
{
dolibarr_syslog("Project::Create error -2");
$this->error=$this->db->error();
$result = -2;
}
}
}
else
{
dolibarr_syslog("Project::Create error -1 ref null");
$result = -1;
}
return $result;
}
Il faudrait effectuer la même modification au niveau de la classe
contrat.class.php.
Cordialement.
JR ATHANASE
|