Version 16.111.13

This commit is contained in:
Antonio Cañas Vargas 2016-12-29 23:07:30 +01:00
parent ee62441950
commit 178e648523
2 changed files with 34 additions and 10 deletions

View File

@ -88,6 +88,7 @@ static void Att_PutFormsToRemEditOneAttEvent (long AttCod,bool Hidden);
static void Att_PutParams (void); static void Att_PutParams (void);
static void Att_GetListAttEvents (Att_OrderTime_t Order); static void Att_GetListAttEvents (Att_OrderTime_t Order);
static void Att_GetDataOfAttEventByCodAndCheckCrs (struct AttendanceEvent *Att); static void Att_GetDataOfAttEventByCodAndCheckCrs (struct AttendanceEvent *Att);
static void Att_ResetAttendanceEvent (struct AttendanceEvent *Att);
static void Att_GetAttEventTxtFromDB (long AttCod,char *Txt); static void Att_GetAttEventTxtFromDB (long AttCod,char *Txt);
static bool Att_CheckIfSimilarAttEventExists (const char *Field,const char *Value,long AttCod); static bool Att_CheckIfSimilarAttEventExists (const char *Field,const char *Value,long AttCod);
static void Att_ShowLstGrpsToEditAttEvent (long AttCod); static void Att_ShowLstGrpsToEditAttEvent (long AttCod);
@ -737,6 +738,9 @@ bool Att_GetDataOfAttEventByCod (struct AttendanceEvent *Att)
MYSQL_ROW row; MYSQL_ROW row;
bool Found; bool Found;
/***** Reset attendance event data *****/
Att_ResetAttendanceEvent (Att);
/***** Build query *****/ /***** Build query *****/
sprintf (Query,"SELECT AttCod,CrsCod,Hidden,UsrCod," sprintf (Query,"SELECT AttCod,CrsCod,Hidden,UsrCod,"
"UNIX_TIMESTAMP(StartTime)," "UNIX_TIMESTAMP(StartTime),"
@ -748,11 +752,6 @@ bool Att_GetDataOfAttEventByCod (struct AttendanceEvent *Att)
" WHERE AttCod='%ld'", " WHERE AttCod='%ld'",
Att->AttCod); Att->AttCod);
/***** Clear data *****/
Att->TimeUTC[Att_START_TIME] =
Att->TimeUTC[Att_END_TIME ] = (time_t) 0;
Att->Title[0] = '\0';
/***** Get data of attendance event from database *****/ /***** 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 ((Found = (DB_QuerySELECT (Query,&mysql_res,"can not get attendance event data") != 0))) // Attendance event found...
{ {
@ -793,6 +792,26 @@ bool Att_GetDataOfAttEventByCod (struct AttendanceEvent *Att)
return Found; return Found;
} }
/*****************************************************************************/
/********************** Clear all attendance event data **********************/
/*****************************************************************************/
static void Att_ResetAttendanceEvent (struct AttendanceEvent *Att)
{
Att->AttCod = -1L;
Att->CrsCod = -1L;
Att->Hidden = false;
Att->UsrCod = -1L;
Att->TimeUTC[Att_START_TIME] =
Att->TimeUTC[Att_END_TIME ] = (time_t) 0;
Att->Open = false;
Att->Title[0] = '\0';
Att->CommentTchVisible = false;
Att->NumStdsTotal = 0;
Att->NumStdsFromList = 0;
Att->Selected = false;
}
/*****************************************************************************/ /*****************************************************************************/
/********************** Free list of attendance events ***********************/ /********************** Free list of attendance events ***********************/
/*****************************************************************************/ /*****************************************************************************/
@ -1097,17 +1116,21 @@ void Att_RequestCreatOrEditAttEvent (void)
Pag_GetParamPagNum (Pag_ATT_EVENTS); Pag_GetParamPagNum (Pag_ATT_EVENTS);
/***** Get the code of the attendance event *****/ /***** Get the code of the attendance event *****/
ItsANewAttEvent = ((Att.AttCod = Att_GetParamAttCod ()) == -1L); Att.AttCod = Att_GetParamAttCod ();
ItsANewAttEvent = (Att.AttCod <= 0);
/***** Get from the database the data of the attendance event *****/ /***** Get from the database the data of the attendance event *****/
if (ItsANewAttEvent) if (ItsANewAttEvent)
{ {
/* Initialize to empty attendance event */ /* Reset attendance event data */
Att.AttCod = -1L; Att_ResetAttendanceEvent (&Att);
/* Initialize some fields */
Att.CrsCod = Gbl.CurrentCrs.Crs.CrsCod;
Att.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Att.TimeUTC[Att_START_TIME] = Gbl.StartExecutionTimeUTC; Att.TimeUTC[Att_START_TIME] = Gbl.StartExecutionTimeUTC;
Att.TimeUTC[Att_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours Att.TimeUTC[Att_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
Att.Open = true; Att.Open = true;
Att.Title[0] = '\0';
} }
else else
{ {

View File

@ -189,13 +189,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.111.12 (2016-12-29)" #define Log_PLATFORM_VERSION "SWAD 16.111.13 (2016-12-29)"
#define CSS_FILE "swad16.111.5.css" #define CSS_FILE "swad16.111.5.css"
#define JS_FILE "swad16.101.js" #define JS_FILE "swad16.101.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // 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.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.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) Version 16.111.11:Dec 29, 2016 Fixed minor bug inserting links to nicknames, reported by Coverity. (211149 lines)
Version 16.111.10:Dec 29, 2016 Fixed minor bug in groups, reported by Coverity. (211146 lines) Version 16.111.10:Dec 29, 2016 Fixed minor bug in groups, reported by Coverity. (211146 lines)