diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 99b9bda840b..fb550f9842e 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015-2020 Charlene Benke * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * 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 @@ -635,10 +635,6 @@ class Fichinter extends CommonObject $this->statut = 1; $this->brouillon = 0; $this->date_validation = $now; - } - - if (!$error) - { $this->db->commit(); return 1; } else { @@ -970,14 +966,13 @@ class Fichinter extends CommonObject } } - if (!$error) - { - $main = MAIN_DB_PREFIX.'fichinterdet'; - $ef = $main."_extrafields"; - $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_fichinter = ".$this->id.")"; + if (!$error) { + $main = MAIN_DB_PREFIX.'fichinterdet'; + $ef = $main."_extrafields"; + $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_fichinter = ".$this->id.")"; - $resql = $this->db->query($sql); - if (!$resql) $error++; + $resql = $this->db->query($sql); + if (!$resql) $error++; } if (!$error)