From b1cf164eb9fb7361f8973008fb5d4eb232131916 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 30 Apr 2010 05:44:19 +0000 Subject: [PATCH] Add a common function to delete the linked contact --- htdocs/fichinter/class/fichinter.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 65d4f271108..c33971c99a2 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -517,8 +517,23 @@ class Fichinter extends CommonObject function delete($user) { 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."fichinterdet"; $sql.= " WHERE fk_fichinter = ".$this->id;