diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 09309c16e7d..f27a2a7673f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5869,7 +5869,11 @@ abstract class CommonObject $this->tpl['strike'] = 0; if ($restrictlist == 'services' && $line->product_type != Product::TYPE_SERVICE) { $this->tpl['strike'] = 1; - } elseif ($line->special_code == SUBTOTALS_SPECIAL_CODE) { + } elseif (defined('SUBTOTALS_SPECIAL_CODE') && $line->special_code == SUBTOTALS_SPECIAL_CODE) { + // SUBTOTALS_SPECIAL_CODE is only defined when the subtotals module + // is loaded (htdocs/subtotals/class/commonsubtotal.class.php:24). + // Without the guard, printing origin lines from a PO into a vendor + // invoice fatals (#37663). Other tpl files already follow this pattern. $this->tpl['strike'] = 1; }