diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 54e03b64127..80803d6d714 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -141,7 +141,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture-> { if ($user->rights->facture->supprimer) { - $result = $object->delete($id); + $result = $object->fetch($id); + $result = $object->delete(); if ($result > 0) { Header('Location: '.$_SERVER["PHP_SELF"]); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 506c60327e8..b60d0a095b6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1119,7 +1119,7 @@ class Facture extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function delete($rowid, $notrigger=0) + function delete($rowid=0, $notrigger=0) { global $user,$langs,$conf; @@ -1131,7 +1131,7 @@ class Facture extends CommonObject $error=0; $this->db->begin(); - + if (! $error && ! $notrigger) { // Appel des triggers @@ -1143,7 +1143,7 @@ class Facture extends CommonObject } // Fin appel triggers } - + if (! $error) { // Delete linked object