From b8e24424ed5fb5e4fd735d2633f4a678debe0627 Mon Sep 17 00:00:00 2001 From: acanas Date: Fri, 22 Oct 2021 09:06:38 +0200 Subject: [PATCH] Version 21.39.2: Oct 22, 2021 Fixed bug in settings. --- swad_changelog.h | 3 ++- swad_setting.c | 54 ++++++++++++++++++++------------------- swad_statistic_database.c | 1 + swad_survey_database.c | 2 +- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 045515d2..032d7a28 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo. */ -#define Log_PLATFORM_VERSION "SWAD 21.39.1 (2021-10-21)" +#define Log_PLATFORM_VERSION "SWAD 21.39.2 (2021-10-22)" #define CSS_FILE "swad20.45.css" #define JS_FILE "swad20.69.1.js" /* TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams + Version 21.39.2: Oct 22, 2021 Fixed bug in settings. (320544 lines) Version 21.39.1: Oct 21, 2021 Queries moved to module swad_survey_database. (320540 lines) Version 21.39: Oct 21, 2021 Fixed bug in nicknames. Reported by Ana Ollarves Reyes. (320487 lines) Version 21.38.1: Oct 20, 2021 Queries moved to module swad_survey_database. (320522 lines) diff --git a/swad_setting.c b/swad_setting.c index b1364a64..fbf91e6a 100644 --- a/swad_setting.c +++ b/swad_setting.c @@ -144,35 +144,37 @@ void Set_GetSettingsFromIP (void) if (Gbl.IP[0]) { /***** Get settings from database *****/ - if (Set_DB_GetSettingsFromIP (&mysql_res) != 1) - Err_ShowErrorAndExit ("Internal error while getting settings."); - - /***** Get settings from database *****/ - row = mysql_fetch_row (mysql_res); - - /* Get first day of week (row[0]) */ - Gbl.Prefs.FirstDayOfWeek = Cal_GetFirstDayOfWeekFromStr (row[0]); - - /* Get date format (row[1]) */ - Gbl.Prefs.DateFormat = Dat_GetDateFormatFromStr (row[1]); - - /* Get theme (row[2]) */ - Gbl.Prefs.Theme = The_GetThemeFromStr (row[2]); - - /* Get icon set (row[3]) */ - Gbl.Prefs.IconSet = Ico_GetIconSetFromStr (row[3]); - - /* Get menu (row[4]) */ - Gbl.Prefs.Menu = Mnu_GetMenuFromStr (row[4]); - - /* Get if user wants to show side columns (row[5]) */ - if (sscanf (row[5],"%u",&Gbl.Prefs.SideCols) == 1) + if (Set_DB_GetSettingsFromIP (&mysql_res)) { - if (Gbl.Prefs.SideCols > Lay_SHOW_BOTH_COLUMNS) + row = mysql_fetch_row (mysql_res); + + /* Get first day of week (row[0]) */ + Gbl.Prefs.FirstDayOfWeek = Cal_GetFirstDayOfWeekFromStr (row[0]); + + /* Get date format (row[1]) */ + Gbl.Prefs.DateFormat = Dat_GetDateFormatFromStr (row[1]); + + /* Get theme (row[2]) */ + Gbl.Prefs.Theme = The_GetThemeFromStr (row[2]); + + /* Get icon set (row[3]) */ + Gbl.Prefs.IconSet = Ico_GetIconSetFromStr (row[3]); + + /* Get menu (row[4]) */ + Gbl.Prefs.Menu = Mnu_GetMenuFromStr (row[4]); + + /* Get if user wants to show side columns (row[5]) */ + if (sscanf (row[5],"%u",&Gbl.Prefs.SideCols) == 1) + { + if (Gbl.Prefs.SideCols > Lay_SHOW_BOTH_COLUMNS) + Gbl.Prefs.SideCols = Cfg_DEFAULT_COLUMNS; + } + else Gbl.Prefs.SideCols = Cfg_DEFAULT_COLUMNS; } - else - Gbl.Prefs.SideCols = Cfg_DEFAULT_COLUMNS; + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); } } diff --git a/swad_statistic_database.c b/swad_statistic_database.c index dfdaf609..472f2af5 100644 --- a/swad_statistic_database.c +++ b/swad_statistic_database.c @@ -26,6 +26,7 @@ /*****************************************************************************/ #include // For NULL +#include // For free #include // For string functions #include "swad_database.h" diff --git a/swad_survey_database.c b/swad_survey_database.c index f0a961f5..95839797 100644 --- a/swad_survey_database.c +++ b/swad_survey_database.c @@ -29,7 +29,7 @@ // #include // For PATH_MAX // #include // For NULL #include // For asprintf -// #include // For calloc +#include // For free // #include // For string functions // #include "swad_attendance.h"