diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index c3dbd4ddb7b..cdc75cac9e7 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; */ class FactureRec extends CommonInvoice { + const TRIGGER_PREFIX = 'BILLREC'; /** * @var string ID to identify managed object */ @@ -501,7 +502,7 @@ class FactureRec extends CommonInvoice if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('BILLREC_UPDATE', $user); + $result = $this->call_trigger('BILLREC_MODIFY', $user); if ($result < 0) { $this->db->rollback(); return -2; @@ -816,7 +817,14 @@ class FactureRec extends CommonInvoice $this->error = $this->db->lasterror(); $error = -2; } - + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('BILLREC_DELETE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } if (!$error) { $this->db->commit(); return 1; diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index d192d6b96c8..4a6d6e292ca 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; */ class FactureFournisseurRec extends CommonInvoice { + const TRIGGER_PREFIX = 'SUPPLIERBILLREC'; /** * @var string ID to identify managed object */ @@ -524,7 +525,7 @@ class FactureFournisseurRec extends CommonInvoice if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('BILLREC_UPDATE', $user); + $result = $this->call_trigger('SUPPLIERBILLREC_MODIFY', $user); if ($result < 0) { $this->db->rollback(); return -2; @@ -820,8 +821,15 @@ class FactureFournisseurRec extends CommonInvoice $this->error = $this->db->lasterror(); $error = -2; } - - if (!$error) { + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('SUPPLIERBILLREC_DELETE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + if (! $error) { $this->db->commit(); return 1; } else {