diff --git a/htdocs/ecotaxdeee/ChangeLog.md b/htdocs/ecotaxdeee/ChangeLog.md index dbcc6e647..1fd68c711 100644 --- a/htdocs/ecotaxdeee/ChangeLog.md +++ b/htdocs/ecotaxdeee/ChangeLog.md @@ -1,6 +1,11 @@ # ChangeLog MODULE EXOTAXDEEE FOR DOLIBARR ERP CRM +## 4.2.1 + +- Fix compatibility when using other modules that create lines with type = 9 like subtotal + + ## 4.2 - Need Dolibarr v16+. diff --git a/htdocs/ecotaxdeee/core/triggers/interface_50_modEcotaxdeee_Ecotaxdeee.class.php b/htdocs/ecotaxdeee/core/triggers/interface_50_modEcotaxdeee_Ecotaxdeee.class.php index e16db2674..310e03893 100644 --- a/htdocs/ecotaxdeee/core/triggers/interface_50_modEcotaxdeee_Ecotaxdeee.class.php +++ b/htdocs/ecotaxdeee/core/triggers/interface_50_modEcotaxdeee_Ecotaxdeee.class.php @@ -112,35 +112,62 @@ function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) if (getDolGlobalString('ECOTAXDEEE_USE_ON_CUSTOMER_ORDER')) { if ($action == 'LINEORDER_INSERT' || $action == 'LINEORDER_CREATE') { + if ($object->product_type == 9) { + return 0; + } return $this->_add_replace_ecotax($action, $object, $user, $langs, $conf); } if ($action == 'LINEORDER_UPDATE' || $action == 'LINEORDER_MODIFY') { - return $this->_add_replace_ecotax($action, $object, $user, $langs, $conf); + if ($object->product_type == 9) { + return 0; + } + return $this->_add_replace_ecotax($action, $object, $user, $langs, $conf); } if ($action == 'LINEORDER_DELETE') { + if ($object->product_type == 9) { + return 0; + } return $this->_add_replace_ecotax($action, $object, $user, $langs, $conf); } } if (getDolGlobalString('ECOTAXDEEE_USE_ON_PROPOSAL')) { if ($action == 'LINEPROPAL_INSERT' || $action == 'LINEPROPAL_CREATE') { //var_dump($object); + if ($object->product_type == 9) { + return 0; + } return $this->_add_replace_ecotax($action, $object, $user, $langs, $conf); } if ($action == 'LINEPROPAL_UPDATE' || $action == 'LINEPROPAL_MODIFY') { + if ($object->product_type == 9) { + return 0; + } return $this->_add_replace_ecotax($action, $object, $user, $langs, $conf); } if ($action == 'LINEPROPAL_DELETE') { + if ($object->product_type == 9) { + return 0; + } return $this->_add_replace_ecotax($action, $object, $user, $langs, $conf); } } if (getDolGlobalString('ECOTAXDEEE_USE_ON_CUSTOMER_INVOICE')) { if ($action == 'LINEBILL_INSERT' || $action == 'LINEBILL_CREATE') { + if ($object->product_type == 9) { + return 0; + } return $this->_add_replace_ecotax($action, $object, $user, $langs, $conf); } if ($action == 'LINEBILL_UPDATE' || $action == 'LINEBILL_MODIFY') { + if ($object->product_type == 9) { + return 0; + } return $this->_add_replace_ecotax($action, $object, $user, $langs, $conf); } if ($action == 'LINEBILL_DELETE') { + if ($object->product_type == 9) { + return 0; + } return $this->_add_replace_ecotax($action, $object, $user, $langs, $conf); } }