mirror of https://github.com/acanas/swad-core.git
Version 16.111.14
This commit is contained in:
parent
178e648523
commit
ff0a98979f
|
@ -701,8 +701,11 @@ void Asg_GetDataOfAssignmentByCod (struct Assignment *Asg)
|
|||
Asg_GetDataOfAssignment (Asg,Query);
|
||||
}
|
||||
else
|
||||
{
|
||||
/***** Clear all assignment data *****/
|
||||
Asg->AsgCod = -1L;
|
||||
Asg_ResetAssignment (Asg);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -729,8 +732,11 @@ void Asg_GetDataOfAssignmentByFolder (struct Assignment *Asg)
|
|||
Asg_GetDataOfAssignment (Asg,Query);
|
||||
}
|
||||
else
|
||||
{
|
||||
/***** Clear all assignment data *****/
|
||||
Asg->AsgCod = -1L;
|
||||
Asg_ResetAssignment (Asg);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -741,15 +747,12 @@ static void Asg_GetDataOfAssignment (struct Assignment *Asg,const char *Query)
|
|||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
|
||||
/***** Clear all assignment data *****/
|
||||
Asg_ResetAssignment (Asg);
|
||||
|
||||
/***** Get data of assignment from database *****/
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get assignment data");
|
||||
|
||||
if (NumRows) // Assignment found...
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get assignment data")) // Assignment found...
|
||||
{
|
||||
/* Get row */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
@ -793,6 +796,8 @@ static void Asg_GetDataOfAssignment (struct Assignment *Asg,const char *Query)
|
|||
|
||||
static void Asg_ResetAssignment (struct Assignment *Asg)
|
||||
{
|
||||
if (Asg->AsgCod <= 0) // If > 0 ==> keep value
|
||||
Asg->AsgCod = -1L;
|
||||
Asg->AsgCod = -1L;
|
||||
Asg->Hidden = false;
|
||||
Asg->UsrCod = -1L;
|
||||
|
@ -1298,8 +1303,11 @@ void Asg_RecFormAssignment (void)
|
|||
ItsANewAssignment = (NewAsg.AsgCod < 0);
|
||||
|
||||
if (ItsANewAssignment)
|
||||
{
|
||||
/***** Reset old (current, not existing) assignment data *****/
|
||||
OldAsg.AsgCod = -1L;
|
||||
Asg_ResetAssignment (&OldAsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
/***** Get data of the old (current) assignment from database *****/
|
||||
|
|
|
@ -736,59 +736,62 @@ bool Att_GetDataOfAttEventByCod (struct AttendanceEvent *Att)
|
|||
char Query[1024];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
bool Found;
|
||||
bool Found = false;
|
||||
|
||||
/***** Reset attendance event data *****/
|
||||
Att_ResetAttendanceEvent (Att);
|
||||
|
||||
/***** Build query *****/
|
||||
sprintf (Query,"SELECT AttCod,CrsCod,Hidden,UsrCod,"
|
||||
"UNIX_TIMESTAMP(StartTime),"
|
||||
"UNIX_TIMESTAMP(EndTime),"
|
||||
"NOW() BETWEEN StartTime AND EndTime,"
|
||||
"CommentTchVisible,"
|
||||
"Title"
|
||||
" FROM att_events"
|
||||
" WHERE AttCod='%ld'",
|
||||
Att->AttCod);
|
||||
|
||||
/***** Get data of attendance event from database *****/
|
||||
if ((Found = (DB_QuerySELECT (Query,&mysql_res,"can not get attendance event data") != 0))) // Attendance event found...
|
||||
if (Att->AttCod > 0)
|
||||
{
|
||||
/* Get row */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
/***** Build query *****/
|
||||
sprintf (Query,"SELECT AttCod,CrsCod,Hidden,UsrCod,"
|
||||
"UNIX_TIMESTAMP(StartTime),"
|
||||
"UNIX_TIMESTAMP(EndTime),"
|
||||
"NOW() BETWEEN StartTime AND EndTime,"
|
||||
"CommentTchVisible,"
|
||||
"Title"
|
||||
" FROM att_events"
|
||||
" WHERE AttCod='%ld'",
|
||||
Att->AttCod);
|
||||
|
||||
/* Get code of the attendance event (row[0]) */
|
||||
Att->AttCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
/***** Get data of attendance event from database *****/
|
||||
if ((Found = (DB_QuerySELECT (Query,&mysql_res,"can not get attendance event data") != 0))) // Attendance event found...
|
||||
{
|
||||
/* Get row */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get code of the course (row[1]) */
|
||||
Att->CrsCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
/* Get code of the attendance event (row[0]) */
|
||||
Att->AttCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get whether the attendance event is hidden or not (row[2]) */
|
||||
Att->Hidden = (row[2][0] == 'Y');
|
||||
/* Get code of the course (row[1]) */
|
||||
Att->CrsCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
|
||||
/* Get author of the attendance event (row[3]) */
|
||||
Att->UsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||
/* Get whether the attendance event is hidden or not (row[2]) */
|
||||
Att->Hidden = (row[2][0] == 'Y');
|
||||
|
||||
/* Get start date (row[4] holds the start UTC time) */
|
||||
Att->TimeUTC[Att_START_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||
/* Get author of the attendance event (row[3]) */
|
||||
Att->UsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||
|
||||
/* Get end date (row[5] holds the end UTC time) */
|
||||
Att->TimeUTC[Att_END_TIME ] = Dat_GetUNIXTimeFromStr (row[5]);
|
||||
/* Get start date (row[4] holds the start UTC time) */
|
||||
Att->TimeUTC[Att_START_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||
|
||||
/* Get whether the attendance event is open or closed (row(6)) */
|
||||
Att->Open = (row[6][0] == '1');
|
||||
/* Get end date (row[5] holds the end UTC time) */
|
||||
Att->TimeUTC[Att_END_TIME ] = Dat_GetUNIXTimeFromStr (row[5]);
|
||||
|
||||
/* Get whether the attendance event is visible or not (row[7]) */
|
||||
Att->CommentTchVisible = (row[7][0] == 'Y');
|
||||
/* Get whether the attendance event is open or closed (row(6)) */
|
||||
Att->Open = (row[6][0] == '1');
|
||||
|
||||
/* Get the title of the attendance event (row[8]) */
|
||||
strcpy (Att->Title,row[8]);
|
||||
/* Get whether the attendance event is visible or not (row[7]) */
|
||||
Att->CommentTchVisible = (row[7][0] == 'Y');
|
||||
|
||||
/* Get the title of the attendance event (row[8]) */
|
||||
strcpy (Att->Title,row[8]);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return Found;
|
||||
}
|
||||
|
||||
|
@ -798,7 +801,8 @@ bool Att_GetDataOfAttEventByCod (struct AttendanceEvent *Att)
|
|||
|
||||
static void Att_ResetAttendanceEvent (struct AttendanceEvent *Att)
|
||||
{
|
||||
Att->AttCod = -1L;
|
||||
if (Att->AttCod <= 0) // If > 0 ==> keep value
|
||||
Att->AttCod = -1L;
|
||||
Att->CrsCod = -1L;
|
||||
Att->Hidden = false;
|
||||
Att->UsrCod = -1L;
|
||||
|
@ -834,13 +838,14 @@ void Att_FreeListAttEvents (void)
|
|||
|
||||
static void Att_GetAttEventTxtFromDB (long AttCod,char *Txt)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
|
||||
/***** Get text of attendance event from database *****/
|
||||
sprintf (Query,"SELECT Txt FROM att_events WHERE AttCod='%ld' AND CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT Txt FROM att_events"
|
||||
" WHERE AttCod='%ld' AND CrsCod='%ld'",
|
||||
AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get attendance event text");
|
||||
|
||||
|
@ -1123,6 +1128,7 @@ void Att_RequestCreatOrEditAttEvent (void)
|
|||
if (ItsANewAttEvent)
|
||||
{
|
||||
/* Reset attendance event data */
|
||||
Att.AttCod = -1L;
|
||||
Att_ResetAttendanceEvent (&Att);
|
||||
|
||||
/* Initialize some fields */
|
||||
|
|
|
@ -189,13 +189,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.111.13 (2016-12-29)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.111.14 (2016-12-29)"
|
||||
#define CSS_FILE "swad16.111.5.css"
|
||||
#define JS_FILE "swad16.101.js"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 16.111.14:Dec 29, 2016 Fixed bug in attendance events. (211189 lines)
|
||||
Version 16.111.13:Dec 29, 2016 Fixed bug in attendance events, reported by Coverity. (211173 lines)
|
||||
Version 16.111.12:Dec 29, 2016 Fixed minor bug in groups, reported by Coverity. (? lines)
|
||||
Version 16.111.11:Dec 29, 2016 Fixed minor bug inserting links to nicknames, reported by Coverity. (211149 lines)
|
||||
|
|
Loading…
Reference in New Issue