diff --git a/htdocs/project.class.php b/htdocs/project.class.php index 3ffa6f365b2..3f5143792c9 100644 --- a/htdocs/project.class.php +++ b/htdocs/project.class.php @@ -71,7 +71,7 @@ class Project extends CommonObject $sql.= " ".$user->id.","; $sql.= " ".$this->user_resp_id.", ".$this->db->idate(mktime()).", 0)"; - dolibarr_syslog("Project::create sql=".$sql); + dolibarr_syslog("Project::create sql=".$sql,LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -96,9 +96,11 @@ class Project extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."projet"; $sql.= " SET ref='".$this->ref."'"; $sql.= ", title = '".$this->title."'"; + $sql.= ", fk_soc = ".($this->socid > 0?$this->socid:"null"); $sql.= ", fk_user_resp = ".$this->user_resp_id; $sql.= " WHERE rowid = ".$this->id; + dolibarr_syslog("Project::update sql=".$sql,LOG_DEBUG); if ($this->db->query($sql) ) { $result = 0; @@ -142,7 +144,8 @@ class Project extends CommonObject $this->title = $obj->title; $this->titre = $obj->title; $this->note = $obj->note; - $this->societe->id = $obj->fk_soc; + $this->socid = $obj->fk_soc; + $this->societe->id = $obj->fk_soc; // For backward compatibility $this->user_author_id = $obj->fk_user_creat; $this->user_resp_id = $obj->fk_user_resp; $this->statut = $obj->fk_statut; diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 6a1b4b888fd..c90e7c93dbc 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -19,12 +19,11 @@ */ /** - \file htdocs/projet/fiche.php - \ingroup projet - \brief Fiche projet - \version $Id$ -*/ - + * \file htdocs/projet/fiche.php + * \ingroup projet + * \brief Fiche projet + * \version $Id$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); @@ -49,16 +48,16 @@ $result = restrictedArea($user, 'projet', $projetid); /* -* Actions -*/ + * Actions + */ if ($_POST["action"] == 'add' && $user->rights->projet->creer) { //print $_POST["socid"]; $pro = new Project($db); - $pro->socid = $_POST["socid"]; $pro->ref = $_POST["ref"]; $pro->title = $_POST["title"]; + $pro->socid = $_POST["socid"]; $pro->user_resp_id = $_POST["officer_project"]; $result = $pro->create($user); if ($result > 0) @@ -78,21 +77,31 @@ if ($_POST["action"] == 'update' && $user->rights->projet->creer) { if (! $_POST["cancel"]) { - if (!(empty($_POST["id"]) || empty($_POST["ref"]) || empty($_POST["title"]))) + $error=0; + if (empty($_POST["ref"])) + { + $error++; + $_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet + $mesg='
| '.$langs->trans("Ref").' | '.$projet->ref.' |
| '.$langs->trans("Label").' | '.$projet->title.' |
| '.$langs->trans("Company").' | '; - if ($projet->societe->id) print $projet->societe->getNomUrl(1); + if ($projet->societe->id > 0) print $projet->societe->getNomUrl(1); else print' '; print ' |
| '.$langs->trans("OfficerProject").' | '.$projet->user->fullname.' |