FIX: Add security test for show terminal selection if no terminal selected when invoice.php is call (#34717)
* FIX: Add security test for show terminal selection if no terminal selected when invoice.php is call * Modification to take into account the value saved in the cookie * Update invoice.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
2d55195982
commit
247c38923f
1 changed files with 17 additions and 0 deletions
|
|
@ -78,6 +78,23 @@ if ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->la
|
|||
}
|
||||
}
|
||||
|
||||
// When session has expired (selected terminal has been lost from session), redirect to the terminal selection.
|
||||
if (empty($_SESSION["takeposterminal"])) {
|
||||
if (getDolGlobalInt('TAKEPOS_NUM_TERMINALS') == 1) {
|
||||
$_SESSION["takeposterminal"] = 1; // Use terminal 1 if there is only 1 terminal
|
||||
} elseif (!empty($_COOKIE["takeposterminal"])) {
|
||||
$_SESSION["takeposterminal"] = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE["takeposterminal"]); // Restore takeposterminal from previous session
|
||||
} else {
|
||||
print <<<SCRIPT
|
||||
<script language="javascript">
|
||||
$( document ).ready(function() {
|
||||
ModalBox('ModalTerminal');
|
||||
});
|
||||
</script>
|
||||
SCRIPT;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abort invoice creationg with a given error message
|
||||
|
|
|
|||
Loading…
Reference in a new issue