Skip to content
Snippets Groups Projects
Commit af0a8fcc authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Can remove a project if project has task.

parent 62e680cb
No related branches found
No related tags found
No related merge requests found
......@@ -376,7 +376,7 @@ class Project extends CommonObject
* Delete a project from database
* @param user User
* @param notrigger Disable triggers
* @return int <0 if KO, 0 if not possible, >0 if OK
* @return int <0 if KO, 0 if not possible, >0 if OK
*/
function delete($user, $notrigger=0)
{
......@@ -400,9 +400,16 @@ class Project extends CommonObject
}
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task";
$sql.= " WHERE fk_projet=".$this->id;
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet";
$sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
......
......@@ -239,6 +239,7 @@ if (GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == "yes" && $use
}
else
{
dol_syslog($project->error,LOG_DEBUG);
$mesg='<div class="error">'.$langs->trans("CantRemoveProject").'</div>';
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment