Add a common function to delete the linked contact
This commit is contained in:
parent
ff0bbd1c43
commit
a9eb2a9da9
@ -354,8 +354,23 @@ class Project extends CommonObject
|
||||
function delete($user, $notrigger=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Delete linked contacts
|
||||
$res = $this->delete_linked_contact();
|
||||
if ($res < 0)
|
||||
{
|
||||
$this->error='ErrorFailToDeleteLinkedContact';
|
||||
//$error++;
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
@ -320,6 +320,19 @@ class Task extends CommonObject
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Delete linked contacts
|
||||
$res = $this->delete_linked_contact();
|
||||
if ($res < 0)
|
||||
{
|
||||
$this->error='ErrorFailToDeleteLinkedContact';
|
||||
//$error++;
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user