diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 93ef6997fd4..4f3b1395704 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -36,6 +36,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; @@ -563,8 +564,11 @@ if ($action == 'confirm_generateinvoice') { $idprodline = $fk_product; } - // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username) . ' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject); + // Add lines. Pass type=1 (service) explicitly so the invoice line is tagged + // as a service even when no product is bound to the time entry. Otherwise + // the default $type=0 leaks through and the PDF labels the operation as + // "Delivery of goods" instead of "Provision of services" (issue #34571). + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username) . ' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject, '', '', 0, 0, '', 'HT', 0, Product::TYPE_SERVICE); if ($lineid < 0) { $error++; setEventMessages(null, $tmpinvoice->errors, 'errors'); @@ -663,7 +667,11 @@ if ($action == 'confirm_generateinvoice') { } $idprodline = $value['fk_product']; } - $lineid = $tmpinvoice->addline($value['note'], $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject); + // Pass type=1 (service) explicitly so the invoice line is tagged as a service + // even when no product is bound to the time entry. Otherwise the default + // $type=0 leaks through and the PDF labels the operation as + // "Delivery of goods" instead of "Provision of services" (issue #34571). + $lineid = $tmpinvoice->addline($value['note'], $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject, '', '', 0, 0, '', 'HT', 0, Product::TYPE_SERVICE); if ($lineid < 0) { $error++; setEventMessages(null, $tmpinvoice->errors, 'errors');