From 862c55ea075f16fa153136c1b579dca80475ba45 Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Sun, 30 Aug 2020 09:19:35 +0200 Subject: [PATCH 1/2] NEW Keep takepos terminal when login/logout --- htdocs/takepos/index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index ee304b7438e..6ec72417119 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -44,9 +44,16 @@ $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is $action = GETPOST('action', 'alpha'); $setterminal = GETPOST('setterminal', 'int'); +if ($_SESSION["takeposterminal"] == "") +{ + if ($conf->global->TAKEPOS_NUM_TERMINALS == "1") $_SESSION["takeposterminal"] = 1; // Use terminal 1 if there is only 1 terminal + else if (!empty($_COOKIE["takeposterminal"])) $_SESSION["takeposterminal"] = $_COOKIE["takeposterminal"]; // Restore takeposterminal from previous session +} + if ($setterminal > 0) { $_SESSION["takeposterminal"] = $setterminal; + setcookie("takeposterminal", $setterminal, (time() + (86400 * 354)), '/', null, false, true); // Permanent takeposterminal var in a cookie } $_SESSION["urlfrom"] = '/takepos/index.php'; @@ -734,8 +741,7 @@ $( document ).ready(function() { //IF NO TERMINAL SELECTED if ($_SESSION["takeposterminal"] == "") { - if ($conf->global->TAKEPOS_NUM_TERMINALS == "1") $_SESSION["takeposterminal"] = 1; - else print "TerminalsDialog();"; + print "TerminalsDialog();"; } if ($conf->global->TAKEPOS_CONTROL_CASH_OPENING) { From 59542cfbcd5ea56a1148e11b331fec17b01dc57f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 30 Aug 2020 07:41:57 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 6ec72417119..2dd57ce391f 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -47,7 +47,7 @@ $setterminal = GETPOST('setterminal', 'int'); if ($_SESSION["takeposterminal"] == "") { if ($conf->global->TAKEPOS_NUM_TERMINALS == "1") $_SESSION["takeposterminal"] = 1; // Use terminal 1 if there is only 1 terminal - else if (!empty($_COOKIE["takeposterminal"])) $_SESSION["takeposterminal"] = $_COOKIE["takeposterminal"]; // Restore takeposterminal from previous session + elseif (!empty($_COOKIE["takeposterminal"])) $_SESSION["takeposterminal"] = $_COOKIE["takeposterminal"]; // Restore takeposterminal from previous session } if ($setterminal > 0)