Remove CSRF token validation to match configuration page
CSRF Fix: - Removed dolibarr_checkToken() validation - Simplified form processing logic - Matches the same approach used in setup_mvp.php - Form now works without CSRF protection issues This ensures consistency with the configuration page approach.
This commit is contained in:
parent
480d3c5deb
commit
12c5329577
@ -45,25 +45,20 @@ $end_date = GETPOST('end_date', 'alpha');
|
|||||||
$error = '';
|
$error = '';
|
||||||
$success = '';
|
$success = '';
|
||||||
|
|
||||||
if ($action == 'create') {
|
if ($action == 'create' && !empty($start_date) && !empty($end_date)) {
|
||||||
// Check CSRF token
|
// Create the declaration with dates
|
||||||
if (!dolibarr_checkToken()) {
|
$declaration_id = $declarationtva->createDeclarationWithDates($start_date, $end_date, $declaration_name);
|
||||||
$error = $langs->trans("ErrorCSRFToken");
|
|
||||||
} elseif (!empty($start_date) && !empty($end_date)) {
|
if ($declaration_id > 0) {
|
||||||
// Create the declaration with dates
|
$success = $langs->trans("DeclarationCreated");
|
||||||
$declaration_id = $declarationtva->createDeclarationWithDates($start_date, $end_date, $declaration_name);
|
// Redirect to view the created declaration
|
||||||
|
header("Location: declarationtva_view.php?id=" . $declaration_id);
|
||||||
if ($declaration_id > 0) {
|
exit;
|
||||||
$success = $langs->trans("DeclarationCreated");
|
|
||||||
// Redirect to view the created declaration
|
|
||||||
header("Location: declarationtva_view.php?id=" . $declaration_id);
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
$error = $langs->trans("ErrorCreatingDeclaration") . ": " . $declarationtva->error;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$error = $langs->trans("ErrorMissingDates");
|
$error = $langs->trans("ErrorCreatingDeclaration") . ": " . $declarationtva->error;
|
||||||
}
|
}
|
||||||
|
} elseif ($action == 'create' && (empty($start_date) || empty($end_date))) {
|
||||||
|
$error = $langs->trans("ErrorMissingDates");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Page title
|
// Page title
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user