From c7650d8cbbff19bf6877b897153a47b775158850 Mon Sep 17 00:00:00 2001 From: Roberto Guido Date: Sat, 23 Nov 2024 15:38:16 +0100 Subject: [PATCH] fix minori per analisi statica --- code/app/Modifier.php | 2 -- code/app/Singletons/ModifierEngine.php | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/code/app/Modifier.php b/code/app/Modifier.php index ae182684..62565ed4 100644 --- a/code/app/Modifier.php +++ b/code/app/Modifier.php @@ -132,11 +132,9 @@ public function getCheckTargetLevel() switch($this->applies_target) { case 'order': return 'global_product'; - break; default: return 'product'; - break; } } } diff --git a/code/app/Singletons/ModifierEngine.php b/code/app/Singletons/ModifierEngine.php index 44cb1f08..513fb4f2 100644 --- a/code/app/Singletons/ModifierEngine.php +++ b/code/app/Singletons/ModifierEngine.php @@ -250,7 +250,8 @@ public function apply($modifier, $booking, $aggregate_data) $check_target è l'elemento su cui valutare l'applicabilità del modificatore */ - switch($modifier->getCheckTargetLevel()) { + $target_level = $modifier->getCheckTargetLevel(); + switch($target_level) { case 'order': $check_target = $aggregate_data->orders[$order_id] ?? null; break; @@ -266,6 +267,10 @@ public function apply($modifier, $booking, $aggregate_data) case 'global_product': $check_target = $aggregate_data->orders[$order_id]->products[$modifier->target->id] ?? null; break; + + default: + Log::error('Tipo di soggetto non riconosciuto per modificatore: ' . $target_level); + return null; } /*