Skip to content

Commit

Permalink
FIX Avoid trouble when using a subtotal module adding line with type=9
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 17, 2024
1 parent 44b51b1 commit 444d23e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions htdocs/ecotaxdeee/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# ChangeLog MODULE EXOTAXDEEE FOR <a href="https://www.dolibarr.org">DOLIBARR ERP CRM</a>


## 4.2.1

- Fix compatibility when using other modules that create lines with type = 9 like subtotal


## 4.2

- Need Dolibarr v16+.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 444d23e

Please sign in to comment.