From bfcc5c66dbaf506918033c888124cb7e1c758c61 Mon Sep 17 00:00:00 2001 From: data Date: Tue, 3 Mar 2026 08:52:07 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20POST-Redirect-GET=20Pattern=20f=C3=BCr?= =?UTF-8?q?=20Reload-Sicherheit=20(v4.3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: - Nach Aktualisieren (F5) kam Browser-Warnung "Formular erneut senden" - Filter (Kabel ausblenden) gingen nach Reload verloren Lösung: 1. Kabel-Filter als GET-Parameter statt POST - Filter bleiben nach F5 erhalten - Keine Token-Validierung nötig für einfache Filter 2. Redirect nach POST-Actions: - createallfromdatanorm: Redirect zu ?id=X nach Verarbeitung - addmissingprices: Redirect zu ?id=X nach Verarbeitung - Verhindert "Form resubmit" Warnung Jetzt: - F5 = Einfaches Reload ohne Warnung - Filter bleiben erhalten - Keine doppelten Submissions möglich Co-Authored-By: Claude Sonnet 4.5 --- import.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/import.php b/import.php index 2cde227..4182cda 100755 --- a/import.php +++ b/import.php @@ -848,6 +848,11 @@ if ($action == 'addmissingprices' && $id > 0) { if ($errorCount > 0) { setEventMessages($addedCount.' hinzugefuegt, '.$errorCount.' Fehler', null, 'warnings'); } + + // Redirect to avoid "Form resubmit" warning on page reload + $redirectUrl = $_SERVER['PHP_SELF'].'?id='.$id; + header('Location: '.$redirectUrl); + exit; } else { setEventMessages('Keine Preise ausgewählt', null, 'warnings'); } @@ -1762,6 +1767,11 @@ if ($action == 'createallfromdatanorm' && $id > 0) { $import->status = ZugferdImport::STATUS_IMPORTED; $import->update($user); } + + // Redirect to avoid "Form resubmit" warning on page reload + $redirectUrl = $_SERVER['PHP_SELF'].'?id='.$id; + header('Location: '.$redirectUrl); + exit; } $action = 'edit'; $import->fetch($id); @@ -2950,12 +2960,11 @@ if ($action == 'edit' && $import->id > 0) { print ''.$langs->trans('DatanormPreview'); print ' '.count($datanormPreviewMatches).' '.$langs->trans('Matches').''; - // Filter: Kabel ausblenden (in eigenem Form für sofortiges Submit) + // Filter: Kabel ausblenden (als GET-Parameter für Reload-Sicherheit) $hideCables = GETPOST('hide_cables', 'int'); $checked = $hideCables ? ' checked' : ''; print '
'; - print '
'; - print ''; + print ''; print ''; print ''; print '