From 21f7271e5177316d3ed7779dbafae20ae49d5a00 Mon Sep 17 00:00:00 2001
From: fmarcet <fmarcet@2byte.es>
Date: Thu, 17 Dec 2015 12:36:43 +0100
Subject: [PATCH] FIX: Not deleting contrats on element_element table

---
 htdocs/contrat/class/contrat.class.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 3e4605a8f2c..39acbe6a7df 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -7,6 +7,7 @@
  * Copyright (C) 2010-2013	Juanjo Menent			<jmenent@2byte.es>
  * Copyright (C) 2013		Christophe Battarel		<christophe.battarel@altairis.fr>
  * Copyright (C) 2013		Florian Henry			<florian.henry@open-concept.pro>
+ * Copyright (C) 2015		Ferran Marcet			<fmarcet@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
@@ -861,6 +862,13 @@ class Contrat extends CommonObject
 			}
 		}
 
+		if (! $error)
+		{
+			// Delete linked object
+			$res = $this->deleteObjectLinked();
+			if ($res < 0) $error++;
+		}
+
 		if (! $error)
 		{
 			// Delete contratdet_log
-- 
GitLab