invoice: do not use activity name as fallback for description (#4884)

* added replacement field description_safe
This commit is contained in:
Kevin Papst
2024-06-03 19:01:40 +02:00
committed by GitHub
parent e29ef25581
commit 93ca983e0b
6 changed files with 29 additions and 19 deletions

View File

@@ -88,10 +88,6 @@ abstract class AbstractMergedCalculator extends AbstractCalculator
$invoiceItem->setProject($entry->getProject());
}
if (empty($invoiceItem->getDescription()) && null !== $entry->getActivity()) {
$invoiceItem->setDescription($entry->getActivity()->getName());
}
if ($entry instanceof Timesheet) {
foreach ($entry->getTagsAsArray() as $tag) {
$invoiceItem->addTag($tag);

View File

@@ -47,10 +47,6 @@ final class InvoiceItemDefaultHydrator implements InvoiceItemHydrator
$begin = $item->getBegin();
$end = $item->getEnd();
if (empty($description) && null !== $activity) {
$description = $activity->getName();
}
// this should never happen!
if (empty($appliedRate)) {
$appliedRate = 0;
@@ -59,6 +55,7 @@ final class InvoiceItemDefaultHydrator implements InvoiceItemHydrator
$values = [
'entry.row' => '',
'entry.description' => $description ?? '',
'entry.description_safe' => ($description === null || $description === '' ? ($activity?->getName() ?? $project?->getName() ?? '') : $description),
'entry.amount' => $amount,
'entry.type' => $item->getType(),
'entry.tags' => implode(', ', $item->getTags()),