FIX: missing trigger DELETE for FactureRec, FactureFournisseurRec
+ trigger name consistency ('UPDATE' -> 'MODIFY')
+ preparing future consistency mechanism with class constant
This commit is contained in:
parent
ab4e89d678
commit
5a52650548
@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|||||||
*/
|
*/
|
||||||
class FactureRec extends CommonInvoice
|
class FactureRec extends CommonInvoice
|
||||||
{
|
{
|
||||||
|
const TRIGGER_PREFIX = 'BILLREC';
|
||||||
/**
|
/**
|
||||||
* @var string ID to identify managed object
|
* @var string ID to identify managed object
|
||||||
*/
|
*/
|
||||||
@ -501,7 +502,7 @@ class FactureRec extends CommonInvoice
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('BILLREC_UPDATE', $user);
|
$result = $this->call_trigger('BILLREC_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
@ -816,7 +817,14 @@ class FactureRec extends CommonInvoice
|
|||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$error = -2;
|
$error = -2;
|
||||||
}
|
}
|
||||||
|
if (!$error && !$notrigger) {
|
||||||
|
// Call trigger
|
||||||
|
$result = $this->call_trigger('BILLREC_DELETE', $user);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|||||||
*/
|
*/
|
||||||
class FactureFournisseurRec extends CommonInvoice
|
class FactureFournisseurRec extends CommonInvoice
|
||||||
{
|
{
|
||||||
|
const TRIGGER_PREFIX = 'SUPPLIERBILLREC';
|
||||||
/**
|
/**
|
||||||
* @var string ID to identify managed object
|
* @var string ID to identify managed object
|
||||||
*/
|
*/
|
||||||
@ -524,7 +525,7 @@ class FactureFournisseurRec extends CommonInvoice
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('BILLREC_UPDATE', $user);
|
$result = $this->call_trigger('SUPPLIERBILLREC_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
@ -820,8 +821,15 @@ class FactureFournisseurRec extends CommonInvoice
|
|||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$error = -2;
|
$error = -2;
|
||||||
}
|
}
|
||||||
|
if (!$error && !$notrigger) {
|
||||||
if (!$error) {
|
// Call trigger
|
||||||
|
$result = $this->call_trigger('SUPPLIERBILLREC_DELETE', $user);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
if (! $error) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user