mirror of https://github.com/acanas/swad-core.git
Version 20.66: Apr 17, 2021 Code refactoring in database updates.
This commit is contained in:
parent
0a664e61f1
commit
4d80b0a917
15
swad_API.c
15
swad_API.c
|
@ -3174,7 +3174,8 @@ int swad__sendAttendanceUsers (struct soap *soap,
|
|||
" SET Present='N'"
|
||||
" WHERE AttCod=%ld"
|
||||
"%s",
|
||||
Event.AttCod,SubQueryAllUsrs);
|
||||
Event.AttCod,
|
||||
SubQueryAllUsrs);
|
||||
|
||||
/* Free memory for subquery string */
|
||||
free (SubQueryAllUsrs);
|
||||
|
@ -3537,7 +3538,8 @@ int swad__markNotificationsAsRead (struct soap *soap,
|
|||
" WHERE NtfCod=%ld"
|
||||
" AND ToUsrCod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
(long) NtfCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
(long) NtfCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
NumNtfsMarkedAsRead++;
|
||||
}
|
||||
|
@ -3818,9 +3820,12 @@ static int API_SendMessageToUsr (long OriginalMsgCod,
|
|||
if (RecipientUsrCod == ReplyUsrCod)
|
||||
/***** ...then update received message setting Replied field to true *****/
|
||||
DB_QueryUPDATE ("can not update a received message",
|
||||
"UPDATE msg_rcv SET Replied='Y'"
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
OriginalMsgCod,SenderUsrCod);
|
||||
"UPDATE msg_rcv"
|
||||
" SET Replied='Y'"
|
||||
" WHERE MsgCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
OriginalMsgCod,
|
||||
SenderUsrCod);
|
||||
|
||||
return SOAP_OK;
|
||||
}
|
||||
|
|
|
@ -1409,9 +1409,9 @@ void Agd_HideEvent (void)
|
|||
/***** Set event private *****/
|
||||
DB_QueryUPDATE ("can not hide event",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Hidden='Y'"
|
||||
" SET Hidden='Y'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,
|
||||
AgdEvent.UsrCod);
|
||||
|
||||
|
@ -1445,9 +1445,9 @@ void Agd_UnhideEvent (void)
|
|||
/***** Set event public *****/
|
||||
DB_QueryUPDATE ("can not show event",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Hidden='N'"
|
||||
" SET Hidden='N'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,
|
||||
AgdEvent.UsrCod);
|
||||
|
||||
|
@ -1482,9 +1482,9 @@ void Agd_MakeEventPrivate (void)
|
|||
/***** Make event private *****/
|
||||
DB_QueryUPDATE ("can not make event private",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Public='N'"
|
||||
" SET Public='N'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,
|
||||
AgdEvent.UsrCod);
|
||||
|
||||
|
@ -1523,9 +1523,9 @@ void Agd_MakeEventPublic (void)
|
|||
/***** Make event public *****/
|
||||
DB_QueryUPDATE ("can not make event public",
|
||||
"UPDATE agd_agendas"
|
||||
" SET Public='Y'"
|
||||
" SET Public='Y'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,
|
||||
AgdEvent.UsrCod);
|
||||
|
||||
|
@ -1804,17 +1804,20 @@ static void Agd_UpdateEvent (struct Agd_Event *AgdEvent,const char *Txt)
|
|||
/***** Update the data of the event *****/
|
||||
DB_QueryUPDATE ("can not update event",
|
||||
"UPDATE agd_agendas"
|
||||
" SET StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Event='%s',"
|
||||
"Location='%s',"
|
||||
"Txt='%s'"
|
||||
" SET StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Event='%s',"
|
||||
"Location='%s',"
|
||||
"Txt='%s'"
|
||||
" WHERE AgdCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
AgdEvent->TimeUTC[Dat_START_TIME],
|
||||
AgdEvent->TimeUTC[Dat_END_TIME ],
|
||||
AgdEvent->Event,AgdEvent->Location,Txt,
|
||||
AgdEvent->AgdCod,AgdEvent->UsrCod);
|
||||
AgdEvent->Event,
|
||||
AgdEvent->Location,
|
||||
Txt,
|
||||
AgdEvent->AgdCod,
|
||||
AgdEvent->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -544,7 +544,7 @@ void Ann_HideActiveAnnouncement (void)
|
|||
/***** Set global announcement as hidden *****/
|
||||
DB_QueryUPDATE ("can not hide announcement",
|
||||
"UPDATE ann_announcements"
|
||||
" SET Status=%u"
|
||||
" SET Status=%u"
|
||||
" WHERE AnnCod=%ld",
|
||||
(unsigned) Ann_OBSOLETE_ANNOUNCEMENT,
|
||||
AnnCod);
|
||||
|
@ -564,7 +564,7 @@ void Ann_RevealHiddenAnnouncement (void)
|
|||
/***** Set global announcement as shown *****/
|
||||
DB_QueryUPDATE ("can not reveal announcement",
|
||||
"UPDATE ann_announcements"
|
||||
" SET Status=%u"
|
||||
" SET Status=%u"
|
||||
" WHERE AnnCod=%ld",
|
||||
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,
|
||||
AnnCod);
|
||||
|
|
|
@ -1129,7 +1129,7 @@ void Asg_HideAssignment (void)
|
|||
/***** Hide assignment *****/
|
||||
DB_QueryUPDATE ("can not hide assignment",
|
||||
"UPDATE asg_assignments"
|
||||
" SET Hidden='Y'"
|
||||
" SET Hidden='Y'"
|
||||
" WHERE AsgCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
Asg.AsgCod,
|
||||
|
@ -1166,7 +1166,7 @@ void Asg_ShowAssignment (void)
|
|||
/***** Hide assignment *****/
|
||||
DB_QueryUPDATE ("can not show assignment",
|
||||
"UPDATE asg_assignments"
|
||||
" SET Hidden='N'"
|
||||
" SET Hidden='N'"
|
||||
" WHERE AsgCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
Asg.AsgCod,
|
||||
|
@ -1588,7 +1588,7 @@ static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigne
|
|||
/***** Update number of users notified *****/
|
||||
DB_QueryUPDATE ("can not update the number of notifs. of an assignment",
|
||||
"UPDATE asg_ssignments"
|
||||
" SET NumNotif=NumNotif+%u"
|
||||
" SET NumNotif=NumNotif+%u"
|
||||
" WHERE AsgCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,
|
||||
AsgCod);
|
||||
|
@ -1633,11 +1633,11 @@ static void Asg_UpdateAssignment (struct Asg_Assignment *Asg,const char *Txt)
|
|||
/***** Update the data of the assignment *****/
|
||||
DB_QueryUPDATE ("can not update assignment",
|
||||
"UPDATE asg_assignments"
|
||||
" SET StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Title='%s',"
|
||||
"Folder='%s',"
|
||||
"Txt='%s'"
|
||||
" SET StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Title='%s',"
|
||||
"Folder='%s',"
|
||||
"Txt='%s'"
|
||||
" WHERE AsgCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
Asg->TimeUTC[Dat_START_TIME],
|
||||
|
|
|
@ -1005,9 +1005,12 @@ void Att_HideAttEvent (void)
|
|||
|
||||
/***** Hide attendance event *****/
|
||||
DB_QueryUPDATE ("can not hide attendance event",
|
||||
"UPDATE att_events SET Hidden='Y'"
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
Event.AttCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
"UPDATE att_events"
|
||||
" SET Hidden='Y'"
|
||||
" WHERE AttCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
Event.AttCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Show attendance events again *****/
|
||||
Att_SeeAttEvents ();
|
||||
|
@ -1030,9 +1033,12 @@ void Att_ShowAttEvent (void)
|
|||
|
||||
/***** Hide attendance event *****/
|
||||
DB_QueryUPDATE ("can not show attendance event",
|
||||
"UPDATE att_events SET Hidden='N'"
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
Event.AttCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
"UPDATE att_events"
|
||||
" SET Hidden='N'"
|
||||
" WHERE AttCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
Event.AttCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Show attendance events again *****/
|
||||
Att_SeeAttEvents ();
|
||||
|
@ -1418,21 +1424,25 @@ void Att_UpdateAttEvent (struct Att_Event *Event,const char *Description)
|
|||
{
|
||||
/***** Update the data of the attendance event *****/
|
||||
DB_QueryUPDATE ("can not update attendance event",
|
||||
"UPDATE att_events SET "
|
||||
"Hidden='%c',"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"CommentTchVisible='%c',Title='%s',Txt='%s'"
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
"UPDATE att_events"
|
||||
" SET Hidden='%c',"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"CommentTchVisible='%c',"
|
||||
"Title='%s',"
|
||||
"Txt='%s'"
|
||||
" WHERE AttCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
Event->Hidden ? 'Y' :
|
||||
'N',
|
||||
'N',
|
||||
Event->TimeUTC[Att_START_TIME],
|
||||
Event->TimeUTC[Att_END_TIME ],
|
||||
Event->CommentTchVisible ? 'Y' :
|
||||
'N',
|
||||
'N',
|
||||
Event->Title,
|
||||
Description,
|
||||
Event->AttCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
Event->AttCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Update groups *****/
|
||||
/* Remove old groups */
|
||||
|
|
|
@ -721,7 +721,9 @@ static void Bld_UpdateBuildingNameDB (long BldCod,const char *FieldName,const ch
|
|||
"UPDATE bld_buildings"
|
||||
" SET %s='%s'"
|
||||
" WHERE BldCod=%ld",
|
||||
FieldName,NewBuildingName,BldCod);
|
||||
FieldName,
|
||||
NewBuildingName,
|
||||
BldCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -151,7 +151,8 @@ void Cal_ChangeFirstDayOfWeek (void)
|
|||
/***** Store icon first day of week database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
DB_QueryUPDATE ("can not update your setting about first day of week",
|
||||
"UPDATE usr_data SET FirstDayOfWeek=%u"
|
||||
"UPDATE usr_data"
|
||||
" SET FirstDayOfWeek=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
|
|
@ -403,7 +403,8 @@ static void Cfe_UpdateNumUsrsNotifiedByEMailAboutCallForExam (long ExaCod,
|
|||
"UPDATE cfe_exams"
|
||||
" SET NumNotif=NumNotif+%u"
|
||||
" WHERE ExaCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,ExaCod);
|
||||
NumUsrsToBeNotifiedByEMail,
|
||||
ExaCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -497,7 +498,8 @@ void Cfe_RemoveCallForExam1 (void)
|
|||
" WHERE ExaCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
(unsigned) Cfe_DELETED_CALL_FOR_EXAM,
|
||||
ExaCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
ExaCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Mark possible notifications as removed *****/
|
||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_CALL_FOR_EXAM,ExaCod);
|
||||
|
@ -545,7 +547,8 @@ void Cfe_HideCallForExam (void)
|
|||
" WHERE ExaCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
(unsigned) Cfe_HIDDEN_CALL_FOR_EXAM,
|
||||
ExaCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
ExaCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Set exam to be highlighted *****/
|
||||
CallsForExams->HighlightExaCod = ExaCod;
|
||||
|
@ -576,7 +579,8 @@ void Cfe_UnhideCallForExam (void)
|
|||
" WHERE ExaCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
(unsigned) Cfe_VISIBLE_CALL_FOR_EXAM,
|
||||
ExaCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
ExaCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Set exam to be highlighted *****/
|
||||
CallsForExams->HighlightExaCod = ExaCod;
|
||||
|
|
|
@ -1298,8 +1298,11 @@ void Ctr_ChangeCtrPlc (void)
|
|||
void Ctr_UpdateCtrPlcDB (long CtrCod,long NewPlcCod)
|
||||
{
|
||||
DB_QueryUPDATE ("can not update the place of a center",
|
||||
"UPDATE ctr_centers SET PlcCod=%ld WHERE CtrCod=%ld",
|
||||
NewPlcCod,CtrCod);
|
||||
"UPDATE ctr_centers"
|
||||
" SET PlcCod=%ld"
|
||||
" WHERE CtrCod=%ld",
|
||||
NewPlcCod,
|
||||
CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1428,8 +1431,12 @@ static void Ctr_UpdateInsNameDB (long CtrCod,const char *FieldName,const char *N
|
|||
{
|
||||
/***** Update center changing old name by new name */
|
||||
DB_QueryUPDATE ("can not update the name of a center",
|
||||
"UPDATE ctr_centers SET %s='%s' WHERE CtrCod=%ld",
|
||||
FieldName,NewCtrName,CtrCod);
|
||||
"UPDATE ctr_centers"
|
||||
" SET %s='%s'"
|
||||
" WHERE CtrCod=%ld",
|
||||
FieldName,
|
||||
NewCtrName,
|
||||
CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1478,8 +1485,11 @@ void Ctr_UpdateCtrWWWDB (long CtrCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
|||
{
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
DB_QueryUPDATE ("can not update the web of a center",
|
||||
"UPDATE ctr_centers SET WWW='%s' WHERE CtrCod=%ld",
|
||||
NewWWW,CtrCod);
|
||||
"UPDATE ctr_centers"
|
||||
" SET WWW='%s'"
|
||||
" WHERE CtrCod=%ld",
|
||||
NewWWW,
|
||||
CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1514,8 +1524,11 @@ void Ctr_ChangeCtrStatus (void)
|
|||
|
||||
/***** Update status in table of centers *****/
|
||||
DB_QueryUPDATE ("can not update the status of a center",
|
||||
"UPDATE ctr_centers SET Status=%u WHERE CtrCod=%ld",
|
||||
(unsigned) Status,Ctr_EditingCtr->CtrCod);
|
||||
"UPDATE ctr_centers"
|
||||
" SET Status=%u"
|
||||
" WHERE CtrCod=%ld",
|
||||
(unsigned) Status,
|
||||
Ctr_EditingCtr->CtrCod);
|
||||
Ctr_EditingCtr->Status = Status;
|
||||
|
||||
/***** Write message to show the change made
|
||||
|
|
|
@ -1005,9 +1005,11 @@ void CtrCfg_ChangeCtrPhotoAttr (void)
|
|||
/***** Update the table changing old attribution by new attribution *****/
|
||||
DB_QueryUPDATE ("can not update the photo attribution"
|
||||
" of the current center",
|
||||
"UPDATE ctr_centers SET PhotoAttribution='%s'"
|
||||
"UPDATE ctr_centers"
|
||||
" SET PhotoAttribution='%s'"
|
||||
" WHERE CtrCod=%ld",
|
||||
NewPhotoAttribution,Gbl.Hierarchy.Ctr.CtrCod);
|
||||
NewPhotoAttribution,
|
||||
Gbl.Hierarchy.Ctr.CtrCod);
|
||||
|
||||
/***** Show the center information again *****/
|
||||
CtrCfg_ShowConfiguration ();
|
||||
|
@ -1075,8 +1077,11 @@ static void CtrCfg_UpdateCtrInsDB (long CtrCod,long InsCod)
|
|||
{
|
||||
/***** Update institution in table of centers *****/
|
||||
DB_QueryUPDATE ("can not update the institution of a center",
|
||||
"UPDATE ctr_centers SET InsCod=%ld WHERE CtrCod=%ld",
|
||||
InsCod,CtrCod);
|
||||
"UPDATE ctr_centers"
|
||||
" SET InsCod=%ld"
|
||||
" WHERE CtrCod=%ld",
|
||||
InsCod,
|
||||
CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1189,8 +1194,12 @@ static void CtrCfg_UpdateCtrCoordinateDB (long CtrCod,
|
|||
/***** Update database changing old coordinate by new coordinate *****/
|
||||
Str_SetDecimalPointToUS (); // To write the decimal point as a dot
|
||||
DB_QueryUPDATE ("can not update a coordinate of a center",
|
||||
"UPDATE ctr_centers SET %s='%.15lg' WHERE CtrCod=%ld",
|
||||
CoordField,NewCoord,CtrCod);
|
||||
"UPDATE ctr_centers"
|
||||
" SET %s='%.15lg'"
|
||||
" WHERE CtrCod=%ld",
|
||||
CoordField,
|
||||
NewCoord,
|
||||
CtrCod);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
}
|
||||
|
||||
|
|
|
@ -600,13 +600,14 @@ TODO: Salvador Romero Cort
|
|||
|
||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.65.1 (2021-04-17)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.66 (2021-04-17)"
|
||||
#define CSS_FILE "swad20.45.css"
|
||||
#define JS_FILE "swad20.6.2.js"
|
||||
/*
|
||||
TODO: Rename CENTRE to CENTER in help wiki.
|
||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||
|
||||
Version 20.66: Apr 17, 2021 Code refactoring in database updates. (308972 lines)
|
||||
Version 20.65.1: Apr 17, 2021 Code refactoring in database replaces. (308677 lines)
|
||||
Version 20.65: Apr 17, 2021 Code refactoring in database inserts. (308629 lines)
|
||||
Version 20.64.1: Apr 17, 2021 Optimizations in database selects. (308523 lines)
|
||||
|
|
|
@ -121,7 +121,8 @@ void Coo_ChangeMyPrefsCookies (void)
|
|||
/***** Store preference in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
DB_QueryUPDATE ("can not update your preference about cookies",
|
||||
"UPDATE usr_data SET ThirdPartyCookies='%c'"
|
||||
"UPDATE usr_data"
|
||||
" SET ThirdPartyCookies='%c'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies ? 'Y' :
|
||||
'N',
|
||||
|
|
|
@ -1499,7 +1499,7 @@ static void Cty_UpdateCtyNameDB (long CtyCod,const char *FieldName,const char *N
|
|||
/***** Update country changing old name by new name */
|
||||
DB_QueryUPDATE ("can not update the name of a country",
|
||||
"UPDATE cty_countrs"
|
||||
" SET %s='%s'"
|
||||
" SET %s='%s'"
|
||||
" WHERE CtyCod='%03ld'",
|
||||
FieldName,NewCtyName,
|
||||
CtyCod);
|
||||
|
@ -1537,9 +1537,10 @@ void Cty_ChangeCtyWWW (void)
|
|||
/***** Update the table changing old WWW by new WWW *****/
|
||||
DB_QueryUPDATE ("can not update the web of a country",
|
||||
"UPDATE cty_countrs"
|
||||
" SET WWW_%s='%s'"
|
||||
" SET WWW_%s='%s'"
|
||||
" WHERE CtyCod='%03ld'",
|
||||
Lan_STR_LANG_ID[Language],NewWWW,Cty_EditingCty->CtyCod);
|
||||
Lan_STR_LANG_ID[Language],NewWWW,
|
||||
Cty_EditingCty->CtyCod);
|
||||
Str_Copy (Cty_EditingCty->WWW[Language],NewWWW,
|
||||
sizeof (Cty_EditingCty->WWW[Language]) - 1);
|
||||
|
||||
|
|
|
@ -630,9 +630,10 @@ void CtyCfg_ChangeCtyMapAttr (void)
|
|||
/***** Update the table changing old attribution by new attribution *****/
|
||||
DB_QueryUPDATE ("can not update the map attribution of a country",
|
||||
"UPDATE cty_countrs"
|
||||
" SET MapAttribution='%s'"
|
||||
" SET MapAttribution='%s'"
|
||||
" WHERE CtyCod='%03ld'",
|
||||
NewMapAttribution,Gbl.Hierarchy.Cty.CtyCod);
|
||||
NewMapAttribution,
|
||||
Gbl.Hierarchy.Cty.CtyCod);
|
||||
|
||||
/***** Show the country information again *****/
|
||||
CtyCfg_ShowConfiguration ();
|
||||
|
|
|
@ -1961,7 +1961,8 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
"UPDATE cfe_exams"
|
||||
" SET Status=%u"
|
||||
" WHERE CrsCod=%ld",
|
||||
(unsigned) Cfe_DELETED_CALL_FOR_EXAM,CrsCod);
|
||||
(unsigned) Cfe_DELETED_CALL_FOR_EXAM,
|
||||
CrsCod);
|
||||
|
||||
/***** Remove course cards of the course *****/
|
||||
/* Remove content of course cards */
|
||||
|
@ -2197,8 +2198,11 @@ void Crs_UpdateCrsYear (struct Crs_Course *Crs,unsigned NewYear)
|
|||
{
|
||||
/***** Update year/semester in table of courses *****/
|
||||
DB_QueryUPDATE ("can not update the year of a course",
|
||||
"UPDATE crs_courses SET Year=%u WHERE CrsCod=%ld",
|
||||
NewYear,Crs->CrsCod);
|
||||
"UPDATE crs_courses"
|
||||
" SET Year=%u"
|
||||
" WHERE CrsCod=%ld",
|
||||
NewYear,
|
||||
Crs->CrsCod);
|
||||
|
||||
/***** Copy course year/semester *****/
|
||||
Crs->Year = NewYear;
|
||||
|
@ -2213,8 +2217,11 @@ void Crs_UpdateInstitutionalCrsCod (struct Crs_Course *Crs,const char *NewInstit
|
|||
/***** Update institutional course code in table of courses *****/
|
||||
DB_QueryUPDATE ("can not update the institutional code"
|
||||
" of the current course",
|
||||
"UPDATE crs_courses SET InsCrsCod='%s' WHERE CrsCod=%ld",
|
||||
NewInstitutionalCrsCod,Crs->CrsCod);
|
||||
"UPDATE crs_courses"
|
||||
" SET InsCrsCod='%s'"
|
||||
" WHERE CrsCod=%ld",
|
||||
NewInstitutionalCrsCod,
|
||||
Crs->CrsCod);
|
||||
|
||||
/***** Copy institutional course code *****/
|
||||
Str_Copy (Crs->InstitutionalCrsCod,NewInstitutionalCrsCod,
|
||||
|
@ -2355,8 +2362,11 @@ static void Crs_UpdateCrsNameDB (long CrsCod,const char *FieldName,const char *N
|
|||
{
|
||||
/***** Update course changing old name by new name *****/
|
||||
DB_QueryUPDATE ("can not update the name of a course",
|
||||
"UPDATE crs_courses SET %s='%s' WHERE CrsCod=%ld",
|
||||
FieldName,NewCrsName,CrsCod);
|
||||
"UPDATE crs_courses"
|
||||
" SET %s='%s'"
|
||||
" WHERE CrsCod=%ld",
|
||||
FieldName,NewCrsName,
|
||||
CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2392,8 +2402,11 @@ void Crs_ChangeCrsStatus (void)
|
|||
|
||||
/***** Update status in table of courses *****/
|
||||
DB_QueryUPDATE ("can not update the status of a course",
|
||||
"UPDATE crs_courses SET Status=%u WHERE CrsCod=%ld",
|
||||
(unsigned) Status,Crs_EditingCrs->CrsCod);
|
||||
"UPDATE crs_courses"
|
||||
" SET Status=%u"
|
||||
" WHERE CrsCod=%ld",
|
||||
(unsigned) Status,
|
||||
Crs_EditingCrs->CrsCod);
|
||||
Crs_EditingCrs->Status = Status;
|
||||
|
||||
/***** Create alert to show the change made *****/
|
||||
|
@ -2914,10 +2927,12 @@ void Crs_UpdateCrsLast (void)
|
|||
if (Gbl.Hierarchy.Level == Hie_Lvl_CRS && // Course selected
|
||||
Gbl.Usrs.Me.Role.Logged >= Rol_STD)
|
||||
/***** Update my last access to current course *****/
|
||||
DB_QueryUPDATE ("can not update last access to current course",
|
||||
"REPLACE INTO crs_last (CrsCod,LastTime)"
|
||||
" VALUES (%ld,NOW())",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
DB_QueryREPLACE ("can not update last access to current course",
|
||||
"REPLACE INTO crs_last"
|
||||
" (CrsCod,LastTime)"
|
||||
" VALUES"
|
||||
" (%ld,NOW())",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -521,8 +521,11 @@ static void CrsCfg_UpdateCrsDegDB (long CrsCod,long DegCod)
|
|||
{
|
||||
/***** Update degree in table of courses *****/
|
||||
DB_QueryUPDATE ("can not move course to another degree",
|
||||
"UPDATE crs_courses SET DegCod=%ld WHERE CrsCod=%ld",
|
||||
DegCod,CrsCod);
|
||||
"UPDATE crs_courses"
|
||||
" SET DegCod=%ld"
|
||||
" WHERE CrsCod=%ld",
|
||||
DegCod,
|
||||
CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -205,7 +205,8 @@ void Dat_ChangeDateFormat (void)
|
|||
/***** Store date format in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
DB_QueryUPDATE ("can not update your setting about date format",
|
||||
"UPDATE usr_data SET DateFormat=%u"
|
||||
"UPDATE usr_data"
|
||||
" SET DateFormat=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
(unsigned) Gbl.Prefs.DateFormat,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
|
|
@ -1677,8 +1677,12 @@ static void Deg_UpdateDegNameDB (long DegCod,const char *FieldName,const char *N
|
|||
{
|
||||
/***** Update degree changing old name by new name *****/
|
||||
DB_QueryUPDATE ("can not update the name of a degree",
|
||||
"UPDATE deg_degrees SET %s='%s' WHERE DegCod=%ld",
|
||||
FieldName,NewDegName,DegCod);
|
||||
"UPDATE deg_degrees"
|
||||
" SET %s='%s'"
|
||||
" WHERE DegCod=%ld",
|
||||
FieldName,
|
||||
NewDegName,
|
||||
DegCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1705,8 +1709,11 @@ void Deg_ChangeDegreeType (void)
|
|||
|
||||
/***** Update the table of degrees changing old type by new type *****/
|
||||
DB_QueryUPDATE ("can not update the type of a degree",
|
||||
"UPDATE deg_degrees SET DegTypCod=%ld WHERE DegCod=%ld",
|
||||
NewDegTypCod,Deg_EditingDeg->DegCod);
|
||||
"UPDATE deg_degrees"
|
||||
" SET DegTypCod=%ld"
|
||||
" WHERE DegCod=%ld",
|
||||
NewDegTypCod,
|
||||
Deg_EditingDeg->DegCod);
|
||||
Deg_EditingDeg->DegTypCod = NewDegTypCod;
|
||||
|
||||
/***** Create alert to show the change made
|
||||
|
@ -1763,8 +1770,11 @@ void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
|||
{
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
DB_QueryUPDATE ("can not update the web of a degree",
|
||||
"UPDATE deg_degrees SET WWW='%s' WHERE DegCod=%ld",
|
||||
NewWWW,DegCod);
|
||||
"UPDATE deg_degrees"
|
||||
" SET WWW='%s'"
|
||||
" WHERE DegCod=%ld",
|
||||
NewWWW,
|
||||
DegCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1800,8 +1810,11 @@ void Deg_ChangeDegStatus (void)
|
|||
|
||||
/***** Update status in table of degrees *****/
|
||||
DB_QueryUPDATE ("can not update the status of a degree",
|
||||
"UPDATE deg_degrees SET Status=%u WHERE DegCod=%ld",
|
||||
(unsigned) Status,Deg_EditingDeg->DegCod);
|
||||
"UPDATE deg_degrees"
|
||||
" SET Status=%u"
|
||||
" WHERE DegCod=%ld",
|
||||
(unsigned) Status,
|
||||
Deg_EditingDeg->DegCod);
|
||||
Deg_EditingDeg->Status = Status;
|
||||
|
||||
/***** Write alert to show the change made
|
||||
|
|
|
@ -404,8 +404,11 @@ static void DegCfg_UpdateDegCtrDB (long DegCod,long CtrCod)
|
|||
{
|
||||
/***** Update center in table of degrees *****/
|
||||
DB_QueryUPDATE ("can not update the center of a degree",
|
||||
"UPDATE deg_degrees SET CtrCod=%ld WHERE DegCod=%ld",
|
||||
CtrCod,DegCod);
|
||||
"UPDATE deg_degrees"
|
||||
" SET CtrCod=%ld"
|
||||
" WHERE DegCod=%ld",
|
||||
CtrCod,
|
||||
DegCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -978,9 +978,11 @@ void DT_RenameDegreeType (void)
|
|||
{
|
||||
/* Update the table changing old name by new name */
|
||||
DB_QueryUPDATE ("can not update the type of a degree",
|
||||
"UPDATE deg_types SET DegTypName='%s'"
|
||||
"UPDATE deg_types"
|
||||
" SET DegTypName='%s'"
|
||||
" WHERE DegTypCod=%ld",
|
||||
NewNameDegTyp,DT_EditingDegTyp->DegTypCod);
|
||||
NewNameDegTyp,
|
||||
DT_EditingDegTyp->DegTypCod);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
|
|
|
@ -569,16 +569,21 @@ void Enr_UpdateUsrData (struct UsrData *UsrDat)
|
|||
Usr_CreateBirthdayStrDB (UsrDat,BirthdayStrDB); // It can include start and ending apostrophes
|
||||
DB_QueryUPDATE ("can not update user's data",
|
||||
"UPDATE usr_data"
|
||||
" SET Password='%s',"
|
||||
"Surname1='%s',Surname2='%s',FirstName='%s',Sex='%s',"
|
||||
"CtyCod=%ld,"
|
||||
"LocalPhone='%s',"
|
||||
"FamilyPhone='%s',"
|
||||
"Birthday=%s,"
|
||||
"Comments='%s'"
|
||||
" SET Password='%s',"
|
||||
"Surname1='%s',"
|
||||
"Surname2='%s',"
|
||||
"FirstName='%s',"
|
||||
"Sex='%s',"
|
||||
"CtyCod=%ld,"
|
||||
"LocalPhone='%s',"
|
||||
"FamilyPhone='%s',"
|
||||
"Birthday=%s,"
|
||||
"Comments='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrDat->Password,
|
||||
UsrDat->Surname1,UsrDat->Surname2,UsrDat->FrstName,
|
||||
UsrDat->Surname1,
|
||||
UsrDat->Surname2,
|
||||
UsrDat->FrstName,
|
||||
Usr_StringsSexDB[UsrDat->Sex],
|
||||
UsrDat->CtyCod,
|
||||
UsrDat->Phone[0],
|
||||
|
@ -611,7 +616,10 @@ void Enr_UpdateInstitutionCenterDepartment (void)
|
|||
{
|
||||
DB_QueryUPDATE ("can not update institution, center and department",
|
||||
"UPDATE usr_data"
|
||||
" SET InsCtyCod=%ld,InsCod=%ld,CtrCod=%ld,DptCod=%ld"
|
||||
" SET InsCtyCod=%ld,"
|
||||
"InsCod=%ld,"
|
||||
"CtrCod=%ld,"
|
||||
"DptCod=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.InsCtyCod,
|
||||
Gbl.Usrs.Me.UsrDat.InsCod,
|
||||
|
@ -4109,7 +4117,8 @@ void Enr_AcceptUsrInCrs (long UsrCod)
|
|||
" SET Accepted='Y'"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
Gbl.Hierarchy.Crs.CrsCod,UsrCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
18
swad_exam.c
18
swad_exam.c
|
@ -1313,7 +1313,9 @@ void Exa_HideExam (void)
|
|||
|
||||
/***** Hide exam *****/
|
||||
DB_QueryUPDATE ("can not hide exam",
|
||||
"UPDATE exa_exams SET Hidden='Y' WHERE ExaCod=%ld",
|
||||
"UPDATE exa_exams"
|
||||
" SET Hidden='Y'"
|
||||
" WHERE ExaCod=%ld",
|
||||
Exam.ExaCod);
|
||||
|
||||
/***** Show exams again *****/
|
||||
|
@ -1349,7 +1351,9 @@ void Exa_UnhideExam (void)
|
|||
|
||||
/***** Unhide exam *****/
|
||||
DB_QueryUPDATE ("can not unhide exam",
|
||||
"UPDATE exa_exams SET Hidden='N' WHERE ExaCod=%ld",
|
||||
"UPDATE exa_exams"
|
||||
" SET Hidden='N'"
|
||||
" WHERE ExaCod=%ld",
|
||||
Exam.ExaCod);
|
||||
|
||||
/***** Show exams again *****/
|
||||
|
@ -1697,11 +1701,11 @@ static void Exa_UpdateExam (struct Exa_Exam *Exam,const char *Txt)
|
|||
Str_SetDecimalPointToUS (); // To write the decimal point as a dot
|
||||
DB_QueryUPDATE ("can not update exam",
|
||||
"UPDATE exa_exams"
|
||||
" SET CrsCod=%ld,"
|
||||
"MaxGrade=%.15lg,"
|
||||
"Visibility=%u,"
|
||||
"Title='%s',"
|
||||
"Txt='%s'"
|
||||
" SET CrsCod=%ld,"
|
||||
"MaxGrade=%.15lg,"
|
||||
"Visibility=%u,"
|
||||
"Title='%s',"
|
||||
"Txt='%s'"
|
||||
" WHERE ExaCod=%ld",
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Exam->MaxGrade,
|
||||
|
|
|
@ -1526,13 +1526,15 @@ static void ExaPrn_UpdatePrintInDB (const struct ExaPrn_Print *Print)
|
|||
"Sent='%c',"
|
||||
"Score='%.15lg'"
|
||||
" WHERE PrnCod=%ld"
|
||||
" AND SesCod=%ld AND UsrCod=%ld", // Extra checks
|
||||
" AND SesCod=%ld"
|
||||
" AND UsrCod=%ld", // Extra checks
|
||||
Print->NumQsts.NotBlank,
|
||||
Print->Sent ? 'Y' :
|
||||
'N',
|
||||
Print->Score,
|
||||
Print->PrnCod,
|
||||
Print->SesCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
Print->SesCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
}
|
||||
|
||||
|
|
|
@ -825,12 +825,13 @@ void ExaSes_ToggleVisResultsSesUsr (void)
|
|||
/***** Toggle visibility of exam session results *****/
|
||||
Session.ShowUsrResults = !Session.ShowUsrResults;
|
||||
DB_QueryUPDATE ("can not toggle visibility of session results",
|
||||
"UPDATE exa_sessions,exa_exams"
|
||||
" SET exa_sessions.ShowUsrResults='%c'"
|
||||
"UPDATE exa_sessions,"
|
||||
"exa_exams"
|
||||
" SET exa_sessions.ShowUsrResults='%c'"
|
||||
" WHERE exa_sessions.SesCod=%ld"
|
||||
" AND exa_sessions.ExaCod=%ld" // Extra check
|
||||
" AND exa_sessions.ExaCod=exa_exams.ExaCod"
|
||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||
" AND exa_sessions.ExaCod=%ld" // Extra check
|
||||
" AND exa_sessions.ExaCod=exa_exams.ExaCod"
|
||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||
Session.ShowUsrResults ? 'Y' :
|
||||
'N',
|
||||
Session.SesCod,
|
||||
|
@ -1141,12 +1142,13 @@ void ExaSes_HideSession (void)
|
|||
|
||||
/***** Hide session *****/
|
||||
DB_QueryUPDATE ("can not hide exam sessions",
|
||||
"UPDATE exa_sessions,exa_exams"
|
||||
" SET exa_sessions.Hidden='Y'"
|
||||
"UPDATE exa_sessions,"
|
||||
"exa_exams"
|
||||
" SET exa_sessions.Hidden='Y'"
|
||||
" WHERE exa_sessions.SesCod=%ld"
|
||||
" AND exa_sessions.ExaCod=%ld" // Extra check
|
||||
" AND exa_sessions.ExaCod=exa_exams.ExaCod"
|
||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||
" AND exa_sessions.ExaCod=%ld" // Extra check
|
||||
" AND exa_sessions.ExaCod=exa_exams.ExaCod"
|
||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||
Session.SesCod,
|
||||
Session.ExaCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
@ -1180,12 +1182,13 @@ void ExaSes_UnhideSession (void)
|
|||
|
||||
/***** Unhide session *****/
|
||||
DB_QueryUPDATE ("can not unhide exam session",
|
||||
"UPDATE exa_sessions,exa_exams"
|
||||
" SET exa_sessions.Hidden='N'"
|
||||
"UPDATE exa_sessions,"
|
||||
"exa_exams"
|
||||
" SET exa_sessions.Hidden='N'"
|
||||
" WHERE exa_sessions.SesCod=%ld"
|
||||
" AND exa_sessions.ExaCod=%ld" // Extra check
|
||||
" AND exa_sessions.ExaCod=exa_exams.ExaCod"
|
||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||
" AND exa_sessions.ExaCod=%ld" // Extra check
|
||||
" AND exa_sessions.ExaCod=exa_exams.ExaCod"
|
||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||
Session.SesCod,
|
||||
Session.ExaCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
@ -1587,16 +1590,17 @@ static void ExaSes_UpdateSession (struct ExaSes_Session *Session)
|
|||
{
|
||||
/***** Insert this new exam session into database *****/
|
||||
DB_QueryUPDATE ("can not update exam session",
|
||||
"UPDATE exa_sessions,exa_exams"
|
||||
" SET exa_sessions.Hidden='%c',"
|
||||
"exa_sessions.StartTime=FROM_UNIXTIME(%ld),"
|
||||
"exa_sessions.EndTime=FROM_UNIXTIME(%ld),"
|
||||
"exa_sessions.Title='%s',"
|
||||
"exa_sessions.ShowUsrResults='%c'"
|
||||
"UPDATE exa_sessions,"
|
||||
"exa_exams"
|
||||
" SET exa_sessions.Hidden='%c',"
|
||||
"exa_sessions.StartTime=FROM_UNIXTIME(%ld),"
|
||||
"exa_sessions.EndTime=FROM_UNIXTIME(%ld),"
|
||||
"exa_sessions.Title='%s',"
|
||||
"exa_sessions.ShowUsrResults='%c'"
|
||||
" WHERE exa_sessions.SesCod=%ld"
|
||||
" AND exa_sessions.ExaCod=%ld" // Extra check
|
||||
" AND exa_sessions.ExaCod=exa_exams.ExaCod"
|
||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||
" AND exa_sessions.ExaCod=%ld" // Extra check
|
||||
" AND exa_sessions.ExaCod=exa_exams.ExaCod"
|
||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||
Session->Hidden ? 'Y' :
|
||||
'N',
|
||||
Session->TimeUTC[Dat_START_TIME], // Start time
|
||||
|
|
|
@ -572,10 +572,10 @@ static void ExaSet_UpdateSet (const struct ExaSet_Set *Set)
|
|||
/***** Update the data of the set of questions *****/
|
||||
DB_QueryUPDATE ("can not update set of questions",
|
||||
"UPDATE exa_sets"
|
||||
" SET ExaCod=%ld,"
|
||||
"SetInd=%u,"
|
||||
"NumQstsToPrint=%u,"
|
||||
"Title='%s'"
|
||||
" SET ExaCod=%ld,"
|
||||
"SetInd=%u,"
|
||||
"NumQstsToPrint=%u,"
|
||||
"Title='%s'"
|
||||
" WHERE SetCod=%ld",
|
||||
Set->ExaCod,
|
||||
Set->SetInd,
|
||||
|
@ -596,11 +596,13 @@ static void ExaSet_UpdateSetTitleDB (const struct ExaSet_Set *Set,
|
|||
{
|
||||
/***** Update set of questions changing old title by new title *****/
|
||||
DB_QueryUPDATE ("can not update the title of a set of questions",
|
||||
"UPDATE exa_sets SET Title='%s'"
|
||||
"UPDATE exa_sets"
|
||||
" SET Title='%s'"
|
||||
" WHERE SetCod=%ld"
|
||||
" AND ExaCod=%ld", // Extra check
|
||||
" AND ExaCod=%ld", // Extra check
|
||||
NewTitle,
|
||||
Set->SetCod,Set->ExaCod);
|
||||
Set->SetCod,
|
||||
Set->ExaCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -612,11 +614,13 @@ static void ExaSet_UpdateNumQstsToExamDB (const struct ExaSet_Set *Set,
|
|||
{
|
||||
/***** Update set of questions changing old number by new number *****/
|
||||
DB_QueryUPDATE ("can not update the number of questions to appear in exam print",
|
||||
"UPDATE exa_sets SET NumQstsToPrint=%u"
|
||||
"UPDATE exa_sets"
|
||||
" SET NumQstsToPrint=%u"
|
||||
" WHERE SetCod=%ld"
|
||||
" AND ExaCod=%ld", // Extra check
|
||||
" AND ExaCod=%ld", // Extra check
|
||||
NumQstsToPrint,
|
||||
Set->SetCod,Set->ExaCod);
|
||||
Set->SetCod,
|
||||
Set->ExaCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1809,9 +1813,12 @@ void ExaSet_RemoveSet (void)
|
|||
|
||||
/* Change index of sets greater than this */
|
||||
DB_QueryUPDATE ("can not update indexes of sets",
|
||||
"UPDATE exa_sets SET SetInd=SetInd-1"
|
||||
" WHERE ExaCod=%ld AND SetInd>%u",
|
||||
Set.ExaCod,Set.SetInd);
|
||||
"UPDATE exa_sets"
|
||||
" SET SetInd=SetInd-1"
|
||||
" WHERE ExaCod=%ld"
|
||||
" AND SetInd>%u",
|
||||
Set.ExaCod,
|
||||
Set.SetInd);
|
||||
|
||||
/***** Write message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Set_of_questions_removed);
|
||||
|
@ -2098,14 +2105,15 @@ static void ExaSet_ChangeValidityQst (Tst_Validity_t Validity)
|
|||
|
||||
/***** Validate question *****/
|
||||
DB_QueryUPDATE ("can not validate question",
|
||||
"UPDATE exa_set_questions,exa_sets,exa_exams"
|
||||
" SET exa_set_questions.Invalid='%c'"
|
||||
"UPDATE exa_set_questions,"
|
||||
"exa_sets,exa_exams"
|
||||
" SET exa_set_questions.Invalid='%c'"
|
||||
" WHERE exa_set_questions.QstCod=%ld"
|
||||
" AND exa_set_questions.SetCod=%ld" // Extra check
|
||||
" AND exa_set_questions.SetCod=exa_sets.SetCod"
|
||||
" AND exa_sets.ExaCod=%ld" // Extra check
|
||||
" AND exa_sets.ExaCod=exa_exams.ExaCod"
|
||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||
" AND exa_set_questions.SetCod=%ld" // Extra check
|
||||
" AND exa_set_questions.SetCod=exa_sets.SetCod"
|
||||
" AND exa_sets.ExaCod=%ld" // Extra check
|
||||
" AND exa_sets.ExaCod=exa_exams.ExaCod"
|
||||
" AND exa_exams.CrsCod=%ld", // Extra check
|
||||
CharInvalid[Validity],
|
||||
QstCod,
|
||||
Set.SetCod,
|
||||
|
@ -2204,24 +2212,33 @@ static void ExaSet_ExchangeSets (long ExaCod,
|
|||
/* Step 1: change temporarily top index to minus bottom index
|
||||
in order to not repeat unique index (ExaCod,SetInd) */
|
||||
DB_QueryUPDATE ("can not exchange indexes of sets",
|
||||
"UPDATE exa_sets SET SetInd=-%u"
|
||||
" WHERE ExaCod=%ld AND SetCod=%ld",
|
||||
"UPDATE exa_sets"
|
||||
" SET SetInd=-%u"
|
||||
" WHERE ExaCod=%ld"
|
||||
" AND SetCod=%ld",
|
||||
SetIndBottom,
|
||||
ExaCod,SetCodTop);
|
||||
ExaCod,
|
||||
SetCodTop);
|
||||
|
||||
/* Step 2: change bottom index to old top index */
|
||||
DB_QueryUPDATE ("can not exchange indexes of sets",
|
||||
"UPDATE exa_sets SET SetInd=%u"
|
||||
" WHERE ExaCod=%ld AND SetCod=%ld",
|
||||
"UPDATE exa_sets"
|
||||
" SET SetInd=%u"
|
||||
" WHERE ExaCod=%ld"
|
||||
" AND SetCod=%ld",
|
||||
SetIndTop,
|
||||
ExaCod,SetCodBottom);
|
||||
ExaCod,
|
||||
SetCodBottom);
|
||||
|
||||
/* Step 3: change top index to old bottom index */
|
||||
DB_QueryUPDATE ("can not exchange indexes of sets",
|
||||
"UPDATE exa_sets SET SetInd=%u"
|
||||
" WHERE ExaCod=%ld AND SetCod=%ld",
|
||||
"UPDATE exa_sets"
|
||||
" SET SetInd=%u"
|
||||
" WHERE ExaCod=%ld"
|
||||
" AND SetCod=%ld",
|
||||
SetIndBottom,
|
||||
ExaCod,SetCodTop);
|
||||
ExaCod,
|
||||
SetCodTop);
|
||||
|
||||
/***** Unlock table *****/
|
||||
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
||||
|
|
|
@ -4223,7 +4223,8 @@ static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumU
|
|||
"UPDATE for_posts"
|
||||
" SET NumNotif=NumNotif+%u"
|
||||
" WHERE PstCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,PstCod);
|
||||
NumUsrsToBeNotifiedByEMail,
|
||||
PstCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
72
swad_game.c
72
swad_game.c
|
@ -1278,7 +1278,9 @@ void Gam_HideGame (void)
|
|||
|
||||
/***** Hide game *****/
|
||||
DB_QueryUPDATE ("can not hide game",
|
||||
"UPDATE gam_games SET Hidden='Y' WHERE GamCod=%ld",
|
||||
"UPDATE gam_games"
|
||||
" SET Hidden='Y'"
|
||||
" WHERE GamCod=%ld",
|
||||
Game.GamCod);
|
||||
|
||||
/***** Show games again *****/
|
||||
|
@ -1311,7 +1313,9 @@ void Gam_UnhideGame (void)
|
|||
|
||||
/***** Show game *****/
|
||||
DB_QueryUPDATE ("can not show game",
|
||||
"UPDATE gam_games SET Hidden='N' WHERE GamCod=%ld",
|
||||
"UPDATE gam_games"
|
||||
" SET Hidden='N'"
|
||||
" WHERE GamCod=%ld",
|
||||
Game.GamCod);
|
||||
|
||||
/***** Show games again *****/
|
||||
|
@ -1680,11 +1684,11 @@ static void Gam_UpdateGame (struct Gam_Game *Game,const char *Txt)
|
|||
Str_SetDecimalPointToUS (); // To write the decimal point as a dot
|
||||
DB_QueryUPDATE ("can not update game",
|
||||
"UPDATE gam_games"
|
||||
" SET CrsCod=%ld,"
|
||||
"MaxGrade=%.15lg,"
|
||||
"Visibility=%u,"
|
||||
"Title='%s',"
|
||||
"Txt='%s'"
|
||||
" SET CrsCod=%ld,"
|
||||
"MaxGrade=%.15lg,"
|
||||
"Visibility=%u,"
|
||||
"Title='%s',"
|
||||
"Txt='%s'"
|
||||
" WHERE GamCod=%ld",
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Game->MaxGrade,
|
||||
|
@ -2335,23 +2339,30 @@ void Gam_RemoveQstFromGame (void)
|
|||
/* Remove the question itself */
|
||||
DB_QueryDELETE ("can not remove a question",
|
||||
"DELETE FROM gam_questions"
|
||||
" WHERE GamCod=%ld AND QstInd=%u",
|
||||
Game.GamCod,QstInd);
|
||||
" WHERE GamCod=%ld"
|
||||
" AND QstInd=%u",
|
||||
Game.GamCod,
|
||||
QstInd);
|
||||
if (!mysql_affected_rows (&Gbl.mysql))
|
||||
Lay_ShowErrorAndExit ("The question to be removed does not exist.");
|
||||
|
||||
/* Change index of questions greater than this */
|
||||
DB_QueryUPDATE ("can not update indexes of questions in table of answers",
|
||||
"UPDATE mch_answers,mch_matches"
|
||||
" SET mch_answers.QstInd=mch_answers.QstInd-1"
|
||||
"UPDATE mch_answers,"
|
||||
"mch_matches"
|
||||
" SET mch_answers.QstInd=mch_answers.QstInd-1"
|
||||
" WHERE mch_matches.GamCod=%ld"
|
||||
" AND mch_matches.MchCod=mch_answers.MchCod"
|
||||
" AND mch_answers.QstInd>%u",
|
||||
Game.GamCod,QstInd);
|
||||
" AND mch_matches.MchCod=mch_answers.MchCod"
|
||||
" AND mch_answers.QstInd>%u",
|
||||
Game.GamCod,
|
||||
QstInd);
|
||||
DB_QueryUPDATE ("can not update indexes of questions",
|
||||
"UPDATE gam_questions SET QstInd=QstInd-1"
|
||||
" WHERE GamCod=%ld AND QstInd>%u",
|
||||
Game.GamCod,QstInd);
|
||||
"UPDATE gam_questions"
|
||||
" SET QstInd=QstInd-1"
|
||||
" WHERE GamCod=%ld"
|
||||
" AND QstInd>%u",
|
||||
Game.GamCod,
|
||||
QstInd);
|
||||
|
||||
/***** Write message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
|
||||
|
@ -2502,24 +2513,33 @@ static void Gam_ExchangeQuestions (long GamCod,
|
|||
/* Step 1: change temporarily top index to minus bottom index
|
||||
in order to not repeat unique index (GamCod,QstInd) */
|
||||
DB_QueryUPDATE ("can not exchange indexes of questions",
|
||||
"UPDATE gam_questions SET QstInd=-%u"
|
||||
" WHERE GamCod=%ld AND QstCod=%ld",
|
||||
"UPDATE gam_questions"
|
||||
" SET QstInd=-%u"
|
||||
" WHERE GamCod=%ld"
|
||||
" AND QstCod=%ld",
|
||||
QstIndBottom,
|
||||
GamCod,QstCodTop);
|
||||
GamCod,
|
||||
QstCodTop);
|
||||
|
||||
/* Step 2: change bottom index to old top index */
|
||||
DB_QueryUPDATE ("can not exchange indexes of questions",
|
||||
"UPDATE gam_questions SET QstInd=%u"
|
||||
" WHERE GamCod=%ld AND QstCod=%ld",
|
||||
"UPDATE gam_questions"
|
||||
" SET QstInd=%u"
|
||||
" WHERE GamCod=%ld"
|
||||
" AND QstCod=%ld",
|
||||
QstIndTop,
|
||||
GamCod,QstCodBottom);
|
||||
GamCod,
|
||||
QstCodBottom);
|
||||
|
||||
/* Step 3: change top index to old bottom index */
|
||||
DB_QueryUPDATE ("can not exchange indexes of questions",
|
||||
"UPDATE gam_questions SET QstInd=%u"
|
||||
" WHERE GamCod=%ld AND QstCod=%ld",
|
||||
"UPDATE gam_questions"
|
||||
" SET QstInd=%u"
|
||||
" WHERE GamCod=%ld"
|
||||
" AND QstCod=%ld",
|
||||
QstIndBottom,
|
||||
GamCod,QstCodTop);
|
||||
GamCod,
|
||||
QstCodTop);
|
||||
|
||||
/***** Unlock table *****/
|
||||
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
||||
|
|
11
swad_group.c
11
swad_group.c
|
@ -4475,7 +4475,8 @@ void Grp_ChangeGroupRoom (void)
|
|||
"UPDATE grp_groups"
|
||||
" SET RooCod=%ld"
|
||||
" WHERE GrpCod=%ld",
|
||||
NewRooCod,Gbl.Crs.Grps.GrpCod);
|
||||
NewRooCod,
|
||||
Gbl.Crs.Grps.GrpCod);
|
||||
|
||||
/* Create message to show the change made */
|
||||
AlertType = Ale_SUCCESS;
|
||||
|
@ -4632,7 +4633,7 @@ void Grp_ChangeOpenTimeGrpTyp (void)
|
|||
"OpenTime=FROM_UNIXTIME(%ld)"
|
||||
" WHERE GrpTypCod=%ld",
|
||||
Gbl.Crs.Grps.GrpTyp.MustBeOpened ? 'Y' :
|
||||
'N',
|
||||
'N',
|
||||
(long) Gbl.Crs.Grps.GrpTyp.OpenTimeUTC,
|
||||
Gbl.Crs.Grps.GrpTyp.GrpTypCod);
|
||||
|
||||
|
@ -4691,7 +4692,8 @@ void Grp_ChangeMaxStdsGrp (void)
|
|||
"UPDATE grp_groups"
|
||||
" SET MaxStudents=%u"
|
||||
" WHERE GrpCod=%ld",
|
||||
NewMaxStds,Gbl.Crs.Grps.GrpCod);
|
||||
NewMaxStds,
|
||||
Gbl.Crs.Grps.GrpCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
AlertType = Ale_SUCCESS;
|
||||
|
@ -4870,7 +4872,8 @@ void Grp_RenameGroup (void)
|
|||
"UPDATE grp_groups"
|
||||
" SET GrpName='%s'"
|
||||
" WHERE GrpCod=%ld",
|
||||
NewNameGrp,Gbl.Crs.Grps.GrpCod);
|
||||
NewNameGrp,
|
||||
Gbl.Crs.Grps.GrpCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
AlertType = Ale_SUCCESS;
|
||||
|
|
|
@ -769,7 +769,8 @@ void Hld_ChangeHolidayPlace (void)
|
|||
"UPDATE hld_holidays"
|
||||
" SET PlcCod=%ld"
|
||||
" WHERE HldCod=%ld",
|
||||
NewPlace.PlcCod,Hld_EditingHld->HldCod);
|
||||
NewPlace.PlcCod,
|
||||
Hld_EditingHld->HldCod);
|
||||
Hld_EditingHld->PlcCod = NewPlace.PlcCod;
|
||||
Str_Copy (Hld_EditingHld->PlaceFullName,NewPlace.FullName,
|
||||
sizeof (Hld_EditingHld->PlaceFullName) - 1);
|
||||
|
|
|
@ -166,7 +166,9 @@ void Ico_ChangeIconSet (void)
|
|||
/***** Store icon set in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
DB_QueryUPDATE ("can not update your setting about icon set",
|
||||
"UPDATE usr_data SET IconSet='%s' WHERE UsrCod=%ld",
|
||||
"UPDATE usr_data"
|
||||
" SET IconSet='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
|
|
|
@ -1402,8 +1402,11 @@ static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators)
|
|||
{
|
||||
/***** Store number of indicators of a course in database *****/
|
||||
DB_QueryUPDATE ("can not store number of indicators of a course",
|
||||
"UPDATE crs_courses SET NumIndicators=%u WHERE CrsCod=%ld",
|
||||
NumIndicators,CrsCod);
|
||||
"UPDATE crs_courses"
|
||||
" SET NumIndicators=%u"
|
||||
" WHERE CrsCod=%ld",
|
||||
NumIndicators,
|
||||
CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -696,8 +696,10 @@ static void Inf_SetForceReadIntoDB (bool MustBeRead)
|
|||
{
|
||||
/***** Insert or replace info source for a specific type of course information *****/
|
||||
DB_QueryUPDATE ("can not update if info must be read",
|
||||
"UPDATE crs_info_src SET MustBeRead='%c'"
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
"UPDATE crs_info_src"
|
||||
" SET MustBeRead='%c'"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND InfoType='%s'",
|
||||
MustBeRead ? 'Y' :
|
||||
'N',
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
|
|
|
@ -1525,8 +1525,11 @@ static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *N
|
|||
{
|
||||
/***** Update institution changing old name by new name */
|
||||
DB_QueryUPDATE ("can not update the name of an institution",
|
||||
"UPDATE ins_instits SET %s='%s' WHERE InsCod=%ld",
|
||||
FieldName,NewInsName,InsCod);
|
||||
"UPDATE ins_instits"
|
||||
" SET %s='%s'"
|
||||
" WHERE InsCod=%ld",
|
||||
FieldName,NewInsName,
|
||||
InsCod);
|
||||
|
||||
/***** Flush caches *****/
|
||||
Ins_FlushCacheShortNameOfInstitution ();
|
||||
|
@ -1580,8 +1583,11 @@ void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
|||
{
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
DB_QueryUPDATE ("can not update the web of an institution",
|
||||
"UPDATE ins_instits SET WWW='%s' WHERE InsCod=%ld",
|
||||
NewWWW,InsCod);
|
||||
"UPDATE ins_instits"
|
||||
" SET WWW='%s'"
|
||||
" WHERE InsCod=%ld",
|
||||
NewWWW,
|
||||
InsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1617,8 +1623,11 @@ void Ins_ChangeInsStatus (void)
|
|||
|
||||
/***** Update status in table of institutions *****/
|
||||
DB_QueryUPDATE ("can not update the status of an institution",
|
||||
"UPDATE ins_instits SET Status=%u WHERE InsCod=%ld",
|
||||
(unsigned) Status,Ins_EditingIns->InsCod);
|
||||
"UPDATE ins_instits"
|
||||
" SET Status=%u"
|
||||
" WHERE InsCod=%ld",
|
||||
(unsigned) Status,
|
||||
Ins_EditingIns->InsCod);
|
||||
Ins_EditingIns->Status = Status;
|
||||
|
||||
/***** Create message to show the change made
|
||||
|
|
|
@ -621,8 +621,11 @@ static void InsCfg_UpdateInsCtyDB (long InsCod,long CtyCod)
|
|||
{
|
||||
/***** Update country in table of institutions *****/
|
||||
DB_QueryUPDATE ("can not update the country of an institution",
|
||||
"UPDATE ins_instits SET CtyCod=%ld WHERE InsCod=%ld",
|
||||
CtyCod,InsCod);
|
||||
"UPDATE ins_instits"
|
||||
" SET CtyCod=%ld"
|
||||
" WHERE InsCod=%ld",
|
||||
CtyCod,
|
||||
InsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -203,7 +203,9 @@ void Lan_UpdateMyLanguageToCurrentLanguage (void)
|
|||
|
||||
/***** Update my language in database *****/
|
||||
DB_QueryUPDATE ("can not update your language",
|
||||
"UPDATE usr_data SET Language='%s' WHERE UsrCod=%ld",
|
||||
"UPDATE usr_data"
|
||||
" SET Language='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
|
|
@ -641,7 +641,8 @@ static void Lnk_UpdateLnkNameDB (long LnkCod,const char *FieldName,const char *N
|
|||
"UPDATE lnk_links"
|
||||
" SET %s='%s'"
|
||||
" WHERE LnkCod=%ld",
|
||||
FieldName,NewLnkName,LnkCod);
|
||||
FieldName,NewLnkName,
|
||||
LnkCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -675,7 +676,8 @@ void Lnk_ChangeLinkWWW (void)
|
|||
"UPDATE lnk_links"
|
||||
" SET WWW='%s'"
|
||||
" WHERE LnkCod=%ld",
|
||||
NewWWW,Lnk_EditingLnk->LnkCod);
|
||||
NewWWW,
|
||||
Lnk_EditingLnk->LnkCod);
|
||||
|
||||
/***** Message to show the change made *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
|
|
11
swad_mail.c
11
swad_mail.c
|
@ -722,7 +722,8 @@ static void Mai_UpdateMailDomainNameDB (long MaiCod,const char *FieldName,const
|
|||
"UPDATE ntf_mail_domains"
|
||||
" SET %s='%s'"
|
||||
" WHERE MaiCod=%ld",
|
||||
FieldName,NewMaiName,MaiCod);
|
||||
FieldName,NewMaiName,
|
||||
MaiCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1825,10 +1826,12 @@ void Mai_ConfirmEmail (void)
|
|||
default:
|
||||
/***** Confirm email *****/
|
||||
DB_QueryUPDATE ("can not confirm email",
|
||||
"UPDATE usr_emails SET Confirmed='Y'"
|
||||
"UPDATE usr_emails"
|
||||
" SET Confirmed='Y'"
|
||||
" WHERE usr_emails.UsrCod=%ld"
|
||||
" AND usr_emails.E_mail='%s'",
|
||||
UsrCod,Email);
|
||||
" AND usr_emails.E_mail='%s'",
|
||||
UsrCod,
|
||||
Email);
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_email_X_has_been_confirmed,
|
||||
Email);
|
||||
break;
|
||||
|
|
34
swad_match.c
34
swad_match.c
|
@ -977,7 +977,7 @@ void Mch_ToggleVisResultsMchUsr (void)
|
|||
Match.Status.ShowUsrResults = !Match.Status.ShowUsrResults;
|
||||
DB_QueryUPDATE ("can not toggle visibility of match results",
|
||||
"UPDATE mch_matches"
|
||||
" SET ShowUsrResults='%c'"
|
||||
" SET ShowUsrResults='%c'"
|
||||
" WHERE MchCod=%ld",
|
||||
Match.Status.ShowUsrResults ? 'Y' :
|
||||
'N',
|
||||
|
@ -1681,7 +1681,8 @@ static void Mch_UpdateMatchTitleAndGrps (const struct Mch_Match *Match)
|
|||
{
|
||||
/***** Update match title into database *****/
|
||||
DB_QueryUPDATE ("can not update match",
|
||||
"UPDATE mch_matches SET Title='%s'"
|
||||
"UPDATE mch_matches"
|
||||
" SET Title='%s'"
|
||||
" WHERE MchCod=%ld",
|
||||
Match->Title,
|
||||
Match->MchCod);
|
||||
|
@ -2007,20 +2008,22 @@ static void Mch_UpdateMatchStatusInDB (const struct Mch_Match *Match)
|
|||
|
||||
/***** Update match status in database *****/
|
||||
DB_QueryUPDATE ("can not update match being played",
|
||||
"UPDATE mch_matches,gam_games"
|
||||
" SET %s"
|
||||
"mch_matches.QstInd=%u,"
|
||||
"mch_matches.QstCod=%ld,"
|
||||
"mch_matches.Showing='%s',"
|
||||
"mch_matches.Countdown=%ld,"
|
||||
"mch_matches.NumCols=%u,"
|
||||
"mch_matches.ShowQstResults='%c',"
|
||||
"mch_matches.ShowUsrResults='%c'"
|
||||
"UPDATE mch_matches,"
|
||||
"gam_games"
|
||||
" SET %s"
|
||||
"mch_matches.QstInd=%u,"
|
||||
"mch_matches.QstCod=%ld,"
|
||||
"mch_matches.Showing='%s',"
|
||||
"mch_matches.Countdown=%ld,"
|
||||
"mch_matches.NumCols=%u,"
|
||||
"mch_matches.ShowQstResults='%c',"
|
||||
"mch_matches.ShowUsrResults='%c'"
|
||||
" WHERE mch_matches.MchCod=%ld"
|
||||
" AND mch_matches.GamCod=gam_games.GamCod"
|
||||
" AND gam_games.CrsCod=%ld", // Extra check
|
||||
" AND mch_matches.GamCod=gam_games.GamCod"
|
||||
" AND gam_games.CrsCod=%ld", // Extra check
|
||||
MchSubQuery,
|
||||
Match->Status.QstInd,Match->Status.QstCod,
|
||||
Match->Status.QstInd,
|
||||
Match->Status.QstCod,
|
||||
Mch_ShowingStringsDB[Match->Status.Showing],
|
||||
Match->Status.Countdown,
|
||||
Match->Status.NumCols,
|
||||
|
@ -2028,7 +2031,8 @@ static void Mch_UpdateMatchStatusInDB (const struct Mch_Match *Match)
|
|||
'N',
|
||||
Match->Status.ShowUsrResults ? 'Y' :
|
||||
'N',
|
||||
Match->MchCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
Match->MchCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
free (MchSubQuery);
|
||||
|
||||
if (Match->Status.Playing) // Match is being played
|
||||
|
|
|
@ -321,8 +321,11 @@ void Mnu_ChangeMenu (void)
|
|||
/***** Store menu in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
DB_QueryUPDATE ("can not update your setting about menu",
|
||||
"UPDATE usr_data SET Menu=%u WHERE UsrCod=%ld",
|
||||
(unsigned) Gbl.Prefs.Menu,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
"UPDATE usr_data"
|
||||
" SET Menu=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
(unsigned) Gbl.Prefs.Menu,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Set settings from current IP *****/
|
||||
Set_SetSettingsFromIP ();
|
||||
|
|
|
@ -1323,15 +1323,21 @@ static void Msg_ExpandSentMsg (long MsgCod)
|
|||
{
|
||||
/***** Expand message in sent message table *****/
|
||||
DB_QueryUPDATE ("can not expand a sent message",
|
||||
"UPDATE msg_snt SET Expanded='Y'"
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
"UPDATE msg_snt"
|
||||
" SET Expanded='Y'"
|
||||
" WHERE MsgCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
MsgCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Contract all my other messages in sent message table *****/
|
||||
DB_QueryUPDATE ("can not contract a sent message",
|
||||
"UPDATE msg_snt SET Expanded='N'"
|
||||
" WHERE UsrCod=%ld AND MsgCod<>%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,MsgCod);
|
||||
"UPDATE msg_snt"
|
||||
" SET Expanded='N'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" AND MsgCod<>%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
MsgCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1342,15 +1348,22 @@ static void Msg_ExpandReceivedMsg (long MsgCod)
|
|||
{
|
||||
/***** Expand message in received message table and mark it as read by me *****/
|
||||
DB_QueryUPDATE ("can not expand a received message",
|
||||
"UPDATE msg_rcv SET Open='Y',Expanded='Y'"
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
"UPDATE msg_rcv"
|
||||
" SET Open='Y',"
|
||||
"Expanded='Y'"
|
||||
" WHERE MsgCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
MsgCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Contract all my other messages in received message table *****/
|
||||
DB_QueryUPDATE ("can not contract a received message",
|
||||
"UPDATE msg_rcv SET Expanded='N'"
|
||||
" WHERE UsrCod=%ld AND MsgCod<>%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,MsgCod);
|
||||
"UPDATE msg_rcv"
|
||||
" SET Expanded='N'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" AND MsgCod<>%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
MsgCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1361,9 +1374,12 @@ static void Msg_ContractSentMsg (long MsgCod)
|
|||
{
|
||||
/***** Contract message in sent message table *****/
|
||||
DB_QueryUPDATE ("can not contract a sent message",
|
||||
"UPDATE msg_snt SET Expanded='N'"
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
"UPDATE msg_snt"
|
||||
" SET Expanded='N'"
|
||||
" WHERE MsgCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
MsgCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1374,9 +1390,12 @@ static void Msg_ContractReceivedMsg (long MsgCod)
|
|||
{
|
||||
/***** Contract message in received message table *****/
|
||||
DB_QueryUPDATE ("can not contract a received message",
|
||||
"UPDATE msg_rcv SET Expanded='N'"
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
"UPDATE msg_rcv"
|
||||
" SET Expanded='N'"
|
||||
" WHERE MsgCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
MsgCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1387,9 +1406,12 @@ void Msg_SetReceivedMsgAsOpen (long MsgCod,long UsrCod)
|
|||
{
|
||||
/***** Mark message as read by user *****/
|
||||
DB_QueryUPDATE ("can not mark a received message as open",
|
||||
"UPDATE msg_rcv SET Open='Y'"
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,UsrCod);
|
||||
"UPDATE msg_rcv"
|
||||
" SET Open='Y'"
|
||||
" WHERE MsgCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
MsgCod,
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1552,9 +1574,12 @@ static void Msg_SetReceivedMsgAsReplied (long MsgCod)
|
|||
{
|
||||
/***** Update received message by setting Replied field to true *****/
|
||||
DB_QueryUPDATE ("can not update a received message",
|
||||
"UPDATE msg_rcv SET Replied='Y'"
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
"UPDATE msg_rcv"
|
||||
" SET Replied='Y'"
|
||||
" WHERE MsgCod=%ld"
|
||||
" AND UsrCod=%ld",
|
||||
MsgCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1648,7 +1673,7 @@ static void Msg_MoveMsgContentToDeleted (long MsgCod)
|
|||
should be deleted to ensure the protection of personal data */
|
||||
|
||||
/* Delete message from msg_content *****/
|
||||
DB_QueryUPDATE ("can not remove the content of a message",
|
||||
DB_QueryDELETE ("can not remove the content of a message",
|
||||
"DELETE FROM msg_content"
|
||||
" WHERE MsgCod=%ld",
|
||||
MsgCod);
|
||||
|
@ -1680,7 +1705,7 @@ void Msg_MoveUnusedMsgsContentToDeleted (void)
|
|||
should be deleted to ensure the protection of personal data */
|
||||
|
||||
/* Delete message from msg_content *****/
|
||||
DB_QueryUPDATE ("can not remove the content of some messages",
|
||||
DB_QueryDELETE ("can not remove the content of some messages",
|
||||
"DELETE FROM msg_content"
|
||||
" WHERE MsgCod NOT IN"
|
||||
" (SELECT MsgCod"
|
||||
|
|
|
@ -193,7 +193,8 @@ static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned Nu
|
|||
"UPDATE not_notices"
|
||||
" SET NumNotif=%u"
|
||||
" WHERE NotCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,NotCod);
|
||||
NumUsrsToBeNotifiedByEMail,
|
||||
NotCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -250,7 +251,8 @@ void Not_HideActiveNotice (void)
|
|||
" WHERE NotCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
(unsigned) Not_OBSOLETE_NOTICE,
|
||||
NotCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
NotCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Update RSS of current course *****/
|
||||
RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs);
|
||||
|
@ -277,7 +279,8 @@ void Not_RevealHiddenNotice (void)
|
|||
" WHERE NotCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
(unsigned) Not_ACTIVE_NOTICE,
|
||||
NotCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
NotCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Update RSS of current course *****/
|
||||
RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs);
|
||||
|
|
|
@ -968,7 +968,8 @@ void Ntf_MarkNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
" WHERE NotifyEvent=%u"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
(unsigned) NotifyEvent,Cod);
|
||||
(unsigned) NotifyEvent,
|
||||
Cod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1563,7 +1564,8 @@ static void Ntf_UpdateMyLastAccessToNotifications (void)
|
|||
{
|
||||
/***** Reset to 0 my number of new notifications *****/
|
||||
DB_QueryUPDATE ("can not update last access to notifications",
|
||||
"UPDATE usr_last SET LastAccNotif=NOW()"
|
||||
"UPDATE usr_last"
|
||||
" SET LastAccNotif=NOW()"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
@ -2102,7 +2104,8 @@ void Ntf_ChangeNotifyEvents (void)
|
|||
/***** Store settings about notify events *****/
|
||||
DB_QueryUPDATE ("can not update user's settings",
|
||||
"UPDATE usr_data"
|
||||
" SET NotifNtfEvents=%u,EmailNtfEvents=%u"
|
||||
" SET NotifNtfEvents=%u,"
|
||||
"EmailNtfEvents=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.NtfEvents.CreateNotif,
|
||||
Gbl.Usrs.Me.UsrDat.NtfEvents.SendEmail,
|
||||
|
|
|
@ -137,7 +137,8 @@ void Pwd_AssignMyPendingPasswordToMyCurrentPassword (void)
|
|||
{
|
||||
/***** Update my current password in database *****/
|
||||
DB_QueryUPDATE ("can not update your password",
|
||||
"UPDATE usr_data SET Password='%s'"
|
||||
"UPDATE usr_data"
|
||||
" SET Password='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.PendingPassword,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
|
15
swad_photo.c
15
swad_photo.c
|
@ -1292,7 +1292,9 @@ static void Pho_ClearPhotoName (long UsrCod)
|
|||
{
|
||||
/***** Clear photo name in user's data *****/
|
||||
DB_QueryUPDATE ("can not clear the name of a user's photo",
|
||||
"UPDATE usr_data SET Photo='' WHERE UsrCod=%ld",
|
||||
"UPDATE usr_data"
|
||||
" SET Photo=''"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
|
@ -1306,8 +1308,11 @@ void Pho_UpdatePhotoName (struct UsrData *UsrDat)
|
|||
|
||||
/***** Update photo name in database *****/
|
||||
DB_QueryUPDATE ("can not update the name of a user's photo",
|
||||
"UPDATE usr_data SET Photo='%s' WHERE UsrCod=%ld",
|
||||
Gbl.UniqueNameEncrypted,UsrDat->UsrCod);
|
||||
"UPDATE usr_data"
|
||||
" SET Photo='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.UniqueNameEncrypted,
|
||||
UsrDat->UsrCod);
|
||||
|
||||
/***** Remove the old symbolic link to photo *****/
|
||||
snprintf (PathPublPhoto,sizeof (PathPublPhoto),"%s/%s.jpg",
|
||||
|
@ -1332,7 +1337,9 @@ void Pho_ChangePhotoVisibility (void)
|
|||
|
||||
/***** Store public/private photo in database *****/
|
||||
DB_QueryUPDATE ("can not update your setting about photo visibility",
|
||||
"UPDATE usr_data SET PhotoVisibility='%s' WHERE UsrCod=%ld",
|
||||
"UPDATE usr_data"
|
||||
" SET PhotoVisibility='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.PhotoVisibility],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
|
|
|
@ -554,7 +554,8 @@ void Plg_RenamePlugin (void)
|
|||
"UPDATE plg_plugins"
|
||||
" SET Name='%s'"
|
||||
" WHERE PlgCod=%ld",
|
||||
NewPlgName,Plg_EditingPlg->PlgCod);
|
||||
NewPlgName,
|
||||
Plg_EditingPlg->PlgCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
|
|
|
@ -366,7 +366,8 @@ void Prf_ChangeBasicProfileVis (void)
|
|||
/***** Store public/private photo in database *****/
|
||||
DB_QueryUPDATE ("can not update your setting"
|
||||
" about public profile visibility",
|
||||
"UPDATE usr_data SET BaPrfVisibility='%s'"
|
||||
"UPDATE usr_data"
|
||||
" SET BaPrfVisibility='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.BaPrfVisibility],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
@ -386,7 +387,8 @@ void Prf_ChangeExtendedProfileVis (void)
|
|||
/***** Store public/private photo in database *****/
|
||||
DB_QueryUPDATE ("can not update your setting"
|
||||
" about public profile visibility",
|
||||
"UPDATE usr_data SET ExPrfVisibility='%s'"
|
||||
"UPDATE usr_data"
|
||||
" SET ExPrfVisibility='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.ExPrfVisibility],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
|
|
@ -1328,11 +1328,13 @@ static void Prg_HideUnhideItem (char YN)
|
|||
|
||||
/***** Hide/unhide program item *****/
|
||||
DB_QueryUPDATE ("can not change program item",
|
||||
"UPDATE prg_items SET Hidden='%c'"
|
||||
"UPDATE prg_items"
|
||||
" SET Hidden='%c'"
|
||||
" WHERE ItmCod=%ld"
|
||||
" AND CrsCod=%ld", // Extra check
|
||||
" AND CrsCod=%ld", // Extra check
|
||||
YN,
|
||||
Item.Hierarchy.ItmCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
Item.Hierarchy.ItmCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Show program items highlighting subtree *****/
|
||||
Prg_SetItemRangeWithAllChildren (Prg_GetNumItemFromItmCod (Item.Hierarchy.ItmCod),
|
||||
|
@ -1467,29 +1469,38 @@ Bottom.End: | 49| 222|-->|-->-49| 222| | -49| 222|-->|--> 26| 2
|
|||
/* Step 1: Change all indexes involved to negative,
|
||||
necessary to preserve unique index (CrsCod,ItmInd) */
|
||||
DB_QueryUPDATE ("can not exchange indexes of items",
|
||||
"UPDATE prg_items SET ItmInd=-ItmInd"
|
||||
"UPDATE prg_items"
|
||||
" SET ItmInd=-ItmInd"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND ItmInd>=%u AND ItmInd<=%u",
|
||||
" AND ItmInd>=%u"
|
||||
" AND ItmInd<=%u",
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Top.Begin,Bottom.End); // All indexes in both parts
|
||||
Top.Begin,
|
||||
Bottom.End); // All indexes in both parts
|
||||
|
||||
/* Step 2: Increase top indexes */
|
||||
DB_QueryUPDATE ("can not exchange indexes of items",
|
||||
"UPDATE prg_items SET ItmInd=-ItmInd+%u"
|
||||
"UPDATE prg_items"
|
||||
" SET ItmInd=-ItmInd+%u"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND ItmInd>=-%u AND ItmInd<=-%u",
|
||||
" AND ItmInd>=-%u"
|
||||
" AND ItmInd<=-%u",
|
||||
DiffEnd,
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Top.End,Top.Begin); // All indexes in top part
|
||||
Top.End,
|
||||
Top.Begin); // All indexes in top part
|
||||
|
||||
/* Step 3: Decrease bottom indexes */
|
||||
DB_QueryUPDATE ("can not exchange indexes of items",
|
||||
"UPDATE prg_items SET ItmInd=-ItmInd-%u"
|
||||
"UPDATE prg_items"
|
||||
" SET ItmInd=-ItmInd-%u"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND ItmInd>=-%u AND ItmInd<=-%u",
|
||||
" AND ItmInd>=-%u"
|
||||
" AND ItmInd<=-%u",
|
||||
DiffBegin,
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Bottom.End,Bottom.Begin); // All indexes in bottom part
|
||||
Bottom.End,
|
||||
Bottom.Begin); // All indexes in bottom part
|
||||
|
||||
/***** Unlock table *****/
|
||||
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
||||
|
@ -1613,12 +1624,15 @@ static void Prg_MoveLeftRightItem (Prg_MoveLeftRight_t LeftRight)
|
|||
|
||||
/* Move item and its children to left or right */
|
||||
DB_QueryUPDATE ("can not move items",
|
||||
"UPDATE prg_items SET Level=Level%c1"
|
||||
"UPDATE prg_items"
|
||||
" SET Level=Level%c1"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND ItmInd>=%u AND ItmInd<=%u",
|
||||
" AND ItmInd>=%u"
|
||||
" AND ItmInd<=%u",
|
||||
IncDec[LeftRight],
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
ToMove.Begin,ToMove.End);
|
||||
ToMove.Begin,
|
||||
ToMove.End);
|
||||
|
||||
/* Update list of program items */
|
||||
Prg_FreeListItems ();
|
||||
|
@ -2059,9 +2073,10 @@ static void Prg_InsertItem (const struct ProgramItem *ParentItem,
|
|||
|
||||
/***** Move down all indexes of after last child of parent *****/
|
||||
DB_QueryUPDATE ("can not move down items",
|
||||
"UPDATE prg_items SET ItmInd=ItmInd+1"
|
||||
"UPDATE prg_items"
|
||||
" SET ItmInd=ItmInd+1"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND ItmInd>=%u"
|
||||
" AND ItmInd>=%u"
|
||||
" ORDER BY ItmInd DESC", // Necessary to not create duplicate key (CrsCod,ItmInd)
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Item->Hierarchy.Index);
|
||||
|
@ -2138,17 +2153,19 @@ static void Prg_UpdateItem (struct ProgramItem *Item,const char *Txt)
|
|||
{
|
||||
/***** Update the data of the program item *****/
|
||||
DB_QueryUPDATE ("can not update program item",
|
||||
"UPDATE prg_items SET "
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Title='%s',Txt='%s'"
|
||||
"UPDATE prg_items"
|
||||
" SET StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Title='%s',"
|
||||
"Txt='%s'"
|
||||
" WHERE ItmCod=%ld"
|
||||
" AND CrsCod=%ld", // Extra check
|
||||
" AND CrsCod=%ld", // Extra check
|
||||
Item->TimeUTC[Dat_START_TIME],
|
||||
Item->TimeUTC[Dat_END_TIME ],
|
||||
Item->Title,
|
||||
Txt,
|
||||
Item->Hierarchy.ItmCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
Item->Hierarchy.ItmCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -4074,7 +4074,8 @@ static void Prj_UpdateProject (struct Prj_Project *Prj)
|
|||
Prj->Knowledge,
|
||||
Prj->Materials,
|
||||
Prj->URL,
|
||||
Prj->PrjCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
Prj->PrjCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4506,7 +4507,8 @@ static void Prj_LockProjectEditionInDB (long PrjCod)
|
|||
" SET Locked='Y'"
|
||||
" WHERE PrjCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
PrjCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
PrjCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4555,7 +4557,8 @@ static void Prj_UnlockProjectEditionInDB (long PrjCod)
|
|||
" SET Locked='N'"
|
||||
" WHERE PrjCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
PrjCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
PrjCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -769,9 +769,11 @@ void Rec_RenameField (void)
|
|||
{
|
||||
/* Update the table of fields changing then old name by the new one */
|
||||
DB_QueryUPDATE ("can not update name of field of record",
|
||||
"UPDATE crs_record_fields SET FieldName='%s'"
|
||||
"UPDATE crs_record_fields"
|
||||
" SET FieldName='%s'"
|
||||
" WHERE FieldCod=%ld",
|
||||
NewFieldName,Gbl.Crs.Records.Field.FieldCod);
|
||||
NewFieldName,
|
||||
Gbl.Crs.Records.Field.FieldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_record_field_X_has_been_renamed_as_Y,
|
||||
|
@ -825,9 +827,11 @@ void Rec_ChangeLinesField (void)
|
|||
{
|
||||
/***** Update of the table of fields changing the old maximum of students by the new one *****/
|
||||
DB_QueryUPDATE ("can not update the number of lines of a record field",
|
||||
"UPDATE crs_record_fields SET NumLines=%u"
|
||||
"UPDATE crs_record_fields"
|
||||
" SET NumLines=%u"
|
||||
" WHERE FieldCod=%ld",
|
||||
NewNumLines,Gbl.Crs.Records.Field.FieldCod);
|
||||
NewNumLines,
|
||||
Gbl.Crs.Records.Field.FieldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_From_now_on_the_number_of_editing_lines_of_the_field_X_is_Y,
|
||||
|
@ -873,7 +877,8 @@ void Rec_ChangeVisibilityField (void)
|
|||
{
|
||||
/***** Update of the table of fields changing the old visibility by the new *****/
|
||||
DB_QueryUPDATE ("can not update the visibility of a record field",
|
||||
"UPDATE crs_record_fields SET Visibility=%u"
|
||||
"UPDATE crs_record_fields"
|
||||
" SET Visibility=%u"
|
||||
" WHERE FieldCod=%ld",
|
||||
(unsigned) NewVisibility,
|
||||
Gbl.Crs.Records.Field.FieldCod);
|
||||
|
@ -1905,8 +1910,10 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
|||
if (Gbl.Crs.Records.LstFields.Lst[NumField].Text[0])
|
||||
/***** Update text of the field of record course *****/
|
||||
DB_QueryUPDATE ("can not update field of record",
|
||||
"UPDATE crs_records SET Txt='%s'"
|
||||
" WHERE UsrCod=%ld AND FieldCod=%ld",
|
||||
"UPDATE crs_records"
|
||||
" SET Txt='%s'"
|
||||
" WHERE UsrCod=%ld"
|
||||
" AND FieldCod=%ld",
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].Text,
|
||||
UsrCod,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
|
||||
|
@ -4177,7 +4184,9 @@ void Rec_UpdateMyOffice (void)
|
|||
|
||||
/***** Update office *****/
|
||||
DB_QueryUPDATE ("can not update office",
|
||||
"UPDATE usr_data SET Office='%s' WHERE UsrCod=%ld",
|
||||
"UPDATE usr_data"
|
||||
" SET Office='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.Tch.Office,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
|
@ -4196,7 +4205,9 @@ void Rec_UpdateMyOfficePhone (void)
|
|||
|
||||
/***** Update office phone *****/
|
||||
DB_QueryUPDATE ("can not update office phone",
|
||||
"UPDATE usr_data SET OfficePhone='%s' WHERE UsrCod=%ld",
|
||||
"UPDATE usr_data"
|
||||
" SET OfficePhone='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
|
|
12
swad_room.c
12
swad_room.c
|
@ -1083,7 +1083,8 @@ void Roo_ChangeBuilding (void)
|
|||
"UPDATE roo_rooms"
|
||||
" SET BldCod=%ld"
|
||||
" WHERE RooCod=%ld",
|
||||
NewBldCod,Roo_EditingRoom->RooCod);
|
||||
NewBldCod,
|
||||
Roo_EditingRoom->RooCod);
|
||||
|
||||
/***** Get updated data of the room from database *****/
|
||||
Roo_GetDataOfRoomByCod (Roo_EditingRoom);
|
||||
|
@ -1133,7 +1134,8 @@ void Roo_ChangeFloor (void)
|
|||
"UPDATE roo_rooms"
|
||||
" SET Floor=%d"
|
||||
" WHERE RooCod=%ld",
|
||||
NewFloor,Roo_EditingRoom->RooCod);
|
||||
NewFloor,
|
||||
Roo_EditingRoom->RooCod);
|
||||
|
||||
/***** Get updated data of the room from database *****/
|
||||
Roo_GetDataOfRoomByCod (Roo_EditingRoom);
|
||||
|
@ -1332,7 +1334,8 @@ static void Roo_UpdateRoomNameDB (long RooCod,const char *FieldName,const char *
|
|||
"UPDATE roo_rooms"
|
||||
" SET %s='%s'"
|
||||
" WHERE RooCod=%ld",
|
||||
FieldName,NewRoomName,RooCod);
|
||||
FieldName,NewRoomName,
|
||||
RooCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1378,7 +1381,8 @@ void Roo_ChangeCapacity (void)
|
|||
"UPDATE roo_rooms"
|
||||
" SET Capacity=%u"
|
||||
" WHERE RooCod=%ld",
|
||||
NewCapacity,Roo_EditingRoom->RooCod);
|
||||
NewCapacity,
|
||||
Roo_EditingRoom->RooCod);
|
||||
Roo_EditingRoom->Capacity = NewCapacity;
|
||||
|
||||
/***** Message to show the change made *****/
|
||||
|
|
|
@ -319,9 +319,11 @@ void Set_ChangeSideCols (void)
|
|||
static void Set_UpdateSideColsOnUsrDataTable (void)
|
||||
{
|
||||
DB_QueryUPDATE ("can not update your setting about side columns",
|
||||
"UPDATE usr_data SET SideCols=%u"
|
||||
"UPDATE usr_data"
|
||||
" SET SideCols=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Prefs.SideCols,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
Gbl.Prefs.SideCols,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1739,14 +1739,17 @@ void Svy_ResetSurvey (void)
|
|||
|
||||
/***** Remove all the users in this survey *****/
|
||||
DB_QueryDELETE ("can not remove users who are answered a survey",
|
||||
"DELETE FROM svy_users WHERE SvyCod=%ld",
|
||||
"DELETE FROM svy_users"
|
||||
" WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
|
||||
/***** Reset all the answers in this survey *****/
|
||||
DB_QueryUPDATE ("can not reset answers of a survey",
|
||||
"UPDATE svy_answers,svy_questions SET svy_answers.NumUsrs=0"
|
||||
"UPDATE svy_answers,"
|
||||
"svy_questions"
|
||||
" SET svy_answers.NumUsrs=0"
|
||||
" WHERE svy_questions.SvyCod=%ld"
|
||||
" AND svy_questions.QstCod=svy_answers.QstCod",
|
||||
" AND svy_questions.QstCod=svy_answers.QstCod",
|
||||
Svy.SvyCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
|
@ -1785,7 +1788,9 @@ void Svy_HideSurvey (void)
|
|||
|
||||
/***** Hide survey *****/
|
||||
DB_QueryUPDATE ("can not hide survey",
|
||||
"UPDATE svy_surveys SET Hidden='Y' WHERE SvyCod=%ld",
|
||||
"UPDATE svy_surveys"
|
||||
" SET Hidden='Y'"
|
||||
" WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
|
||||
/***** Show surveys again *****/
|
||||
|
@ -1820,7 +1825,9 @@ void Svy_UnhideSurvey (void)
|
|||
|
||||
/***** Show survey *****/
|
||||
DB_QueryUPDATE ("can not show survey",
|
||||
"UPDATE svy_surveys SET Hidden='N' WHERE SvyCod=%ld",
|
||||
"UPDATE svy_surveys"
|
||||
" SET Hidden='N'"
|
||||
" WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
|
||||
/***** Show surveys again *****/
|
||||
|
@ -2329,9 +2336,11 @@ static void Svy_UpdateNumUsrsNotifiedByEMailAboutSurvey (long SvyCod,
|
|||
{
|
||||
/***** Update number of users notified *****/
|
||||
DB_QueryUPDATE ("can not update the number of notifications of a survey",
|
||||
"UPDATE svy_surveys SET NumNotif=NumNotif+%u"
|
||||
"UPDATE svy_surveys"
|
||||
" SET NumNotif=NumNotif+%u"
|
||||
" WHERE SvyCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,SvyCod);
|
||||
NumUsrsToBeNotifiedByEMail,
|
||||
SvyCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2382,12 +2391,16 @@ static void Svy_UpdateSurvey (struct Svy_Survey *Svy,const char *Txt)
|
|||
/***** Update the data of the survey *****/
|
||||
DB_QueryUPDATE ("can not update survey",
|
||||
"UPDATE svy_surveys"
|
||||
" SET Scope='%s',Cod=%ld,Roles=%u,"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Title='%s',Txt='%s'"
|
||||
" SET Scope='%s',"
|
||||
"Cod=%ld,"
|
||||
"Roles=%u,"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Title='%s',"
|
||||
"Txt='%s'"
|
||||
" WHERE SvyCod=%ld",
|
||||
Sco_GetDBStrFromScope (Svy->Scope),Svy->Cod,
|
||||
Sco_GetDBStrFromScope (Svy->Scope),
|
||||
Svy->Cod,
|
||||
Svy->Roles,
|
||||
Svy->TimeUTC[Svy_START_TIME],
|
||||
Svy->TimeUTC[Svy_END_TIME ],
|
||||
|
@ -3729,9 +3742,12 @@ void Svy_RemoveQst (void)
|
|||
|
||||
/* Change index of questions greater than this */
|
||||
DB_QueryUPDATE ("can not update indexes of questions",
|
||||
"UPDATE svy_questions SET QstInd=QstInd-1"
|
||||
" WHERE SvyCod=%ld AND QstInd>%u",
|
||||
SvyCod,SvyQst.QstInd);
|
||||
"UPDATE svy_questions"
|
||||
" SET QstInd=QstInd-1"
|
||||
" WHERE SvyCod=%ld"
|
||||
" AND QstInd>%u",
|
||||
SvyCod,
|
||||
SvyQst.QstInd);
|
||||
|
||||
/***** Write message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
|
||||
|
@ -3845,9 +3861,12 @@ static void Svy_IncreaseAnswerInDB (long QstCod,unsigned AnsInd)
|
|||
{
|
||||
/***** Increase number of users who have selected the answer AnsInd in the question QstCod *****/
|
||||
DB_QueryUPDATE ("can not register your answer to the survey",
|
||||
"UPDATE svy_answers SET NumUsrs=NumUsrs+1"
|
||||
" WHERE QstCod=%ld AND AnsInd=%u",
|
||||
QstCod,AnsInd);
|
||||
"UPDATE svy_answers"
|
||||
" SET NumUsrs=NumUsrs+1"
|
||||
" WHERE QstCod=%ld"
|
||||
" AND AnsInd=%u",
|
||||
QstCod,
|
||||
AnsInd);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
10
swad_tag.c
10
swad_tag.c
|
@ -209,11 +209,15 @@ static void Tag_EnableOrDisableTag (long TagCod,bool TagHidden)
|
|||
{
|
||||
/***** Insert new tag into tst_tags table *****/
|
||||
DB_QueryUPDATE ("can not update the visibility of a tag",
|
||||
"UPDATE tst_tags SET TagHidden='%c',ChangeTime=NOW()"
|
||||
" WHERE TagCod=%ld AND CrsCod=%ld",
|
||||
"UPDATE tst_tags"
|
||||
" SET TagHidden='%c',"
|
||||
"ChangeTime=NOW()"
|
||||
" WHERE TagCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
TagHidden ? 'Y' :
|
||||
'N',
|
||||
TagCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
TagCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
36
swad_test.c
36
swad_test.c
|
@ -4892,11 +4892,14 @@ void Tst_ChangeShuffleQst (void)
|
|||
/***** Remove the question from all the tables *****/
|
||||
/* Update the question changing the current shuffle */
|
||||
DB_QueryUPDATE ("can not update the shuffle type of a question",
|
||||
"UPDATE tst_questions SET Shuffle='%c'"
|
||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
||||
"UPDATE tst_questions"
|
||||
" SET Shuffle='%c'"
|
||||
" WHERE QstCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
Shuffle ? 'Y' :
|
||||
'N',
|
||||
Test.Question.QstCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
Test.Question.QstCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Write message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Shuffle ? Txt_The_answers_of_the_question_with_code_X_will_appear_shuffled :
|
||||
|
@ -5001,21 +5004,23 @@ static void Tst_InsertOrUpdateQstIntoDB (struct Tst_Question *Question)
|
|||
/* Update question in database */
|
||||
DB_QueryUPDATE ("can not update question",
|
||||
"UPDATE tst_questions"
|
||||
" SET EditTime=NOW(),"
|
||||
"AnsType='%s',"
|
||||
"Shuffle='%c',"
|
||||
"Stem='%s',"
|
||||
"Feedback='%s',"
|
||||
"MedCod=%ld"
|
||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
||||
" SET EditTime=NOW(),"
|
||||
"AnsType='%s',"
|
||||
"Shuffle='%c',"
|
||||
"Stem='%s',"
|
||||
"Feedback='%s',"
|
||||
"MedCod=%ld"
|
||||
" WHERE QstCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
Tst_StrAnswerTypesDB[Question->Answer.Type],
|
||||
Question->Answer.Shuffle ? 'Y' :
|
||||
'N',
|
||||
Question->Stem,
|
||||
Question->Feedback ? Question->Feedback :
|
||||
"",
|
||||
"",
|
||||
Question->Media.MedCod,
|
||||
Question->QstCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||
Question->QstCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/* Remove answers and tags from this test question */
|
||||
Tst_RemAnsFromQst (Question->QstCod);
|
||||
|
@ -5111,15 +5116,16 @@ void Tst_UpdateQstScoreInDB (struct TstPrn_PrintedQuestion *PrintedQuestion)
|
|||
if (PrintedQuestion->StrAnswers[0]) // User's answer is not blank
|
||||
DB_QueryUPDATE ("can not update the score of a question",
|
||||
"UPDATE tst_questions"
|
||||
" SET NumHits=NumHits+1,NumHitsNotBlank=NumHitsNotBlank+1,"
|
||||
"Score=Score+(%.15lg)"
|
||||
" SET NumHits=NumHits+1,"
|
||||
"NumHitsNotBlank=NumHitsNotBlank+1,"
|
||||
"Score=Score+(%.15lg)"
|
||||
" WHERE QstCod=%ld",
|
||||
PrintedQuestion->Score,
|
||||
PrintedQuestion->QstCod);
|
||||
else // User's answer is blank
|
||||
DB_QueryUPDATE ("can not update the score of a question",
|
||||
"UPDATE tst_questions"
|
||||
" SET NumHits=NumHits+1"
|
||||
" SET NumHits=NumHits+1"
|
||||
" WHERE QstCod=%ld",
|
||||
PrintedQuestion->QstCod);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
|
|
|
@ -237,13 +237,14 @@ void TstPrn_UpdatePrintInDB (const struct TstPrn_Print *Print)
|
|||
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
||||
DB_QueryUPDATE ("can not update test exam",
|
||||
"UPDATE tst_exams"
|
||||
" SET EndTime=NOW(),"
|
||||
"NumQstsNotBlank=%u,"
|
||||
"Sent='%c',"
|
||||
"AllowTeachers='%c',"
|
||||
"Score='%.15lg'"
|
||||
" SET EndTime=NOW(),"
|
||||
"NumQstsNotBlank=%u,"
|
||||
"Sent='%c',"
|
||||
"AllowTeachers='%c',"
|
||||
"Score='%.15lg'"
|
||||
" WHERE ExaCod=%ld"
|
||||
" AND CrsCod=%ld AND UsrCod=%ld", // Extra checks
|
||||
" AND CrsCod=%ld" // Extra check
|
||||
" AND UsrCod=%ld", // Extra check
|
||||
Print->NumQsts.NotBlank,
|
||||
Print->Sent ? 'Y' :
|
||||
'N',
|
||||
|
|
|
@ -371,7 +371,8 @@ void The_ChangeTheme (void)
|
|||
/***** Store theme in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
DB_QueryUPDATE ("can not update your setting about theme",
|
||||
"UPDATE usr_data SET Theme='%s'"
|
||||
"UPDATE usr_data"
|
||||
" SET Theme='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
The_ThemeId[Gbl.Prefs.Theme],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
|
|
@ -178,9 +178,12 @@ void Tml_DB_MarkNoteAsUnavailable (Tml_Not_NoteType_t NoteType,long Cod)
|
|||
{
|
||||
/***** Mark note as unavailable *****/
|
||||
DB_QueryUPDATE ("can not mark note as unavailable",
|
||||
"UPDATE tml_notes SET Unavailable='Y'"
|
||||
" WHERE NoteType=%u AND Cod=%ld",
|
||||
(unsigned) NoteType,Cod);
|
||||
"UPDATE tml_notes"
|
||||
" SET Unavailable='Y'"
|
||||
" WHERE NoteType=%u"
|
||||
" AND Cod=%ld",
|
||||
(unsigned) NoteType,
|
||||
Cod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue