mirror of https://github.com/acanas/swad-core.git
Version 18.8.15
This commit is contained in:
parent
24c1e20c59
commit
6a40059e0d
|
@ -1003,7 +1003,6 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
extern const char *Txt_Briefcase_of_THE_USER_X_has_been_removed;
|
||||
extern const char *Txt_Photo_of_THE_USER_X_has_been_removed;
|
||||
extern const char *Txt_Record_card_of_THE_USER_X_has_been_removed;
|
||||
char *Query;
|
||||
bool PhotoRemoved = false;
|
||||
|
||||
/***** Remove the works zones of the user in all courses *****/
|
||||
|
@ -1022,19 +1021,16 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
Grp_RemUsrFromAllGrps (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user's requests for inscription *****/
|
||||
if (asprintf (&Query,"DELETE FROM crs_usr_requests WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove user's requests for inscription");
|
||||
DB_BuildQuery ("DELETE FROM crs_usr_requests WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's requests for inscription");
|
||||
|
||||
/***** Remove user from possible duplicate users *****/
|
||||
Dup_RemoveUsrFromDuplicated (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user from the table of courses and users *****/
|
||||
if (asprintf (&Query,"DELETE FROM crs_usr WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove a user from all courses");
|
||||
DB_BuildQuery ("DELETE FROM crs_usr WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user from all courses");
|
||||
|
||||
if (QuietOrVerbose == Cns_VERBOSE)
|
||||
{
|
||||
|
@ -1045,10 +1041,9 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
}
|
||||
|
||||
/***** Remove user as administrator of any degree *****/
|
||||
if (asprintf (&Query,"DELETE FROM admin WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove a user as administrator");
|
||||
DB_BuildQuery ("DELETE FROM admin WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user as administrator");
|
||||
|
||||
if (QuietOrVerbose == Cns_VERBOSE)
|
||||
{
|
||||
|
@ -1102,16 +1097,12 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
Ann_RemoveUsrFromSeenAnnouncements (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user from table of connected users *****/
|
||||
if (asprintf (&Query,"DELETE FROM connected WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove a user from table of connected users");
|
||||
DB_BuildQuery ("DELETE FROM connected WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove a user from table of connected users");
|
||||
|
||||
/***** Remove all sessions of this user *****/
|
||||
if (asprintf (&Query,"DELETE FROM sessions WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove sessions of a user");
|
||||
DB_BuildQuery ("DELETE FROM sessions WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove sessions of a user");
|
||||
|
||||
/***** Remove social content associated to the user *****/
|
||||
Soc_RemoveUsrSocialContent (UsrDat->UsrCod);
|
||||
|
@ -1171,48 +1162,32 @@ static void Acc_RemoveUsrBriefcase (struct UsrData *UsrDat)
|
|||
|
||||
static void Acc_RemoveUsr (struct UsrData *UsrDat)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove user's webs / social networks *****/
|
||||
if (asprintf (&Query,"DELETE FROM usr_webs WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove user's webs / social networks");
|
||||
DB_BuildQuery ("DELETE FROM usr_webs WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's webs / social networks");
|
||||
|
||||
/***** Remove user's nicknames *****/
|
||||
if (asprintf (&Query,"DELETE FROM usr_nicknames WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove user's nicknames");
|
||||
DB_BuildQuery ("DELETE FROM usr_nicknames WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's nicknames");
|
||||
|
||||
/***** Remove user's emails *****/
|
||||
if (asprintf (&Query,"DELETE FROM pending_emails WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove pending user's emails");
|
||||
DB_BuildQuery ("DELETE FROM pending_emails WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove pending user's emails");
|
||||
|
||||
if (asprintf (&Query,"DELETE FROM usr_emails WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove user's emails");
|
||||
DB_BuildQuery ("DELETE FROM usr_emails WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's emails");
|
||||
|
||||
/***** Remove user's IDs *****/
|
||||
if (asprintf (&Query,"DELETE FROM usr_IDs WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove user's IDs");
|
||||
DB_BuildQuery ("DELETE FROM usr_IDs WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's IDs");
|
||||
|
||||
/***** Remove user's last data *****/
|
||||
if (asprintf (&Query,"DELETE FROM usr_last WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove user's last data");
|
||||
DB_BuildQuery ("DELETE FROM usr_last WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's last data");
|
||||
|
||||
/***** Remove user's data *****/
|
||||
if (asprintf (&Query,"DELETE FROM usr_data WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove user's data");
|
||||
DB_BuildQuery ("DELETE FROM usr_data WHERE UsrCod=%ld",UsrDat->UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user's data");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1324,7 +1324,6 @@ void Agd_AskRemEvent (void)
|
|||
void Agd_RemoveEvent (void)
|
||||
{
|
||||
extern const char *Txt_Event_X_removed;
|
||||
char *Query;
|
||||
struct AgendaEvent AgdEvent;
|
||||
|
||||
/***** Get event code *****/
|
||||
|
@ -1336,11 +1335,9 @@ void Agd_RemoveEvent (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Remove event *****/
|
||||
if (asprintf (&Query,"DELETE FROM agendas"
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove event");
|
||||
DB_BuildQuery ("DELETE FROM agendas WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove event");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1746,13 +1743,9 @@ static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
|||
|
||||
void Agd_RemoveUsrEvents (long UsrCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove events *****/
|
||||
if (asprintf (&Query,"DELETE FROM agendas WHERE UsrCod=%ld",
|
||||
UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove all the events of a user");
|
||||
DB_BuildQuery ("DELETE FROM agendas WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove all the events of a user");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -564,23 +564,18 @@ void Ann_RevealHiddenAnnouncement (void)
|
|||
void Ann_RemoveAnnouncement (void)
|
||||
{
|
||||
extern const char *Txt_Announcement_removed;
|
||||
char *Query;
|
||||
long AnnCod;
|
||||
|
||||
/***** Get the code of the global announcement *****/
|
||||
AnnCod = Ann_GetParamAnnCod ();
|
||||
|
||||
/***** Remove announcement *****/
|
||||
if (asprintf (&Query,"DELETE FROM announcements WHERE AnnCod=%ld",
|
||||
AnnCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove announcement");
|
||||
DB_BuildQuery ("DELETE FROM announcements WHERE AnnCod=%ld",AnnCod);
|
||||
DB_QueryDELETE_new ("can not remove announcement");
|
||||
|
||||
/***** Remove users who have seen the announcement *****/
|
||||
if (asprintf (&Query,"DELETE FROM ann_seen WHERE AnnCod=%ld",
|
||||
AnnCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove announcement");
|
||||
DB_BuildQuery ("DELETE FROM ann_seen WHERE AnnCod=%ld",AnnCod);
|
||||
DB_QueryDELETE_new ("can not remove announcement");
|
||||
|
||||
/***** Write message of success *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Announcement_removed);
|
||||
|
@ -618,11 +613,7 @@ void Ann_MarkAnnouncementAsSeen (void)
|
|||
|
||||
void Ann_RemoveUsrFromSeenAnnouncements (long UsrCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove user from seen announcements *****/
|
||||
if (asprintf (&Query,"DELETE FROM ann_seen WHERE UsrCod=%ld",
|
||||
UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove user from seen announcements");
|
||||
DB_BuildQuery ("DELETE FROM ann_seen WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user from seen announcements");
|
||||
}
|
||||
|
|
|
@ -986,7 +986,6 @@ void Asg_ReqRemAssignment (void)
|
|||
void Asg_RemoveAssignment (void)
|
||||
{
|
||||
extern const char *Txt_Assignment_X_removed;
|
||||
char *Query;
|
||||
struct Assignment Asg;
|
||||
|
||||
/***** Get assignment code *****/
|
||||
|
@ -1004,11 +1003,9 @@ void Asg_RemoveAssignment (void)
|
|||
Asg_RemoveAllTheGrpsAssociatedToAnAssignment (Asg.AsgCod);
|
||||
|
||||
/***** Remove assignment *****/
|
||||
if (asprintf (&Query,"DELETE FROM assignments"
|
||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove assignment");
|
||||
DB_BuildQuery ("DELETE FROM assignments WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove assignment");
|
||||
|
||||
/***** Mark possible notifications as removed *****/
|
||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_ASSIGNMENT,Asg.AsgCod);
|
||||
|
@ -1553,12 +1550,9 @@ bool Asg_CheckIfAsgIsAssociatedToGrp (long AsgCod,long GrpCod)
|
|||
|
||||
static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove groups of the assignment *****/
|
||||
if (asprintf (&Query,"DELETE FROM asg_grp WHERE AsgCod=%ld",AsgCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove the groups associated to an assignment");
|
||||
DB_BuildQuery ("DELETE FROM asg_grp WHERE AsgCod=%ld",AsgCod);
|
||||
DB_QueryDELETE_new ("can not remove the groups associated to an assignment");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1567,12 +1561,10 @@ static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod)
|
|||
|
||||
void Asg_RemoveGroup (long GrpCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove group from all the assignments *****/
|
||||
if (asprintf (&Query,"DELETE FROM asg_grp WHERE GrpCod=%ld",GrpCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove group from the associations between assignments and groups");
|
||||
DB_BuildQuery ("DELETE FROM asg_grp WHERE GrpCod=%ld",GrpCod);
|
||||
DB_QueryDELETE_new ("can not remove group from the associations"
|
||||
" between assignments and groups");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1581,15 +1573,13 @@ void Asg_RemoveGroup (long GrpCod)
|
|||
|
||||
void Asg_RemoveGroupsOfType (long GrpTypCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove group from all the assignments *****/
|
||||
if (asprintf (&Query,"DELETE FROM asg_grp USING crs_grp,asg_grp"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=asg_grp.GrpCod",
|
||||
GrpTypCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove groups of a type from the associations between assignments and groups");
|
||||
DB_BuildQuery ("DELETE FROM asg_grp USING crs_grp,asg_grp"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=asg_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
DB_QueryDELETE_new ("can not remove groups of a type from the associations"
|
||||
" between assignments and groups");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1687,20 +1677,16 @@ static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Assignment *Asg)
|
|||
|
||||
void Asg_RemoveCrsAssignments (long CrsCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove groups *****/
|
||||
if (asprintf (&Query,"DELETE FROM asg_grp USING assignments,asg_grp"
|
||||
" WHERE assignments.CrsCod=%ld"
|
||||
" AND assignments.AsgCod=asg_grp.AsgCod",
|
||||
CrsCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove all the groups associated to assignments of a course");
|
||||
DB_BuildQuery ("DELETE FROM asg_grp USING assignments,asg_grp"
|
||||
" WHERE assignments.CrsCod=%ld"
|
||||
" AND assignments.AsgCod=asg_grp.AsgCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the groups associated to assignments of a course");
|
||||
|
||||
/***** Remove assignments *****/
|
||||
if (asprintf (&Query,"DELETE FROM assignments WHERE CrsCod=%ld",CrsCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove all the assignments of a course");
|
||||
DB_BuildQuery ("DELETE FROM assignments WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the assignments of a course");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1431,12 +1431,9 @@ bool Att_CheckIfAttEventIsAssociatedToGrp (long AttCod,long GrpCod)
|
|||
|
||||
static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove groups of the attendance event *****/
|
||||
if (asprintf (&Query,"DELETE FROM att_grp WHERE AttCod=%ld",AttCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove the groups associated to an attendance event");
|
||||
DB_BuildQuery ("DELETE FROM att_grp WHERE AttCod=%ld",AttCod);
|
||||
DB_QueryDELETE_new ("can not remove the groups associated to an attendance event");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1445,12 +1442,9 @@ static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod)
|
|||
|
||||
void Att_RemoveGroup (long GrpCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
if (asprintf (&Query,"DELETE FROM att_grp WHERE GrpCod=%ld",GrpCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove group from the associations between attendance events and groups");
|
||||
DB_BuildQuery ("DELETE FROM att_grp WHERE GrpCod=%ld",GrpCod);
|
||||
DB_QueryDELETE_new ("can not remove group from the associations between attendance events and groups");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1459,15 +1453,12 @@ void Att_RemoveGroup (long GrpCod)
|
|||
|
||||
void Att_RemoveGroupsOfType (long GrpTypCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
if (asprintf (&Query,"DELETE FROM att_grp USING crs_grp,att_grp"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=att_grp.GrpCod",
|
||||
GrpTypCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove groups of a type from the associations between attendance events and groups");
|
||||
DB_BuildQuery ("DELETE FROM att_grp USING crs_grp,att_grp"
|
||||
" WHERE crs_grp.GrpTypCod=%ld"
|
||||
" AND crs_grp.GrpCod=att_grp.GrpCod",
|
||||
GrpTypCod);
|
||||
DB_QueryDELETE_new ("can not remove groups of a type from the associations between attendance events and groups");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1565,11 +1556,8 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct AttendanceEve
|
|||
|
||||
static void Att_RemoveAllUsrsFromAnAttEvent (long AttCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
if (asprintf (&Query,"DELETE FROM att_usr WHERE AttCod=%ld",AttCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove attendance event");
|
||||
DB_BuildQuery ("DELETE FROM att_usr WHERE AttCod=%ld",AttCod);
|
||||
DB_QueryDELETE_new ("can not remove attendance event");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1578,12 +1566,9 @@ static void Att_RemoveAllUsrsFromAnAttEvent (long AttCod)
|
|||
|
||||
void Att_RemoveUsrFromAllAttEvents (long UsrCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
if (asprintf (&Query,"DELETE FROM att_usr WHERE UsrCod=%ld",UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove user from all attendance events");
|
||||
DB_BuildQuery ("DELETE FROM att_usr WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user from all attendance events");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1592,16 +1577,13 @@ void Att_RemoveUsrFromAllAttEvents (long UsrCod)
|
|||
|
||||
void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
if (asprintf (&Query,"DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_usr.AttCod"
|
||||
" AND att_usr.UsrCod=%ld",
|
||||
CrsCod,UsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove user from attendance events of a course");
|
||||
DB_BuildQuery ("DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_usr.AttCod"
|
||||
" AND att_usr.UsrCod=%ld",
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE_new ("can not remove user from attendance events of a course");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1610,13 +1592,10 @@ void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod)
|
|||
|
||||
static void Att_RemoveAttEventFromCurrentCrs (long AttCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
if (asprintf (&Query,"DELETE FROM att_events"
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
AttCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove attendance event");
|
||||
DB_BuildQuery ("DELETE FROM att_events"
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove attendance event");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1625,29 +1604,23 @@ static void Att_RemoveAttEventFromCurrentCrs (long AttCod)
|
|||
|
||||
void Att_RemoveCrsAttEvents (long CrsCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Remove students *****/
|
||||
if (asprintf (&Query,"DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_usr.AttCod",
|
||||
CrsCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove all the students registered in events of a course");
|
||||
DB_BuildQuery ("DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_usr.AttCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the students registered in events of a course");
|
||||
|
||||
/***** Remove groups *****/
|
||||
if (asprintf (&Query,"DELETE FROM att_grp USING att_events,att_grp"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_grp.AttCod",
|
||||
CrsCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove all the groups associated to attendance events of a course");
|
||||
DB_BuildQuery ("DELETE FROM att_grp USING att_events,att_grp"
|
||||
" WHERE att_events.CrsCod=%ld"
|
||||
" AND att_events.AttCod=att_grp.AttCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the groups associated to attendance events of a course");
|
||||
|
||||
/***** Remove attendance events *****/
|
||||
if (asprintf (&Query,"DELETE FROM att_events WHERE CrsCod=%ld",
|
||||
CrsCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove all the attendance events of a course");
|
||||
DB_BuildQuery ("DELETE FROM att_events WHERE CrsCod=%ld",CrsCod);
|
||||
DB_QueryDELETE_new ("can not remove all the attendance events of a course");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2634,16 +2607,13 @@ static void Att_RemoveUsrFromAttEvent (long AttCod,long UsrCod)
|
|||
|
||||
void Att_RemoveUsrsAbsentWithoutCommentsFromAttEvent (long AttCod)
|
||||
{
|
||||
char *Query;
|
||||
|
||||
/***** Clean table att_usr *****/
|
||||
if (asprintf (&Query,"DELETE FROM att_usr"
|
||||
" WHERE AttCod=%ld AND Present='N'"
|
||||
" AND CommentStd='' AND CommentTch=''",
|
||||
AttCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryDELETE_free (Query,"can not remove users absent"
|
||||
" without comments from an event");
|
||||
DB_BuildQuery ("DELETE FROM att_usr"
|
||||
" WHERE AttCod=%ld AND Present='N'"
|
||||
" AND CommentStd='' AND CommentTch=''",
|
||||
AttCod);
|
||||
DB_QueryDELETE_new ("can not remove users absent"
|
||||
" without comments from an event");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -355,10 +355,11 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.8.14 (2018-10-28)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.8.15 (2018-10-28)"
|
||||
#define CSS_FILE "swad18.4.css"
|
||||
#define JS_FILE "swad17.17.1.js"
|
||||
/*
|
||||
Version 18.8.15: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236425 lines)
|
||||
Version 18.8.14: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236493 lines)
|
||||
Version 18.8.13: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236661 lines)
|
||||
Version 18.8.12: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236870 lines)
|
||||
|
|
Loading…
Reference in New Issue