Version 15.232.1

This commit is contained in:
Antonio Cañas Vargas 2016-06-27 13:57:01 +02:00
parent 7a38e83e9f
commit a4f4f22181
2 changed files with 57 additions and 12 deletions

View File

@ -130,13 +130,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.232 (2016-06-27)"
#define Log_PLATFORM_VERSION "SWAD 15.232.1 (2016-06-27)"
#define CSS_FILE "swad15.229.css"
#define JS_FILE "swad15.226.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 15.232.1: Jun 27, 2015 Fixed bug in search of any user (acceptation of enrollment was wrong). (203702 lines)
Version 15.232: Jun 27, 2015 Search any user, independently on role. (203657 lines)
Version 15.231.4: Jun 24, 2015 Fix bug (buffer overflow) when getting users. (203474 lines)
Version 15.231.3: Jun 24, 2015 Parameter name used for "Scope" now depends on context. (203472 lines)

View File

@ -4951,18 +4951,62 @@ static void Usr_GetListUsrsFromQuery (const char *Query,Rol_Role_t Role,Sco_Scop
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Sex = Usr_GetSexFromStr (row[1]);
/* Get user's acceptance of enrollment in course(s) */
if (Role == Rol_STUDENT ||
Role == Rol_TEACHER)
{
if (Scope == Sco_SCOPE_CRS)
// Query result has a third column with the acceptation
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted = (Str_ConvertToUpperLetter (row[2][0]) == 'Y');
else
// Query result has not a third column with the acceptation
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted = (Usr_GetNumCrssOfUsrWithARoleNotAccepted (Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod,Role) == 0);
switch (Role)
{
case Rol_UNKNOWN: // Here Rol_UNKNOWN means any user
switch (Scope)
{
case Sco_SCOPE_UNK: // Unknown
Lay_ShowErrorAndExit ("Wrong scope.");
break;
case Sco_SCOPE_SYS: // System
// Query result has not a third column with the acceptation
if (Usr_GetNumCrssOfUsr (Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod))
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted = (Usr_GetNumCrssOfUsrNotAccepted (Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod) == 0);
else
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted = false;
break;
case Sco_SCOPE_CTY: // Country
case Sco_SCOPE_INS: // Institution
case Sco_SCOPE_CTR: // Centre
case Sco_SCOPE_DEG: // Degree
// Query result has not a third column with the acceptation
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted = (Usr_GetNumCrssOfUsrNotAccepted (Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod) == 0);
break;
case Sco_SCOPE_CRS: // Course
// Query result has a third column with the acceptation
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted = (Str_ConvertToUpperLetter (row[2][0]) == 'Y');
break;
}
break;
case Rol__GUEST_:
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted = false;
break;
case Rol_STUDENT:
case Rol_TEACHER:
switch (Scope)
{
case Sco_SCOPE_UNK: // Unknown
Lay_ShowErrorAndExit ("Wrong scope.");
break;
case Sco_SCOPE_SYS: // System
case Sco_SCOPE_CTY: // Country
case Sco_SCOPE_INS: // Institution
case Sco_SCOPE_CTR: // Centre
case Sco_SCOPE_DEG: // Degree
// Query result has not a third column with the acceptation
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted = (Usr_GetNumCrssOfUsrWithARoleNotAccepted (Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod,Role) == 0);
break;
case Sco_SCOPE_CRS: // Course
// Query result has a third column with the acceptation
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted = (Str_ConvertToUpperLetter (row[2][0]) == 'Y');
break;
}
break;
default:
Lay_ShowErrorAndExit ("Wrong role.");
break;
}
else
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted = false;
/* By default, users are not removed */
Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Remove = false;