From 6a68c4cbb3943263961aee0da6916f92f25e666a Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Wed, 1 Apr 2020 12:54:37 +0200 Subject: #839: Fix bug when creating database event. --- admin/WebConsole/rest/remotepc.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/admin/WebConsole/rest/remotepc.php b/admin/WebConsole/rest/remotepc.php index c6dcda51..f8f3af75 100644 --- a/admin/WebConsole/rest/remotepc.php +++ b/admin/WebConsole/rest/remotepc.php @@ -187,20 +187,19 @@ EOD; CREATE EVENT e_timeout_$clntid ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL $timeout DO BEGIN - SET @clntid = NULL; + SET @action_id = NULL; UPDATE acciones SET estado = $ACCION_FINALIZADA, resultado = $ACCION_FALLIDA, descrinotificacion = 'Timeout' WHERE descriaccion = 'RemotePC Session' AND estado = $ACCION_INICIADA - AND idordenador = (SELECT @clntid := '$clntid'); - IF @clntid IS NOT NULL THEN + AND idordenador = '$clntid' + AND (SELECT @action_id := idaccion); + IF @action_id IS NOT NULL THEN UPDATE remotepc SET reserved=NOW() - INTERVAL 1 SECOND, urllogin=NULL, urllogout=NULL - WHERE id = @clntid; + WHERE id = '$clntid'; DELETE FROM acciones - WHERE idordenador = @clntid - AND descriaccion = 'RemotePC Session' - AND descrinotificacion = 'Timeout'; + WHERE idaccion = @action_id; END IF; END EOD; -- cgit v1.2.3-18-g5258