From efd20a9e5826dac79ff47b8461b45f2713957b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 28 Dec 2016 18:18:24 +0100 Subject: [PATCH] Version 16.111.8 --- swad_changelog.h | 3 ++- swad_course.c | 2 +- swad_enrollment.c | 2 +- swad_file_browser.c | 2 +- swad_file_browser.h | 2 +- swad_notification.c | 16 ++++++++++------ swad_notification.h | 2 +- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 734ad374e..4ae57e8c2 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -189,13 +189,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.111.7 (2016-12-28)" +#define Log_PLATFORM_VERSION "SWAD 16.111.8 (2016-12-28)" #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.8: Dec 28, 2016 Fixed bug in notifications, reported by Coverity. (211119 lines) Version 16.111.7: Dec 28, 2016 Fixed minor bug in groups, reported by Coverity. (211114 lines) Version 16.111.6: Dec 28, 2016 Fixed bug in assigments, reported by Coverity. (211109 lines) Version 16.111.5: Dec 28, 2016 Changes in CSS related to tabs. (211084 lines) diff --git a/swad_course.c b/swad_course.c index f5e35b489..e95b681dd 100644 --- a/swad_course.c +++ b/swad_course.c @@ -2201,7 +2201,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod) /***** Set all the notifications from the course as removed, except notifications about new messages *****/ - Ntf_MarkNotifInCrsAsRemoved (CrsCod,-1L); + Ntf_MarkNotifInCrsAsRemoved (-1L,CrsCod); /***** Remove information of the course ****/ /* Remove timetable of the course */ diff --git a/swad_enrollment.c b/swad_enrollment.c index a3f4572aa..fc1abee4b 100644 --- a/swad_enrollment.c +++ b/swad_enrollment.c @@ -3906,7 +3906,7 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course * /***** Set all the notifications for this user in this course as removed, except notifications about new messages *****/ - Ntf_MarkNotifInCrsAsRemoved (Crs->CrsCod,UsrDat->UsrCod); + Ntf_MarkNotifInCrsAsRemoved (UsrDat->UsrCod,Crs->CrsCod); /***** Remove user from the table of courses-users *****/ sprintf (Query,"DELETE FROM crs_usr" diff --git a/swad_file_browser.c b/swad_file_browser.c index fb8c4036f..d723cea3f 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -4456,7 +4456,7 @@ void Brw_RemoveGrpFilesFromDB (long GrpCod) /* Remove some info about files related to a course and a user from database */ /*****************************************************************************/ -void Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (long CrsCod,long UsrCod) +void Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (long UsrCod,long CrsCod) { char Query[512]; diff --git a/swad_file_browser.h b/swad_file_browser.h index 85e51a9f5..ff4378fad 100644 --- a/swad_file_browser.h +++ b/swad_file_browser.h @@ -171,7 +171,7 @@ void Brw_RemoveCtrFilesFromDB (long CtrCod); void Brw_RemoveDegFilesFromDB (long DegCod); void Brw_RemoveCrsFilesFromDB (long CrsCod); void Brw_RemoveGrpFilesFromDB (long GrpCod); -void Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (long CrsCod,long UsrCod); +void Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (long UsrCod,long CrsCod); void Brw_RemoveWrkFilesFromDB (long CrsCod,long UsrCod); void Brw_RemoveUsrFilesFromDB (long UsrCod); diff --git a/swad_notification.c b/swad_notification.c index 2bf3020df..df6c7e093 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -1005,20 +1005,24 @@ void Ntf_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long // However, notifications about new messages should not be removed // because the messages will remain available -void Ntf_MarkNotifInCrsAsRemoved (long CrsCod,long ToUsrCod) +void Ntf_MarkNotifInCrsAsRemoved (long ToUsrCod,long CrsCod) { - char Query[512]; + char Query[256]; /***** Set all notifications from the course as removed, except notifications about new messages *****/ if (ToUsrCod > 0) // If the user code is specified sprintf (Query,"UPDATE notif SET Status=(Status | %u)" - " WHERE ToUsrCod='%ld' AND CrsCod='%ld' AND NotifyEvent<>'%u'", + " WHERE ToUsrCod='%ld'" + " AND CrsCod='%ld'" + " AND NotifyEvent<>'%u'", // messages will remain available (unsigned) Ntf_STATUS_BIT_REMOVED, - ToUsrCod,CrsCod,(unsigned) Ntf_EVENT_MESSAGE); - else + ToUsrCod, + CrsCod,(unsigned) Ntf_EVENT_MESSAGE); + else // User code not specified ==> any user sprintf (Query,"UPDATE notif SET Status=(Status | %u)" - " WHERE CrsCod='%ld' AND NotifyEvent<>'%u'", + " WHERE CrsCod='%ld'" + " AND NotifyEvent<>'%u'", // messages will remain available (unsigned) Ntf_STATUS_BIT_REMOVED, CrsCod,(unsigned) Ntf_EVENT_MESSAGE); DB_QueryUPDATE (Query,"can not set notification(s) as removed"); diff --git a/swad_notification.h b/swad_notification.h index 917d1936f..c9272d198 100644 --- a/swad_notification.h +++ b/swad_notification.h @@ -114,7 +114,7 @@ void Ntf_GetNotifSummaryAndContent (char *SummaryStr,char **ContentStr, void Ntf_MarkNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long CrsCod,long ToUsrCod); void Ntf_MarkNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod); void Ntf_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod); -void Ntf_MarkNotifInCrsAsRemoved (long CrsCod,long ToUsrCod); +void Ntf_MarkNotifInCrsAsRemoved (long ToUsrCod,long CrsCod); void Ntf_MarkNotifOneFileAsRemoved (const char *Path); void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path); void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod);