fix report duplicate product fields

This commit is contained in:
wushumin
2026-05-22 16:08:31 +08:00
parent baef2fb64c
commit 7e86e2a5ec

View File

@@ -346,6 +346,9 @@ class ReportsController
if ($label === '') { if ($label === '') {
continue; continue;
} }
if ($this->displayItemIndex($items, $label) !== null) {
continue;
}
$this->appendDisplayItem( $this->appendDisplayItem(
$items, $items,
$label, $label,
@@ -379,6 +382,17 @@ class ReportsController
]; ];
} }
private function displayItemIndex(array $items, string $label): ?int
{
foreach ($items as $index => $item) {
if (($item['label'] ?? '') === $label) {
return $index;
}
}
return null;
}
private function appendDisplayItem(array &$items, string $label, mixed $value, mixed $remark = '', bool $keepEmpty = false): void private function appendDisplayItem(array &$items, string $label, mixed $value, mixed $remark = '', bool $keepEmpty = false): void
{ {
$valueText = $this->textValue($value); $valueText = $this->textValue($value);