diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index dee3bb26f92..ba6ff6f32d4 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -419,6 +419,19 @@ class pdf_crabe extends ModelePDFFactures $this->atleastonediscount++; } + // determine category of operation + $is_deposit = false; + if (preg_match('/^\((.*)\)$/', $object->lines[$i]->desc, $reg)) { + if ($reg[1] == 'DEPOSIT') { + $is_deposit = true; + } + } + // If DEPOSIT, this line is completely ignored for calculations. + if ($is_deposit) { + continue; + } + + // determine category of operation if ($categoryOfOperation < 2) { $lineProductType = $object->lines[$i]->product_type; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 3db7d30cf29..27ddbe70834 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -446,6 +446,19 @@ class pdf_sponge extends ModelePDFFactures $this->atleastonediscount++; } + // Do not take into account lines of the type “deposit.” + $is_deposit = false; + if (preg_match('/^\((.*)\)$/', $object->lines[$i]->desc, $reg)) { + if ($reg[1] == 'DEPOSIT') { + $is_deposit = true; + } + } + // If DEPOSIT, this line is completely ignored for calculations. + if ($is_deposit) { + continue; + } + + // determine category of operation if ($categoryOfOperation < 2) { $lineProductType = $object->lines[$i]->product_type;