IMPORT util TYPE t_sync_cmd RECORD oper STRING, data STRING END RECORD FUNCTION valida_usuario(u,url) DEFINE u RECORD usuario VARCHAR(50), clave VARCHAR(20), sesion VARCHAR(10) END RECORD DEFINE r_cmd t_sync_cmd DEFINE cmd, res, msg,url STRING, ret INT DEFINE r RECORD perror STRING, pbodega SMALLINT END RECORD LET r_cmd.oper = "v_usuarios" LET r_cmd.data = util.JSON.stringify(u) -- aca se convierte a string los datos de la operacion LET cmd = util.JSON.stringify(r_cmd) -- aca se convierte a string el comando/operacion a enviar al server CALL sync_send_command(url, cmd) RETURNING ret, res TRY IF ret == 0 THEN CALL util.JSON.parse(res,r) IF r.perror = "VALIDO" THEN RETURN TRUE,r.pbodega ELSE LET msg=SFMT(%"Connection '%1' failed",r_cmd.oper),"\n",url,"\n",res CALL show_sync_err(msg) RETURN FALSE,r.pbodega END IF ELSE LET msg=SFMT(%"Connection '%1' failed",r_cmd.oper),"\n",url,"\n",res CALL show_sync_err(msg) RETURN FALSE,r.pbodega END IF CATCH ERROR "ERROR EN VALIDACION USUARIO" RETURN FALSE,r.pbodega END TRY END FUNCTION