From 217e09b698fe6a616473f2569a34a2589858d91c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 2 Jul 2017 20:36:15 +0200 Subject: [PATCH] Version 16.247.6 --- swad_changelog.h | 4 ++-- swad_enrolment.c | 30 ++++++++++++++---------------- swad_user.c | 18 ++++++++++++++++++ swad_user.h | 2 ++ 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index aa3a8ec4..d4bb3479 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -231,19 +231,19 @@ // TODO: Fix bug: Error when a link end in a dot. Example: "A guide to building..." --> "A guide to building._..url" (two dots) // TODO: Cuando sólo se cambian los grupos y no el rol de un profesor ya existente, no sale ningún mensaje. se haga lo que se haga en la edición debería salir un mensaje del tipo "Cambios realizados" -// TODO: Al inscribir un profesor, en la ficha de confirmación aparece como rol "Desconocido" en lugar de "Profesor" /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.247.5 (2017-07-02)" +#define Log_PLATFORM_VERSION "SWAD 16.247.6 (2017-07-02)" #define CSS_FILE "swad16.235.1.css" #define JS_FILE "swad16.206.3.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.247.6: Jul 02, 2017 Fixed bug in user's enrolment. (222151 lines) Version 16.247.5: Jul 02, 2017 Fixed error in layout when searching for courses. (222138 lines) Version 16.247.4: Jul 02, 2017 Fixed bug in surveys. (222138 lines) Version 16.247.3: Jul 02, 2017 Students can not view records of some users who do not share groups with them. (222132 lines) diff --git a/swad_enrolment.c b/swad_enrolment.c index d34298f1..ef27f8e3 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -225,15 +225,19 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole) (unsigned) NewRole,Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod); DB_QueryUPDATE (Query,"can not modify user's role in course"); - /***** Create notification for this user. - If this user wants to receive notifications by email, - activate the sending of a notification *****/ - Enr_NotifyAfterEnrolment (UsrDat,NewRole); + /***** Flush caches *****/ + Usr_FlushCachesUsr (); + /***** Set user's roles *****/ UsrDat->Roles.InCurrentCrs.Role = NewRole; UsrDat->Roles.InCurrentCrs.Valid = true; UsrDat->Roles.InCrss = -1; // Force roles to be got from database Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get roles + + /***** Create notification for this user. + If this user wants to receive notifications by email, + activate the sending of a notification *****/ + Enr_NotifyAfterEnrolment (UsrDat,NewRole); } /*****************************************************************************/ @@ -279,6 +283,11 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole, Usr_LIST_WITH_PHOTOS_DEF ? 'Y' : 'N'); DB_QueryINSERT (Query,"can not register user in course"); + + /***** Flush caches *****/ + Usr_FlushCachesUsr (); + + /***** Set roles *****/ UsrDat->Roles.InCurrentCrs.Role = NewRole; UsrDat->Roles.InCurrentCrs.Valid = true; UsrDat->Roles.InCrss = -1; // Force roles to be got from database @@ -4171,22 +4180,11 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course * DB_QueryDELETE (Query,"can not remove a user from a course"); /***** Flush caches *****/ - Usr_FlushCacheUsrBelongsToIns (); - Usr_FlushCacheUsrBelongsToCtr (); - Usr_FlushCacheUsrBelongsToDeg (); - Usr_FlushCacheUsrBelongsToCrs (); - Usr_FlushCacheUsrBelongsToCurrentCrs (); - Usr_FlushCacheUsrHasAcceptedInCurrentCrs (); - Usr_FlushCacheUsrSharesAnyOfMyCrs (); - Rol_FlushCacheRoleUsrInCrs (); - Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs (); + Usr_FlushCachesUsr (); /***** If it's me, change my roles *****/ if (ItsMe) { - /* Flush caches */ - Grp_FlushCacheIBelongToGrp (); - /* Now I don't belong to current course */ Gbl.Usrs.Me.IBelongToCurrentCrs = Gbl.Usrs.Me.UsrDat.Accepted = false; diff --git a/swad_user.c b/swad_user.c index 25148f96..41c6f992 100644 --- a/swad_user.c +++ b/swad_user.c @@ -777,6 +777,24 @@ void Usr_WriteFirstNameBRSurnames (const struct UsrData *UsrDat) fprintf (Gbl.F.Out," %s",UsrDat->Surname2); } +/*****************************************************************************/ +/********************* Flush all caches related to users *********************/ +/*****************************************************************************/ + +void Usr_FlushCachesUsr (void) + { + Usr_FlushCacheUsrBelongsToIns (); + Usr_FlushCacheUsrBelongsToCtr (); + Usr_FlushCacheUsrBelongsToDeg (); + Usr_FlushCacheUsrBelongsToCrs (); + Usr_FlushCacheUsrBelongsToCurrentCrs (); + Usr_FlushCacheUsrHasAcceptedInCurrentCrs (); + Usr_FlushCacheUsrSharesAnyOfMyCrs (); + Rol_FlushCacheRoleUsrInCrs (); + Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs (); + Grp_FlushCacheIBelongToGrp (); + } + /*****************************************************************************/ /***** Check if a user is an administrator of a degree/centre/institution ****/ /*****************************************************************************/ diff --git a/swad_user.h b/swad_user.h index 7696a287..9a35f432 100644 --- a/swad_user.h +++ b/swad_user.h @@ -243,6 +243,8 @@ void Usr_BuildFullName (struct UsrData *UsrDat); void Usr_WriteFirstNameBRSurnames (const struct UsrData *UsrDat); +void Usr_FlushCachesUsr (void); + bool Usr_CheckIfUsrIsAdm (long UsrCod,Sco_Scope_t Scope,long Cod); void Usr_FlushCacheUsrIsSuperuser (void); bool Usr_CheckIfUsrIsSuperuser (long UsrCod);