2
0
forked from Wavyzz/dolibarr

Use trigger prefix product also for supplier product. (#35566)

* Use trigger prefix product also for supplier product.

* Add explication TRIGGER_PREFIX for developers
This commit is contained in:
Francis Appels
2025-10-03 09:00:39 +02:00
committed by GitHub
parent ae11ad4e72
commit 9b071f22c2
2 changed files with 6 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ For users:
For developers:
---------------
* Introducing the TRIGGER_PREFIX property to force developers to use unique triggerkey per business object, limit also code to business CRUD events and identity when it is not.
@@ -28,6 +29,7 @@ The following changes may create regressions for some external modules, but were
same path than the core path without using a mymodule directory is now forbidden.
* The directory theme/common/octicons has been removed
* The library timepicker.js has been removed. Was not used by Dolibarr.
* Because of new TRIGGER_PREFIX property triggers SUPPLIER_PRODUCT_BUYPRICE_XXX are renamed to PRODUCT_BUYPRICE_XXX.
***** ChangeLog for 22.0.2 compared to 22.0.1 *****

View File

@@ -49,7 +49,7 @@ class ProductFournisseur extends Product
* @var string Prefix to check for any trigger code of any business class to prevent bad value for trigger code.
* @see CommonTrigger::call_trigger()
*/
public $TRIGGER_PREFIX = 'SUPPLIER_PRODUCT';
public $TRIGGER_PREFIX = 'PRODUCT'; // We use parent because parent method can still have the parent prefix
/**
* @var string Error code (or message)
@@ -337,7 +337,7 @@ class ProductFournisseur extends Product
$this->db->begin();
// Call trigger
$result = $this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_DELETE', $user);
$result = $this->call_trigger('PRODUCT_BUYPRICE_DELETE', $user);
if ($result < 0) {
$error++;
}
@@ -589,7 +589,7 @@ class ProductFournisseur extends Product
$resql = $this->db->query($sql);
if ($resql) {
// Call trigger
$result = $this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_MODIFY', $user);
$result = $this->call_trigger('PRODUCT_BUYPRICE_MODIFY', $user);
if ($result < 0) {
$error++;
}
@@ -698,7 +698,7 @@ class ProductFournisseur extends Product
if (!$error) {
// Call trigger
$result = $this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_CREATE', $user);
$result = $this->call_trigger('PRODUCT_BUYPRICE_CREATE', $user);
if ($result < 0) {
$error++;
}