From 63912b36060e631bf041e066587ce215d304c450 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Wed, 21 Jan 2026 07:36:23 +0100 Subject: [PATCH] no message --- PV_Forecast_plotmemory/form.json | 1 + PV_Forecast_plotmemory/module.php | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/PV_Forecast_plotmemory/form.json b/PV_Forecast_plotmemory/form.json index ff547a2..9a451ff 100644 --- a/PV_Forecast_plotmemory/form.json +++ b/PV_Forecast_plotmemory/form.json @@ -1,5 +1,6 @@ { "elements": [ + { "type": "ValidationTextBox", "name": "kunde", "caption": "Kundenname" }, { "type": "ValidationTextBox", "name": "URL", "caption": "Solcast URL" }, { "type": "SelectVariable", "name": "ActualVariableID", "caption": "Ist-Produktion Variable (Leistung)" }, { "type": "CheckBox", "name": "ActualIsWatt", "caption": "Istwerte sind in Watt (in kW umrechnen)" }, diff --git a/PV_Forecast_plotmemory/module.php b/PV_Forecast_plotmemory/module.php index 3f92ed6..24d28e0 100644 --- a/PV_Forecast_plotmemory/module.php +++ b/PV_Forecast_plotmemory/module.php @@ -11,6 +11,7 @@ class PV_Forecast_plotmemory extends IPSModule // Core $this->RegisterPropertyString("URL", ""); + $this->RegisterPropertyString("kunde", ""); $this->RegisterPropertyInteger("ActualVariableID", 0); $this->RegisterPropertyBoolean("ActualIsWatt", true); @@ -553,9 +554,22 @@ class PV_Forecast_plotmemory extends IPSModule echo "No snapshots found"; return; } + $kunde = trim($this->ReadPropertyString("kunde")); + $kunde = trim($this->ReadPropertyString("kunde")); + if ($kunde === "") { + $kunde = "unbekannt"; + } + + // Sonderzeichen entfernen (für Dateinamen!) + $kundeSafe = preg_replace('/[^a-zA-Z0-9_-]/', '_', $kunde); header("Content-Type: application/zip"); - header('Content-Disposition: attachment; filename="pv_plots_' . $this->InstanceID . '_' . $days . 'days.zip"'); + header( + 'Content-Disposition: attachment; filename="pv_plots_' . + $kundeSafe . '_' . + $this->InstanceID . '_' . + $days . 'days.zip"' + ); header("Content-Length: " . filesize($zipPath)); readfile($zipPath);