This commit is contained in:
Juanjo Menent 2019-06-14 18:56:30 +02:00
parent 8afffc8762
commit a73ae49c4d

View File

@ -5,6 +5,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2017 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -695,6 +696,27 @@ class Project extends CommonObject
$ret = $this->deleteTasks($user);
if ($ret < 0) $error++;
// Delete all child tables
if (! $error) {
$elements = array('categorie_project'); // elements to delete. TODO Make goodway to delete
foreach($elements as $table)
{
if (! $error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE fk_project = ".$this->id;
$result = $this->db->query($sql);
if (! $result) {
$error++;
$this->errors[] = $this->db->lasterror();
}
}
}
}
// Delete project
if (! $error)
{