From a2fc8d986f4b1454219945349cde7b6ff64bd59e Mon Sep 17 00:00:00 2001 From: salam Date: Tue, 19 May 2026 15:25:08 +0200 Subject: [PATCH] =?UTF-8?q?LadeProjekt=20f=C3=BCr=20PDF=20fix=20methode=5F?= =?UTF-8?q?id=20stat=20raumart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Actions/Generate/Tabellen/LadeProjekt.php | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/app/Actions/Generate/Tabellen/LadeProjekt.php b/app/Actions/Generate/Tabellen/LadeProjekt.php index 06f243a..729c5ca 100644 --- a/app/Actions/Generate/Tabellen/LadeProjekt.php +++ b/app/Actions/Generate/Tabellen/LadeProjekt.php @@ -2,7 +2,6 @@ namespace App\Actions\Generate\Tabellen; -use App\Models\ProjektMethode; use App\Models\ProjektObjekte; use App\Models\ProjektObjekteImDetail; @@ -20,13 +19,14 @@ class LadeProjekt $tmp = []; foreach ($objekte as $objekt) { - $elemente = ProjektObjekteImDetail::where('projekt_objekte_id', $objekt->id)->get(); + $elemente = ProjektObjekteImDetail::with('methode')->where('projekt_objekte_id', $objekt->id)->get(); foreach ($elemente as $key => $element) { - $methode = self::laod_methode($projekte_id, $element['raumart']); - $methode_id = $methode['methode_id']; - $methode_faktor = $methode['faktor']; + $methode_id = $element->methode->methode_id; + $methode_name = $element->methode->raumart; + $methode_faktor = $element->methode->faktor; + $methode_aufstellung_id = $element->methode->aufstellung_id; $orientierung = $objekt['orientierung']['name'] ?? ''; if ($key > 0 && $methode_id == 1) { @@ -43,31 +43,17 @@ class LadeProjekt $t['type'] = ! $key ? $objekt->type : ''; $t['geschoss'] = $geschoss; $t['orientierung'] = $orientierung; - $t['raumart'] = $element['raumart']; + $t['raumart'] = $methode_name; $t['flaeche'] = $element['flaeche']; $t['nutzwert'] = $element['nutzwert']; $t['top_nummer'] = ! $key ? $objekt->top_nummer : ''; $t['objekt_nutzwert'] = $objekt->nutzwert; $t['faktor'] = $methode_faktor; - $t['aufstellung_id'] = $methode['aufstellung_id']; + $t['aufstellung_id'] = $methode_aufstellung_id; $tmp[$objekt->top_nummer][$methode_id][] = $t; } } return $tmp; } - - public static function laod_methode($projekte_id, $raumart) - { - if (! count(self::$methoden)) { - self::$methoden = ProjektMethode::where('projekte_id', $projekte_id)->get(); - } - - foreach (self::$methoden as $methode) { - if ($methode->raumart == $raumart) { - return $methode; - } - } - dd('Model ProjektMethode "raumart" '.$raumart.' missing'.__FILE__); - } }