From e3df73bcd6582da6ee3eaaab6c1a771744b2c696 Mon Sep 17 00:00:00 2001 From: thomasafink Date: Thu, 30 Nov 2023 09:33:25 +0100 Subject: [PATCH] Fix Dienstleistungsstatistik --- zmsentities/src/Zmsentities/Exchange.php | 15 ++++++++++----- .../src/Zmsstatistic/ReportRequestDepartment.php | 3 ++- .../Zmsstatistic/ReportRequestOrganisation.php | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/zmsentities/src/Zmsentities/Exchange.php b/zmsentities/src/Zmsentities/Exchange.php index 34e5fe874..6e29e5cf9 100644 --- a/zmsentities/src/Zmsentities/Exchange.php +++ b/zmsentities/src/Zmsentities/Exchange.php @@ -240,13 +240,18 @@ public function getGroupedHashSet(array $fields, array $hashfields) if (count($fields)) { $field = array_shift($fields); $fieldposition = $this->getPositionByName($field); + foreach ($this->data as $element) { - if (! isset($list[$element[$fieldposition]])) { - $list[$element[$fieldposition]] = clone $this; - $list[$element[$fieldposition]]->data = []; + // Check if $fieldposition exists in $element + if (isset($element[$fieldposition])) { + if (!isset($list[$element[$fieldposition]])) { + $list[$element[$fieldposition]] = clone $this; + $list[$element[$fieldposition]]->data = []; + } + $list[$element[$fieldposition]]->data[] = $element; } - $list[$element[$fieldposition]]->data[] = $element; } + foreach ($list as $key => $row) { if ($row instanceof Exchange) { $list[$key] = $row->getGroupedHashSet($fields, $hashfields); @@ -256,5 +261,5 @@ public function getGroupedHashSet(array $fields, array $hashfields) return $this->getHashData($hashfields, true); } return $list; - } + } } diff --git a/zmsstatistic/src/Zmsstatistic/ReportRequestDepartment.php b/zmsstatistic/src/Zmsstatistic/ReportRequestDepartment.php index e7f897447..6b13c3434 100644 --- a/zmsstatistic/src/Zmsstatistic/ReportRequestDepartment.php +++ b/zmsstatistic/src/Zmsstatistic/ReportRequestDepartment.php @@ -40,7 +40,8 @@ public function readResponse( ->readGetResult('/warehouse/requestdepartment/' . $this->department->id . '/'. $args['period']. '/') ->getEntity() ->toGrouped($this->groupfields, $this->hashset) - ->withRequestsSum(); + ->withRequestsSum() + ->withAverage('processingtime'); } $type = $validator->getParameter('type')->isString()->getValue(); diff --git a/zmsstatistic/src/Zmsstatistic/ReportRequestOrganisation.php b/zmsstatistic/src/Zmsstatistic/ReportRequestOrganisation.php index 883674991..ae23793a0 100644 --- a/zmsstatistic/src/Zmsstatistic/ReportRequestOrganisation.php +++ b/zmsstatistic/src/Zmsstatistic/ReportRequestOrganisation.php @@ -40,7 +40,8 @@ public function readResponse( ->readGetResult('/warehouse/requestorganisation/' . $this->organisation->id . '/'. $args['period']. '/') ->getEntity() ->toGrouped($this->groupfields, $this->hashset) - ->withRequestsSum(); + ->withRequestsSum() + ->withAverage('processingtime'); } $type = $validator->getParameter('type')->isString()->getValue();