mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-14 12:44:09 +02:00
Version 18.11.24
This commit is contained in:
parent
8c2707a529
commit
358eb7e95e
|
@ -381,11 +381,11 @@ void MFU_UpdateMFUActions (void)
|
|||
Gbl.Usrs.Me.UsrDat.UsrCod,ActCod,Score);
|
||||
|
||||
/***** Update score for other actions *****/
|
||||
DB_BuildQuery ("UPDATE actions_MFU SET Score=GREATEST(Score*'%f','%f')"
|
||||
DB_QueryUPDATE ("can not update most frequently used actions",
|
||||
"UPDATE actions_MFU SET Score=GREATEST(Score*'%f','%f')"
|
||||
" WHERE UsrCod=%ld AND ActCod<>%ld",
|
||||
MFU_DECREASE_FACTOR,MFU_MIN_SCORE,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,ActCod);
|
||||
DB_QueryUPDATE_new ("can not update most frequently used actions");
|
||||
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
}
|
||||
|
|
|
@ -1373,10 +1373,10 @@ void Agd_HideEvent (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Set event private *****/
|
||||
DB_BuildQuery ("UPDATE agendas SET Hidden='Y'"
|
||||
DB_QueryUPDATE ("can not hide event",
|
||||
"UPDATE agendas SET Hidden='Y'"
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not hide event");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1406,10 +1406,10 @@ void Agd_UnhideEvent (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Set event public *****/
|
||||
DB_BuildQuery ("UPDATE agendas SET Hidden='N'"
|
||||
DB_QueryUPDATE ("can not show event",
|
||||
"UPDATE agendas SET Hidden='N'"
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not show event");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1439,10 +1439,10 @@ void Agd_MakeEventPrivate (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Make event private *****/
|
||||
DB_BuildQuery ("UPDATE agendas SET Public='N'"
|
||||
DB_QueryUPDATE ("can not make event private",
|
||||
"UPDATE agendas SET Public='N'"
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not make event private");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1472,10 +1472,10 @@ void Agd_MakeEventPublic (void)
|
|||
Agd_GetDataOfEventByCod (&AgdEvent);
|
||||
|
||||
/***** Make event public *****/
|
||||
DB_BuildQuery ("UPDATE agendas SET Public='Y'"
|
||||
DB_QueryUPDATE ("can not make event public",
|
||||
"UPDATE agendas SET Public='Y'"
|
||||
" WHERE AgdCod=%ld AND UsrCod=%ld",
|
||||
AgdEvent.AgdCod,AgdEvent.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not make event public");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1732,7 +1732,8 @@ static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
|||
static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
||||
{
|
||||
/***** Update the data of the event *****/
|
||||
DB_BuildQuery ("UPDATE agendas SET "
|
||||
DB_QueryUPDATE ("can not update event",
|
||||
"UPDATE agendas SET "
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Event='%s',Location='%s',Txt='%s'"
|
||||
|
@ -1741,7 +1742,6 @@ static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
|||
AgdEvent->TimeUTC[Agd_END_TIME ],
|
||||
AgdEvent->Event,AgdEvent->Location,Txt,
|
||||
AgdEvent->AgdCod,AgdEvent->UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update event");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -532,10 +532,10 @@ void Ann_HideActiveAnnouncement (void)
|
|||
AnnCod = Ann_GetParamAnnCod ();
|
||||
|
||||
/***** Set global announcement as hidden *****/
|
||||
DB_BuildQuery ("UPDATE announcements SET Status=%u"
|
||||
DB_QueryUPDATE ("can not hide announcement",
|
||||
"UPDATE announcements SET Status=%u"
|
||||
" WHERE AnnCod=%ld",
|
||||
(unsigned) Ann_OBSOLETE_ANNOUNCEMENT,AnnCod);
|
||||
DB_QueryUPDATE_new ("can not hide announcement");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -550,10 +550,10 @@ void Ann_RevealHiddenAnnouncement (void)
|
|||
AnnCod = Ann_GetParamAnnCod ();
|
||||
|
||||
/***** Set global announcement as shown *****/
|
||||
DB_BuildQuery ("UPDATE announcements SET Status=%u"
|
||||
DB_QueryUPDATE ("can not reveal announcement",
|
||||
"UPDATE announcements SET Status=%u"
|
||||
" WHERE AnnCod=%ld",
|
||||
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,AnnCod);
|
||||
DB_QueryUPDATE_new ("can not reveal announcement");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1060,10 +1060,10 @@ void Asg_HideAssignment (void)
|
|||
Asg_GetDataOfAssignmentByCod (&Asg);
|
||||
|
||||
/***** Hide assignment *****/
|
||||
DB_BuildQuery ("UPDATE assignments SET Hidden='Y'"
|
||||
DB_QueryUPDATE ("can not hide assignment",
|
||||
"UPDATE assignments SET Hidden='Y'"
|
||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not hide assignment");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1092,10 +1092,10 @@ void Asg_ShowAssignment (void)
|
|||
Asg_GetDataOfAssignmentByCod (&Asg);
|
||||
|
||||
/***** Hide assignment *****/
|
||||
DB_BuildQuery ("UPDATE assignments SET Hidden='N'"
|
||||
DB_QueryUPDATE ("can not show assignment",
|
||||
"UPDATE assignments SET Hidden='N'"
|
||||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not show assignment");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1482,10 +1482,11 @@ void Asg_RecFormAssignment (void)
|
|||
static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigned NumUsrsToBeNotifiedByEMail)
|
||||
{
|
||||
/***** Update number of users notified *****/
|
||||
DB_BuildQuery ("UPDATE assignments SET NumNotif=NumNotif+%u"
|
||||
DB_QueryUPDATE ("can not update the number of notifications"
|
||||
" of an assignment",
|
||||
"UPDATE assignments SET NumNotif=NumNotif+%u"
|
||||
" WHERE AsgCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,AsgCod);
|
||||
DB_QueryUPDATE_new ("can not update the number of notifications of an assignment");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1522,7 +1523,8 @@ static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt)
|
|||
static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt)
|
||||
{
|
||||
/***** Update the data of the assignment *****/
|
||||
DB_BuildQuery ("UPDATE assignments SET "
|
||||
DB_QueryUPDATE ("can not update assignment",
|
||||
"UPDATE assignments SET "
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
"Title='%s',Folder='%s',Txt='%s'"
|
||||
|
@ -1533,7 +1535,6 @@ static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt)
|
|||
Asg->Folder,
|
||||
Txt,
|
||||
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update assignment");
|
||||
|
||||
/***** Update groups *****/
|
||||
/* Remove old groups */
|
||||
|
|
|
@ -979,10 +979,10 @@ void Att_HideAttEvent (void)
|
|||
Att_GetDataOfAttEventByCodAndCheckCrs (&Att);
|
||||
|
||||
/***** Hide attendance event *****/
|
||||
DB_BuildQuery ("UPDATE att_events SET Hidden='Y'"
|
||||
DB_QueryUPDATE ("can not hide attendance event",
|
||||
"UPDATE att_events SET Hidden='Y'"
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not hide attendance event");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1011,10 +1011,10 @@ void Att_ShowAttEvent (void)
|
|||
Att_GetDataOfAttEventByCodAndCheckCrs (&Att);
|
||||
|
||||
/***** Hide attendance event *****/
|
||||
DB_BuildQuery ("UPDATE att_events SET Hidden='N'"
|
||||
DB_QueryUPDATE ("can not show attendance event",
|
||||
"UPDATE att_events SET Hidden='N'"
|
||||
" WHERE AttCod=%ld AND CrsCod=%ld",
|
||||
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not show attendance event");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1386,7 +1386,8 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt)
|
|||
void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt)
|
||||
{
|
||||
/***** Update the data of the attendance event *****/
|
||||
DB_BuildQuery ("UPDATE att_events SET "
|
||||
DB_QueryUPDATE ("can not update attendance event",
|
||||
"UPDATE att_events SET "
|
||||
"Hidden='%c',"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
|
@ -1401,7 +1402,6 @@ void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt)
|
|||
Att->Title,
|
||||
Txt,
|
||||
Att->AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update attendance event");
|
||||
|
||||
/***** Update groups *****/
|
||||
/* Remove old groups */
|
||||
|
@ -2592,13 +2592,11 @@ void Att_RegUsrInAttEventNotChangingComments (long AttCod,long UsrCod)
|
|||
{
|
||||
// If already present ==> nothing to do
|
||||
if (!Present)
|
||||
{
|
||||
/***** Set user as present in database *****/
|
||||
DB_BuildQuery ("UPDATE att_usr SET Present='Y'"
|
||||
DB_QueryUPDATE ("can not set user as present in an event",
|
||||
"UPDATE att_usr SET Present='Y'"
|
||||
" WHERE AttCod=%ld AND UsrCod=%ld",
|
||||
AttCod,UsrCod);
|
||||
DB_QueryUPDATE_new ("can not set user as present in an event");
|
||||
}
|
||||
}
|
||||
else // User is not in table att_usr
|
||||
Att_RegUsrInAttEventChangingComments (AttCod,UsrCod,true,"","");
|
||||
|
|
|
@ -572,14 +572,12 @@ static void Ban_ShowOrHideBanner (bool Hide)
|
|||
|
||||
/***** Mark file as hidden/visible in database *****/
|
||||
if (Ban.Hidden != Hide)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE banners SET Hidden='%c'"
|
||||
DB_QueryUPDATE ("can not change status of a banner in database",
|
||||
"UPDATE banners SET Hidden='%c'"
|
||||
" WHERE BanCod=%ld",
|
||||
Hide ? 'Y' :
|
||||
'N',
|
||||
Ban.BanCod);
|
||||
DB_QueryUPDATE_new ("can not change status of a banner in database");
|
||||
}
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -725,9 +723,9 @@ static void Ban_UpdateBanNameDB (long BanCod,const char *FieldName,
|
|||
const char *NewBanName)
|
||||
{
|
||||
/***** Update banner changing old name by new name *****/
|
||||
DB_BuildQuery ("UPDATE banners SET %s='%s' WHERE BanCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of a banner",
|
||||
"UPDATE banners SET %s='%s' WHERE BanCod=%ld",
|
||||
FieldName,NewBanName,BanCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of a banner");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -755,9 +753,9 @@ void Ban_ChangeBannerImg (void)
|
|||
if (NewImg[0])
|
||||
{
|
||||
/* Update the table changing old image by new image */
|
||||
DB_BuildQuery ("UPDATE banners SET Img='%s' WHERE BanCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the image of a banner",
|
||||
"UPDATE banners SET Img='%s' WHERE BanCod=%ld",
|
||||
NewImg,Ban->BanCod);
|
||||
DB_QueryUPDATE_new ("can not update the image of a banner");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -800,9 +798,9 @@ void Ban_ChangeBannerWWW (void)
|
|||
if (NewWWW[0])
|
||||
{
|
||||
/* Update the table changing old WWW by new WWW */
|
||||
DB_BuildQuery ("UPDATE banners SET WWW='%s' WHERE BanCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the web of a banner",
|
||||
"UPDATE banners SET WWW='%s' WHERE BanCod=%ld",
|
||||
NewWWW,Ban->BanCod);
|
||||
DB_QueryUPDATE_new ("can not update the web of a banner");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -151,13 +151,11 @@ void Cal_ChangeFirstDayOfWeek (void)
|
|||
|
||||
/***** Store icon first day of week database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_data SET FirstDayOfWeek=%u"
|
||||
DB_QueryUPDATE ("can not update your preference about first day of week",
|
||||
"UPDATE usr_data SET FirstDayOfWeek=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your preference about first day of week");
|
||||
}
|
||||
|
||||
/***** Set preferences from current IP *****/
|
||||
Pre_SetPrefsFromIP ();
|
||||
|
|
|
@ -1876,9 +1876,9 @@ void Ctr_ContEditAfterChgCtrInConfig (void)
|
|||
static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod)
|
||||
{
|
||||
/***** Update institution in table of centres *****/
|
||||
DB_BuildQuery ("UPDATE centres SET InsCod=%ld WHERE CtrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the institution of a centre",
|
||||
"UPDATE centres SET InsCod=%ld WHERE CtrCod=%ld",
|
||||
InsCod,CtrCod);
|
||||
DB_QueryUPDATE_new ("can not update the institution of a centre");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1939,9 +1939,9 @@ void Ctr_ChangeCtrPlcInConfig (void)
|
|||
|
||||
static void Ctr_UpdateCtrPlcDB (long CtrCod,long NewPlcCod)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE centres SET PlcCod=%ld WHERE CtrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the place of a centre",
|
||||
"UPDATE centres SET PlcCod=%ld WHERE CtrCod=%ld",
|
||||
NewPlcCod,CtrCod);
|
||||
DB_QueryUPDATE_new ("can not update the place of a centre");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2079,9 +2079,9 @@ static bool Ctr_CheckIfCtrNameExistsInIns (const char *FieldName,const char *Nam
|
|||
static void Ctr_UpdateInsNameDB (long CtrCod,const char *FieldName,const char *NewCtrName)
|
||||
{
|
||||
/***** Update centre changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE centres SET %s='%s' WHERE CtrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of a centre",
|
||||
"UPDATE centres SET %s='%s' WHERE CtrCod=%ld",
|
||||
FieldName,NewCtrName,CtrCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of a centre");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2165,9 +2165,9 @@ static void Ctr_UpdateCtrWWWDB (long CtrCod,
|
|||
const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
||||
{
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
DB_BuildQuery ("UPDATE centres SET WWW='%s' WHERE CtrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the web of a centre",
|
||||
"UPDATE centres SET WWW='%s' WHERE CtrCod=%ld",
|
||||
NewWWW,CtrCod);
|
||||
DB_QueryUPDATE_new ("can not update the web of a centre");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2198,9 +2198,9 @@ void Ctr_ChangeCtrStatus (void)
|
|||
Ctr_GetDataOfCentreByCod (&Gbl.Ctrs.EditingCtr);
|
||||
|
||||
/***** Update status in table of centres *****/
|
||||
DB_BuildQuery ("UPDATE centres SET Status=%u WHERE CtrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the status of a centre",
|
||||
"UPDATE centres SET Status=%u WHERE CtrCod=%ld",
|
||||
(unsigned) Status,Gbl.Ctrs.EditingCtr.CtrCod);
|
||||
DB_QueryUPDATE_new ("can not update the status of a centre");
|
||||
Gbl.Ctrs.EditingCtr.Status = Status;
|
||||
|
||||
/***** Write message to show the change made
|
||||
|
@ -2480,10 +2480,11 @@ void Ctr_ChangeCtrPhotoAttribution (void)
|
|||
Par_GetParToText ("Attribution",NewPhotoAttribution,Img_MAX_BYTES_ATTRIBUTION);
|
||||
|
||||
/***** Update the table changing old attribution by new attribution *****/
|
||||
DB_BuildQuery ("UPDATE centres SET PhotoAttribution='%s'"
|
||||
DB_QueryUPDATE ("can not update the photo attribution"
|
||||
" of the current centre",
|
||||
"UPDATE centres SET PhotoAttribution='%s'"
|
||||
" WHERE CtrCod=%ld",
|
||||
NewPhotoAttribution,Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
DB_QueryUPDATE_new ("can not update the photo attribution of the current centre");
|
||||
|
||||
/***** Show the centre information again *****/
|
||||
Ctr_ShowConfiguration ();
|
||||
|
|
|
@ -355,10 +355,11 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.11.23 (2018-11-03)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.11.24 (2018-11-03)"
|
||||
#define CSS_FILE "swad18.4.css"
|
||||
#define JS_FILE "swad17.17.1.js"
|
||||
/*
|
||||
Version 18.11.24: Nov 03, 2018 Joining building and performing query into one function. (236636 lines)
|
||||
Version 18.11.23: Nov 03, 2018 Joining building and performing query into one function. (236630 lines)
|
||||
Version 18.11.22: Nov 02, 2018 Joining building and performing query into one function. (236589 lines)
|
||||
Version 18.11.21: Nov 02, 2018 Joining building and performing query into one function. (236580 lines)
|
||||
|
|
|
@ -1868,9 +1868,9 @@ static bool Cty_CheckIfCountryNameExists (Txt_Language_t Language,const char *Na
|
|||
static void Cty_UpdateCtyNameDB (long CtyCod,const char *FieldName,const char *NewCtyName)
|
||||
{
|
||||
/***** Update country changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE countries SET %s='%s' WHERE CtyCod='%03ld'",
|
||||
DB_QueryUPDATE ("can not update the name of a country",
|
||||
"UPDATE countries SET %s='%s' WHERE CtyCod='%03ld'",
|
||||
FieldName,NewCtyName,CtyCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of a country");
|
||||
|
||||
/***** Flush cache *****/
|
||||
Cty_FlushCacheCountryName ();
|
||||
|
@ -1903,10 +1903,10 @@ void Cty_ChangeCtyWWW (void)
|
|||
Cty_GetDataOfCountryByCod (Cty,Cty_GET_EXTRA_DATA);
|
||||
|
||||
/***** Update the table changing old WWW by new WWW *****/
|
||||
DB_BuildQuery ("UPDATE countries SET WWW_%s='%s'"
|
||||
DB_QueryUPDATE ("can not update the web of a country",
|
||||
"UPDATE countries SET WWW_%s='%s'"
|
||||
" WHERE CtyCod='%03ld'",
|
||||
Txt_STR_LANG_ID[Language],NewWWW,Cty->CtyCod);
|
||||
DB_QueryUPDATE_new ("can not update the web of a country");
|
||||
Str_Copy (Cty->WWW[Language],NewWWW,
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
|
@ -1933,10 +1933,10 @@ void Cty_ChangeCtyMapAttribution (void)
|
|||
Par_GetParToText ("Attribution",NewMapAttribution,Img_MAX_BYTES_ATTRIBUTION);
|
||||
|
||||
/***** Update the table changing old attribution by new attribution *****/
|
||||
DB_BuildQuery ("UPDATE countries SET MapAttribution='%s'"
|
||||
DB_QueryUPDATE ("can not update the map attribution of a country",
|
||||
"UPDATE countries SET MapAttribution='%s'"
|
||||
" WHERE CtyCod='%03ld'",
|
||||
NewMapAttribution,Gbl.CurrentCty.Cty.CtyCod);
|
||||
DB_QueryUPDATE_new ("can not update the map attribution of a country");
|
||||
|
||||
/***** Show the country information again *****/
|
||||
Cty_ShowConfiguration ();
|
||||
|
|
|
@ -2183,10 +2183,10 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
|
||||
/***** Remove exam announcements in the course *****/
|
||||
/* Mark all exam announcements in the course as deleted */
|
||||
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u"
|
||||
DB_QueryUPDATE ("can not remove exam announcements of a course",
|
||||
"UPDATE exam_announcements SET Status=%u"
|
||||
" WHERE CrsCod=%ld",
|
||||
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,CrsCod);
|
||||
DB_QueryUPDATE_new ("can not remove exam announcements of a course");
|
||||
|
||||
/***** Remove course cards of the course *****/
|
||||
/* Remove content of course cards */
|
||||
|
@ -2445,9 +2445,9 @@ void Crs_ContEditAfterChgCrsInConfig (void)
|
|||
static void Crs_UpdateCrsDegDB (long CrsCod,long DegCod)
|
||||
{
|
||||
/***** Update degree in table of courses *****/
|
||||
DB_BuildQuery ("UPDATE courses SET DegCod=%ld WHERE CrsCod=%ld",
|
||||
DB_QueryUPDATE ("can not move course to another degree",
|
||||
"UPDATE courses SET DegCod=%ld WHERE CrsCod=%ld",
|
||||
DegCod,CrsCod);
|
||||
DB_QueryUPDATE_new ("can not move course to another degree");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2591,9 +2591,9 @@ void Crs_ChangeCrsYear (void)
|
|||
static void Crs_UpdateCrsYear (struct Course *Crs,unsigned NewYear)
|
||||
{
|
||||
/***** Update year/semester in table of courses *****/
|
||||
DB_BuildQuery ("UPDATE courses SET Year=%u WHERE CrsCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the year of a course",
|
||||
"UPDATE courses SET Year=%u WHERE CrsCod=%ld",
|
||||
NewYear,Crs->CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update the year of a course");
|
||||
|
||||
/***** Copy course year/semester *****/
|
||||
Crs->Year = NewYear;
|
||||
|
@ -2606,10 +2606,10 @@ static void Crs_UpdateCrsYear (struct Course *Crs,unsigned NewYear)
|
|||
void Crs_UpdateInstitutionalCrsCod (struct Course *Crs,const char *NewInstitutionalCrsCod)
|
||||
{
|
||||
/***** Update institutional course code in table of courses *****/
|
||||
DB_BuildQuery ("UPDATE courses SET InsCrsCod='%s' WHERE CrsCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the institutional code"
|
||||
" of the current course",
|
||||
"UPDATE courses SET InsCrsCod='%s' WHERE CrsCod=%ld",
|
||||
NewInstitutionalCrsCod,Crs->CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update the institutional code"
|
||||
" of the current course");
|
||||
|
||||
/***** Copy institutional course code *****/
|
||||
Str_Copy (Crs->InstitutionalCrsCod,NewInstitutionalCrsCod,
|
||||
|
@ -2766,9 +2766,9 @@ static bool Crs_CheckIfCrsNameExistsInYearOfDeg (const char *FieldName,const cha
|
|||
static void Crs_UpdateCrsNameDB (long CrsCod,const char *FieldName,const char *NewCrsName)
|
||||
{
|
||||
/***** Update course changing old name by new name *****/
|
||||
DB_BuildQuery ("UPDATE courses SET %s='%s' WHERE CrsCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of a course",
|
||||
"UPDATE courses SET %s='%s' WHERE CrsCod=%ld",
|
||||
FieldName,NewCrsName,CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of a course");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2800,9 +2800,9 @@ void Crs_ChangeCrsStatus (void)
|
|||
Crs_GetDataOfCourseByCod (&Gbl.Degs.EditingCrs);
|
||||
|
||||
/***** Update status in table of courses *****/
|
||||
DB_BuildQuery ("UPDATE courses SET Status=%u WHERE CrsCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the status of a course",
|
||||
"UPDATE courses SET Status=%u WHERE CrsCod=%ld",
|
||||
(unsigned) Status,Gbl.Degs.EditingCrs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update the status of a course");
|
||||
Gbl.Degs.EditingCrs.Status = Status;
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
|
@ -3356,13 +3356,11 @@ void Crs_UpdateCrsLast (void)
|
|||
{
|
||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
|
||||
Gbl.Usrs.Me.Role.Logged >= Rol_STD)
|
||||
{
|
||||
/***** Update my last access to current course *****/
|
||||
DB_BuildQuery ("REPLACE INTO crs_last (CrsCod,LastTime)"
|
||||
DB_QueryUPDATE ("can not update last access to current course",
|
||||
"REPLACE INTO crs_last (CrsCod,LastTime)"
|
||||
" VALUES (%ld,NOW())",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update last access to current course");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -3313,9 +3313,22 @@ void DB_QueryREPLACE (const char *MsgError,const char *fmt,...)
|
|||
/******************** Make a UPDATE query from database **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void DB_QueryUPDATE_new (const char *MsgError)
|
||||
void DB_QueryUPDATE (const char *MsgError,const char *fmt,...)
|
||||
{
|
||||
DB_QueryUPDATE_old (&Gbl.DB.QueryPtr,MsgError);
|
||||
va_list ap;
|
||||
int NumBytesPrinted;
|
||||
char *Query = NULL;
|
||||
|
||||
va_start (ap,fmt);
|
||||
NumBytesPrinted = vasprintf (&Query,fmt,ap);
|
||||
va_end (ap);
|
||||
|
||||
if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
|
||||
// or some other error occurs,
|
||||
// vasprintf will return -1
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
|
||||
DB_QueryUPDATE_old (&Query,MsgError);
|
||||
}
|
||||
|
||||
void DB_QueryUPDATE_old (char **Query,const char *MsgError)
|
||||
|
|
|
@ -55,7 +55,7 @@ long DB_QueryINSERTandReturnCode (const char *MsgError,const char *fmt,...);
|
|||
|
||||
void DB_QueryREPLACE (const char *MsgError,const char *fmt,...);
|
||||
|
||||
void DB_QueryUPDATE_new (const char *MsgError);
|
||||
void DB_QueryUPDATE (const char *MsgError,const char *fmt,...);
|
||||
void DB_QueryUPDATE_old (char **Query,const char *MsgError);
|
||||
|
||||
void DB_QueryDELETE (const char *MsgError,const char *fmt,...);
|
||||
|
|
|
@ -184,13 +184,11 @@ void Dat_ChangeDateFormat (void)
|
|||
|
||||
/***** Store date format in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_data SET DateFormat=%u"
|
||||
DB_QueryUPDATE ("can not update your preference about date format",
|
||||
"UPDATE usr_data SET DateFormat=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
(unsigned) Gbl.Prefs.DateFormat,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your preference about date format");
|
||||
}
|
||||
|
||||
/***** Set preferences from current IP *****/
|
||||
Pre_SetPrefsFromIP ();
|
||||
|
|
|
@ -2040,9 +2040,9 @@ static bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Nam
|
|||
static void Deg_UpdateDegNameDB (long DegCod,const char *FieldName,const char *NewDegName)
|
||||
{
|
||||
/***** Update degree changing old name by new name *****/
|
||||
DB_BuildQuery ("UPDATE degrees SET %s='%s' WHERE DegCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of a degree",
|
||||
"UPDATE degrees SET %s='%s' WHERE DegCod=%ld",
|
||||
FieldName,NewDegName,DegCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of a degree");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2119,9 +2119,9 @@ void Deg_ContEditAfterChgDegInConfig (void)
|
|||
static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod)
|
||||
{
|
||||
/***** Update centre in table of degrees *****/
|
||||
DB_BuildQuery ("UPDATE degrees SET CtrCod=%ld WHERE DegCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the centre of a degree",
|
||||
"UPDATE degrees SET CtrCod=%ld WHERE DegCod=%ld",
|
||||
CtrCod,DegCod);
|
||||
DB_QueryUPDATE_new ("can not update the centre of a degree");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2205,9 +2205,9 @@ void Deg_ChangeDegWWWInConfig (void)
|
|||
static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
||||
{
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
DB_BuildQuery ("UPDATE degrees SET WWW='%s' WHERE DegCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the web of a degree",
|
||||
"UPDATE degrees SET WWW='%s' WHERE DegCod=%ld",
|
||||
NewWWW,DegCod);
|
||||
DB_QueryUPDATE_new ("can not update the web of a degree");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2239,9 +2239,9 @@ void Deg_ChangeDegStatus (void)
|
|||
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
|
||||
|
||||
/***** Update status in table of degrees *****/
|
||||
DB_BuildQuery ("UPDATE degrees SET Status=%u WHERE DegCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the status of a degree",
|
||||
"UPDATE degrees SET Status=%u WHERE DegCod=%ld",
|
||||
(unsigned) Status,Gbl.Degs.EditingDeg.DegCod);
|
||||
DB_QueryUPDATE_new ("can not update the status of a degree");
|
||||
|
||||
Gbl.Degs.EditingDeg.Status = Status;
|
||||
|
||||
|
|
|
@ -957,10 +957,10 @@ void DT_RenameDegreeType (void)
|
|||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE deg_types SET DegTypName='%s'"
|
||||
DB_QueryUPDATE ("can not update the type of a degree",
|
||||
"UPDATE deg_types SET DegTypName='%s'"
|
||||
" WHERE DegTypCod=%ld",
|
||||
NewNameDegTyp,DegTyp->DegTypCod);
|
||||
DB_QueryUPDATE_new ("can not update the type of a degree");
|
||||
|
||||
/* Write message to show the change made */
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1017,9 +1017,9 @@ void DT_ChangeDegreeType (void)
|
|||
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
|
||||
|
||||
/***** Update the table of degrees changing old type by new type *****/
|
||||
DB_BuildQuery ("UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the type of a degree",
|
||||
"UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld",
|
||||
NewDegTypCod,Gbl.Degs.EditingDeg.DegCod);
|
||||
DB_QueryUPDATE_new ("can not update the type of a degree");
|
||||
|
||||
/***** Write message to show the change made
|
||||
and put button to go to degree changed *****/
|
||||
|
|
|
@ -652,9 +652,9 @@ void Dpt_ChangeDepartIns (void)
|
|||
Dpt->InsCod = Ins_GetAndCheckParamOtherInsCod (1);
|
||||
|
||||
/***** Update institution in table of departments *****/
|
||||
DB_BuildQuery ("UPDATE departments SET InsCod=%ld WHERE DptCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the institution of a department",
|
||||
"UPDATE departments SET InsCod=%ld WHERE DptCod=%ld",
|
||||
Dpt->InsCod,Dpt->DptCod);
|
||||
DB_QueryUPDATE_new ("can not update the institution of a department");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_institution_of_the_department_has_changed);
|
||||
|
@ -794,9 +794,9 @@ static bool Dpt_CheckIfDepartmentNameExists (const char *FieldName,const char *N
|
|||
static void Dpt_UpdateDegNameDB (long DptCod,const char *FieldName,const char *NewDptName)
|
||||
{
|
||||
/***** Update department changing old name by new name *****/
|
||||
DB_BuildQuery ("UPDATE departments SET %s='%s' WHERE DptCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of a department",
|
||||
"UPDATE departments SET %s='%s' WHERE DptCod=%ld",
|
||||
FieldName,NewDptName,DptCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of a department");
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -823,9 +823,9 @@ void Dpt_ChangeDptWWW (void)
|
|||
if (NewWWW[0])
|
||||
{
|
||||
/* Update the table changing old WWW by new WWW */
|
||||
DB_BuildQuery ("UPDATE departments SET WWW='%s' WHERE DptCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the web of a department",
|
||||
"UPDATE departments SET WWW='%s' WHERE DptCod=%ld",
|
||||
NewWWW,Dpt->DptCod);
|
||||
DB_QueryUPDATE_new ("can not update the web of a department");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -221,10 +221,10 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
|
|||
}
|
||||
|
||||
/***** Update the role of a user in a course *****/
|
||||
DB_BuildQuery ("UPDATE crs_usr SET Role=%u"
|
||||
DB_QueryUPDATE ("can not modify user's role in course",
|
||||
"UPDATE crs_usr SET Role=%u"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
(unsigned) NewRole,Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
|
||||
DB_QueryUPDATE_new ("can not modify user's role in course");
|
||||
|
||||
/***** Flush caches *****/
|
||||
Usr_FlushCachesUsr ();
|
||||
|
@ -526,7 +526,8 @@ void Enr_UpdateUsrData (struct UsrData *UsrDat)
|
|||
|
||||
/***** Update user's common data *****/
|
||||
Usr_CreateBirthdayStrDB (UsrDat,BirthdayStrDB); // It can include start and ending apostrophes
|
||||
DB_BuildQuery ("UPDATE usr_data"
|
||||
DB_QueryUPDATE ("can not update user's data",
|
||||
"UPDATE usr_data"
|
||||
" SET Password='%s',"
|
||||
"Surname1='%s',Surname2='%s',FirstName='%s',Sex='%s',"
|
||||
"CtyCod=%ld,"
|
||||
|
@ -546,7 +547,6 @@ void Enr_UpdateUsrData (struct UsrData *UsrDat)
|
|||
UsrDat->Comments ? UsrDat->Comments :
|
||||
"",
|
||||
UsrDat->UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update user's data");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -569,7 +569,8 @@ void Enr_FilterUsrDat (struct UsrData *UsrDat)
|
|||
|
||||
void Enr_UpdateInstitutionCentreDepartment (void)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_data"
|
||||
DB_QueryUPDATE ("can not update institution, centre and department",
|
||||
"UPDATE usr_data"
|
||||
" SET InsCtyCod=%ld,InsCod=%ld,CtrCod=%ld,DptCod=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.InsCtyCod,
|
||||
|
@ -577,7 +578,6 @@ void Enr_UpdateInstitutionCentreDepartment (void)
|
|||
Gbl.Usrs.Me.UsrDat.Tch.CtrCod,
|
||||
Gbl.Usrs.Me.UsrDat.Tch.DptCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update institution, centre and department");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2044,15 +2044,13 @@ void Enr_SignUpInCrs (void)
|
|||
|
||||
/***** Request user in current course in database *****/
|
||||
if (ReqCod > 0) // Old request exists in database
|
||||
{
|
||||
DB_BuildQuery ("UPDATE crs_usr_requests SET Role=%u,RequestTime=NOW()"
|
||||
DB_QueryUPDATE ("can not update enrolment request",
|
||||
"UPDATE crs_usr_requests SET Role=%u,RequestTime=NOW()"
|
||||
" WHERE ReqCod=%ld AND CrsCod=%ld AND UsrCod=%ld",
|
||||
(unsigned) RoleFromForm,
|
||||
ReqCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update enrolment request");
|
||||
}
|
||||
else // No request in database for this user in this course
|
||||
ReqCod =
|
||||
DB_QueryINSERTandReturnCode ("can not save enrolment request",
|
||||
|
@ -3061,7 +3059,8 @@ static void Enr_RemoveExpiredEnrolmentRequests (void)
|
|||
{
|
||||
/***** Mark possible notifications as removed
|
||||
Important: do this before removing the request *****/
|
||||
DB_BuildQuery ("UPDATE notif,crs_usr_requests"
|
||||
DB_QueryUPDATE ("can not set notification(s) as removed",
|
||||
"UPDATE notif,crs_usr_requests"
|
||||
" SET notif.Status=(notif.Status | %u)"
|
||||
" WHERE notif.NotifyEvent=%u"
|
||||
" AND notif.Cod=crs_usr_requests.ReqCod"
|
||||
|
@ -3069,7 +3068,6 @@ static void Enr_RemoveExpiredEnrolmentRequests (void)
|
|||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
(unsigned) Ntf_EVENT_ENROLMENT_REQUEST,
|
||||
Cfg_TIME_TO_DELETE_ENROLMENT_REQUESTS);
|
||||
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||
|
||||
/***** Remove expired requests for enrolment *****/
|
||||
DB_QueryDELETE ("can not remove expired requests for enrolment",
|
||||
|
@ -4127,10 +4125,10 @@ void Enr_ModifyUsr2 (void)
|
|||
void Enr_AcceptUsrInCrs (long UsrCod)
|
||||
{
|
||||
/***** Set enrolment of a user to "accepted" in the current course *****/
|
||||
DB_BuildQuery ("UPDATE crs_usr SET Accepted='Y'"
|
||||
DB_QueryUPDATE ("can not confirm user's enrolment",
|
||||
"UPDATE crs_usr SET Accepted='Y'"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,UsrCod);
|
||||
DB_QueryUPDATE_new ("can not confirm user's enrolment");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
21
swad_exam.c
21
swad_exam.c
|
@ -319,10 +319,11 @@ void Exa_ReceiveExamAnnouncement2 (void)
|
|||
static void Exa_UpdateNumUsrsNotifiedByEMailAboutExamAnnouncement (long ExaCod,unsigned NumUsrsToBeNotifiedByEMail)
|
||||
{
|
||||
/***** Update number of users notified *****/
|
||||
DB_BuildQuery ("UPDATE exam_announcements SET NumNotif=NumNotif+%u"
|
||||
DB_QueryUPDATE ("can not update the number of notifications"
|
||||
" of an exam announcement",
|
||||
"UPDATE exam_announcements SET NumNotif=NumNotif+%u"
|
||||
" WHERE ExaCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,ExaCod);
|
||||
DB_QueryUPDATE_new ("can not update the number of notifications of an exam announcement");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -391,11 +392,11 @@ void Exa_RemoveExamAnnouncement1 (void)
|
|||
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
||||
|
||||
/***** Mark the exam announcement as deleted in the database *****/
|
||||
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u"
|
||||
DB_QueryUPDATE ("can not remove exam announcement",
|
||||
"UPDATE exam_announcements SET Status=%u"
|
||||
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
||||
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,
|
||||
ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not remove exam announcement");
|
||||
|
||||
/***** Mark possible notifications as removed *****/
|
||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_EXAM_ANNOUNCEMENT,ExaCod);
|
||||
|
@ -433,11 +434,11 @@ void Exa_HideExamAnnouncement1 (void)
|
|||
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
||||
|
||||
/***** Mark the exam announcement as hidden in the database *****/
|
||||
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u"
|
||||
DB_QueryUPDATE ("can not hide exam announcement",
|
||||
"UPDATE exam_announcements SET Status=%u"
|
||||
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
||||
(unsigned) Exa_HIDDEN_EXAM_ANNOUNCEMENT,
|
||||
ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not hide exam announcement");
|
||||
}
|
||||
|
||||
void Exa_HideExamAnnouncement2 (void)
|
||||
|
@ -466,11 +467,11 @@ void Exa_UnhideExamAnnouncement1 (void)
|
|||
Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
|
||||
|
||||
/***** Mark the exam announcement as visible in the database *****/
|
||||
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u"
|
||||
DB_QueryUPDATE ("can not unhide exam announcement",
|
||||
"UPDATE exam_announcements SET Status=%u"
|
||||
" WHERE ExaCod=%ld AND CrsCod=%ld",
|
||||
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT,
|
||||
ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not unhide exam announcement");
|
||||
}
|
||||
|
||||
void Exa_UnhideExamAnnouncement2 (void)
|
||||
|
@ -774,7 +775,8 @@ static long Exa_AddExamAnnouncementToDB (void)
|
|||
static void Exa_ModifyExamAnnouncementInDB (void)
|
||||
{
|
||||
/***** Modify exam announcement *****/
|
||||
DB_BuildQuery ("UPDATE exam_announcements"
|
||||
DB_QueryUPDATE ("can not update an exam announcement",
|
||||
"UPDATE exam_announcements"
|
||||
" SET CrsFullName='%s',Year=%u,ExamSession='%s',"
|
||||
"ExamDate='%04u-%02u-%02u %02u:%02u:00',"
|
||||
"Duration='%02u:%02u:00',"
|
||||
|
@ -799,7 +801,6 @@ static void Exa_ModifyExamAnnouncementInDB (void)
|
|||
Gbl.ExamAnns.ExaDat.MatAllowed,
|
||||
Gbl.ExamAnns.ExaDat.OtherInfo,
|
||||
Gbl.ExamAnns.ExaDat.ExaCod);
|
||||
DB_QueryUPDATE_new ("can not update an exam announcement");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -4262,11 +4262,11 @@ static void Brw_UpdateLastAccess (void)
|
|||
static void Brw_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod)
|
||||
{
|
||||
/***** Update the group of my last access to a common zone *****/
|
||||
DB_BuildQuery ("UPDATE crs_usr SET %s=%ld"
|
||||
DB_QueryUPDATE ("can not update the group of the last access to a file browser",
|
||||
"UPDATE crs_usr SET %s=%ld"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
FieldNameDB,GrpCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update the group of the last access to a file browser");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -7831,7 +7831,8 @@ static void Brw_UpdatePathInClipboard (void)
|
|||
long WorksUsrCod = Brw_GetWorksUsrCodForClipboard ();
|
||||
|
||||
/***** Update path in my clipboard *****/
|
||||
DB_BuildQuery ("UPDATE clipboard SET FileBrowser=%u,"
|
||||
DB_QueryUPDATE ("can not update source of copy in clipboard",
|
||||
"UPDATE clipboard SET FileBrowser=%u,"
|
||||
"Cod=%ld,WorksUsrCod=%ld,"
|
||||
"FileType=%u,Path='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
|
@ -7839,7 +7840,6 @@ static void Brw_UpdatePathInClipboard (void)
|
|||
Cod,WorksUsrCod,
|
||||
(unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update source of copy in clipboard");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -7986,7 +7986,8 @@ static void Brw_UpdateClickTimeOfThisFileBrowserInExpandedFolders (void)
|
|||
if (Cod > 0)
|
||||
{
|
||||
if (WorksUsrCod > 0)
|
||||
DB_BuildQuery ("UPDATE expanded_folders SET ClickTime=NOW()"
|
||||
DB_QueryUPDATE ("can not update expanded folder",
|
||||
"UPDATE expanded_folders SET ClickTime=NOW()"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld AND WorksUsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -7994,7 +7995,8 @@ static void Brw_UpdateClickTimeOfThisFileBrowserInExpandedFolders (void)
|
|||
Cod,
|
||||
WorksUsrCod);
|
||||
else
|
||||
DB_BuildQuery ("UPDATE expanded_folders SET ClickTime=NOW()"
|
||||
DB_QueryUPDATE ("can not update expanded folder",
|
||||
"UPDATE expanded_folders SET ClickTime=NOW()"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -8002,11 +8004,11 @@ static void Brw_UpdateClickTimeOfThisFileBrowserInExpandedFolders (void)
|
|||
Cod);
|
||||
}
|
||||
else // Briefcase
|
||||
DB_BuildQuery ("UPDATE expanded_folders SET ClickTime=NOW()"
|
||||
DB_QueryUPDATE ("can not update expanded folder",
|
||||
"UPDATE expanded_folders SET ClickTime=NOW()"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders);
|
||||
DB_QueryUPDATE_new ("can not update expanded folder");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -8104,7 +8106,8 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
|||
if (MyUsrCod > 0)
|
||||
{
|
||||
if (WorksUsrCod > 0)
|
||||
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
DB_QueryUPDATE ("can not update expanded folders",
|
||||
"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld AND WorksUsrCod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
|
@ -8113,7 +8116,8 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
|||
Cod,WorksUsrCod,
|
||||
OldPath);
|
||||
else
|
||||
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
DB_QueryUPDATE ("can not update expanded folders",
|
||||
"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Cod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
|
@ -8125,7 +8129,8 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
|||
else // MyUsrCod <= 0 means expanded folders for any user
|
||||
{
|
||||
if (WorksUsrCod > 0)
|
||||
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
DB_QueryUPDATE ("can not update expanded folders",
|
||||
"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||
" AND WorksUsrCod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
|
@ -8134,7 +8139,8 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
|||
WorksUsrCod,
|
||||
OldPath);
|
||||
else
|
||||
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
DB_QueryUPDATE ("can not update expanded folders",
|
||||
"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
NewPath,StartFinalSubpathNotChanged,
|
||||
|
@ -8143,14 +8149,14 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
|
|||
}
|
||||
}
|
||||
else // Briefcase
|
||||
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
DB_QueryUPDATE ("can not update expanded folders",
|
||||
"UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
NewPath,StartFinalSubpathNotChanged,
|
||||
MyUsrCod,
|
||||
(unsigned) FileBrowserForExpandedFolders,
|
||||
OldPath);
|
||||
DB_QueryUPDATE_new ("can not update expanded folders");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -11552,13 +11558,11 @@ static unsigned Brw_GetFileViewsFromMe (long FilCod)
|
|||
static void Brw_UpdateFileViews (unsigned NumViews,long FilCod)
|
||||
{
|
||||
if (NumViews)
|
||||
{
|
||||
/* Update number of views in database */
|
||||
DB_BuildQuery ("UPDATE file_view SET NumViews=NumViews+1"
|
||||
DB_QueryUPDATE ("can not update number of views of a file",
|
||||
"UPDATE file_view SET NumViews=NumViews+1"
|
||||
" WHERE FilCod=%ld AND UsrCod=%ld",
|
||||
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update number of views of a file");
|
||||
}
|
||||
else // NumViews == 0
|
||||
/* Insert number of views in database */
|
||||
DB_QueryINSERT ("can not insert number of views of a file",
|
||||
|
@ -11629,7 +11633,8 @@ static void Brw_ChangeFileOrFolderHiddenInDB (const char Path[PATH_MAX + 1],bool
|
|||
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||
|
||||
/***** Mark file as hidden in database *****/
|
||||
DB_BuildQuery ("UPDATE files SET Hidden='%c'"
|
||||
DB_QueryUPDATE ("can not change status of a file in database",
|
||||
"UPDATE files SET Hidden='%c'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path='%s'",
|
||||
IsHidden ? 'Y' :
|
||||
|
@ -11637,7 +11642,6 @@ static void Brw_ChangeFileOrFolderHiddenInDB (const char Path[PATH_MAX + 1],bool
|
|||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
Path);
|
||||
DB_QueryUPDATE_new ("can not change status of a file in database");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -11651,7 +11655,8 @@ static void Brw_ChangeFilePublicInDB (long PublisherUsrCod,const char *Path,
|
|||
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||
|
||||
/***** Change publisher, public and license of file in database *****/
|
||||
DB_BuildQuery ("UPDATE files SET PublisherUsrCod=%ld,Public='%c',License=%u"
|
||||
DB_QueryUPDATE ("can not change metadata of a file in database",
|
||||
"UPDATE files SET PublisherUsrCod=%ld,Public='%c',License=%u"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path='%s'",
|
||||
PublisherUsrCod,
|
||||
|
@ -11661,7 +11666,6 @@ static void Brw_ChangeFilePublicInDB (long PublisherUsrCod,const char *Path,
|
|||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
Path);
|
||||
DB_QueryUPDATE_new ("can not change metadata of a file in database");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -11948,13 +11952,13 @@ static void Brw_RenameOneFolderInDB (const char OldPath[PATH_MAX + 1],
|
|||
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||
|
||||
/***** Update file or folder in table of common files *****/
|
||||
DB_BuildQuery ("UPDATE files SET Path='%s'"
|
||||
DB_QueryUPDATE ("can not update folder name in a common zone",
|
||||
"UPDATE files SET Path='%s'"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld AND Path='%s'",
|
||||
NewPath,
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
OldPath);
|
||||
DB_QueryUPDATE_new ("can not update folder name in a common zone");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -11969,14 +11973,14 @@ static void Brw_RenameChildrenFilesOrFoldersInDB (const char OldPath[PATH_MAX +
|
|||
unsigned StartFinalSubpathNotChanged = strlen (OldPath) + 2;
|
||||
|
||||
/***** Update children of a folder in table of files *****/
|
||||
DB_BuildQuery ("UPDATE files SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
DB_QueryUPDATE ("can not rename file or folder names in a common zone",
|
||||
"UPDATE files SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
NewPath,StartFinalSubpathNotChanged,
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
OldPath);
|
||||
DB_QueryUPDATE_new ("can not rename file or folder names in a common zone");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
28
swad_forum.c
28
swad_forum.c
|
@ -720,10 +720,10 @@ void For_GetForumTypeAndLocationOfAPost (long PstCod,struct Forum *Forum)
|
|||
static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod)
|
||||
{
|
||||
/***** Update the code of the first and last posts of a thread *****/
|
||||
DB_BuildQuery ("UPDATE forum_thread SET FirstPstCod=%ld,LastPstCod=%ld"
|
||||
DB_QueryUPDATE ("can not update a thread of a forum",
|
||||
"UPDATE forum_thread SET FirstPstCod=%ld,LastPstCod=%ld"
|
||||
" WHERE ThrCod=%ld",
|
||||
FirstPstCod,LastPstCod,ThrCod);
|
||||
DB_QueryUPDATE_new ("can not update a thread of a forum");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -733,10 +733,10 @@ static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long Last
|
|||
static void For_UpdateThrLastPst (long ThrCod,long LastPstCod)
|
||||
{
|
||||
/***** Update the code of the last post of a thread *****/
|
||||
DB_BuildQuery ("UPDATE forum_thread SET LastPstCod=%ld"
|
||||
DB_QueryUPDATE ("can not update a thread of a forum",
|
||||
"UPDATE forum_thread SET LastPstCod=%ld"
|
||||
" WHERE ThrCod=%ld",
|
||||
LastPstCod,ThrCod);
|
||||
DB_QueryUPDATE_new ("can not update a thread of a forum");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4072,10 +4072,10 @@ void For_ReceiveForumPost (void)
|
|||
static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumUsrsToBeNotifiedByEMail)
|
||||
{
|
||||
/***** Update number of users notified *****/
|
||||
DB_BuildQuery ("UPDATE forum_post SET NumNotif=NumNotif+%u"
|
||||
DB_QueryUPDATE ("can not update the number of notifications of a post",
|
||||
"UPDATE forum_post SET NumNotif=NumNotif+%u"
|
||||
" WHERE PstCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,PstCod);
|
||||
DB_QueryUPDATE_new ("can not update the number of notifications of a post");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4418,7 +4418,8 @@ static void For_MoveThrToCurrentForum (long ThrCod)
|
|||
case For_FORUM_GLOBAL_TCHS:
|
||||
case For_FORUM__SWAD__USRS:
|
||||
case For_FORUM__SWAD__TCHS:
|
||||
DB_BuildQuery ("UPDATE forum_thread"
|
||||
DB_QueryUPDATE ("can not move a thread to current forum",
|
||||
"UPDATE forum_thread"
|
||||
" SET ForumType=%u,Location=-1"
|
||||
" WHERE ThrCod=%ld",
|
||||
(unsigned) Gbl.Forum.ForumSelected.Type,
|
||||
|
@ -4426,7 +4427,8 @@ static void For_MoveThrToCurrentForum (long ThrCod)
|
|||
break;
|
||||
case For_FORUM_INSTIT_USRS:
|
||||
case For_FORUM_INSTIT_TCHS:
|
||||
DB_BuildQuery ("UPDATE forum_thread"
|
||||
DB_QueryUPDATE ("can not move a thread to current forum",
|
||||
"UPDATE forum_thread"
|
||||
" SET ForumType=%u,Location=%ld"
|
||||
" WHERE ThrCod=%ld",
|
||||
(unsigned) Gbl.Forum.ForumSelected.Type,
|
||||
|
@ -4435,7 +4437,8 @@ static void For_MoveThrToCurrentForum (long ThrCod)
|
|||
break;
|
||||
case For_FORUM_CENTRE_USRS:
|
||||
case For_FORUM_CENTRE_TCHS:
|
||||
DB_BuildQuery ("UPDATE forum_thread"
|
||||
DB_QueryUPDATE ("can not move a thread to current forum",
|
||||
"UPDATE forum_thread"
|
||||
" SET ForumType=%u,Location=%ld"
|
||||
" WHERE ThrCod=%ld",
|
||||
(unsigned) Gbl.Forum.ForumSelected.Type,
|
||||
|
@ -4444,7 +4447,8 @@ static void For_MoveThrToCurrentForum (long ThrCod)
|
|||
break;
|
||||
case For_FORUM_DEGREE_USRS:
|
||||
case For_FORUM_DEGREE_TCHS:
|
||||
DB_BuildQuery ("UPDATE forum_thread"
|
||||
DB_QueryUPDATE ("can not move a thread to current forum",
|
||||
"UPDATE forum_thread"
|
||||
" SET ForumType=%u,Location=%ld"
|
||||
" WHERE ThrCod=%ld",
|
||||
(unsigned) Gbl.Forum.ForumSelected.Type,
|
||||
|
@ -4453,7 +4457,8 @@ static void For_MoveThrToCurrentForum (long ThrCod)
|
|||
break;
|
||||
case For_FORUM_COURSE_USRS:
|
||||
case For_FORUM_COURSE_TCHS:
|
||||
DB_BuildQuery ("UPDATE forum_thread"
|
||||
DB_QueryUPDATE ("can not move a thread to current forum",
|
||||
"UPDATE forum_thread"
|
||||
" SET ForumType=%u,Location=%ld"
|
||||
" WHERE ThrCod=%ld",
|
||||
(unsigned) Gbl.Forum.ForumSelected.Type,
|
||||
|
@ -4464,7 +4469,6 @@ static void For_MoveThrToCurrentForum (long ThrCod)
|
|||
Lay_ShowErrorAndExit ("Wrong forum.");
|
||||
break;
|
||||
}
|
||||
DB_QueryUPDATE_new ("can not move a thread to current forum");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
31
swad_game.c
31
swad_game.c
|
@ -1623,11 +1623,12 @@ void Gam_ResetGame (void)
|
|||
Game.GamCod);
|
||||
|
||||
/***** Reset all the answers in this game *****/
|
||||
DB_BuildQuery ("UPDATE gam_answers,gam_questions SET gam_answers.NumUsrs=0"
|
||||
DB_QueryUPDATE ("can not reset answers of a game",
|
||||
"UPDATE gam_answers,gam_questions"
|
||||
" SET gam_answers.NumUsrs=0"
|
||||
" WHERE gam_questions.GamCod=%ld"
|
||||
" AND gam_questions.QstCod=gam_answers.QstCod",
|
||||
Game.GamCod);
|
||||
DB_QueryUPDATE_new ("can not reset answers of a game");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1658,8 +1659,9 @@ void Gam_HideGame (void)
|
|||
Lay_ShowErrorAndExit ("You can not hide this game.");
|
||||
|
||||
/***** Hide game *****/
|
||||
DB_BuildQuery ("UPDATE games SET Hidden='Y' WHERE GamCod=%ld",Game.GamCod);
|
||||
DB_QueryUPDATE_new ("can not hide game");
|
||||
DB_QueryUPDATE ("can not hide game",
|
||||
"UPDATE games SET Hidden='Y' WHERE GamCod=%ld",
|
||||
Game.GamCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1690,8 +1692,9 @@ void Gam_UnhideGame (void)
|
|||
Lay_ShowErrorAndExit ("You can not unhide this game.");
|
||||
|
||||
/***** Show game *****/
|
||||
DB_BuildQuery ("UPDATE games SET Hidden='N' WHERE GamCod=%ld",Game.GamCod);
|
||||
DB_QueryUPDATE_new ("can not show game");
|
||||
DB_QueryUPDATE ("can not show game",
|
||||
"UPDATE games SET Hidden='N' WHERE GamCod=%ld",
|
||||
Game.GamCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -2217,7 +2220,8 @@ static void Gam_UpdateGame (struct Game *Game,const char *Txt)
|
|||
extern const char *Txt_The_game_has_been_modified;
|
||||
|
||||
/***** Update the data of the game *****/
|
||||
DB_BuildQuery ("UPDATE games"
|
||||
DB_QueryUPDATE ("can not update game",
|
||||
"UPDATE games"
|
||||
" SET Scope='%s',Cod=%ld,Roles=%u,"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
|
@ -2230,7 +2234,6 @@ static void Gam_UpdateGame (struct Game *Game,const char *Txt)
|
|||
Game->Title,
|
||||
Txt,
|
||||
Game->GamCod);
|
||||
DB_QueryUPDATE_new ("can not update game");
|
||||
|
||||
/***** Update groups *****/
|
||||
/* Remove old groups */
|
||||
|
@ -3287,10 +3290,10 @@ void Gam_RemoveQst (void)
|
|||
Lay_ShowErrorAndExit ("The question to be removed does not exist.");
|
||||
|
||||
/* Change index of questions greater than this */
|
||||
DB_BuildQuery ("UPDATE gam_questions SET QstInd=QstInd-1"
|
||||
DB_QueryUPDATE ("can not update indexes of questions",
|
||||
"UPDATE gam_questions SET QstInd=QstInd-1"
|
||||
" WHERE GamCod=%ld AND QstInd>%u",
|
||||
Game.GamCod,QstInd);
|
||||
DB_QueryUPDATE_new ("can not update indexes of questions");
|
||||
|
||||
/***** Write message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
|
||||
|
@ -3433,17 +3436,17 @@ static void Gam_ExchangeQuestions (long GamCod,
|
|||
| 2 | 232 | | 2 | 232 | | 2 | 232 |
|
||||
+--------+--------+ +--------+--------+ +--------+--------+
|
||||
*/
|
||||
DB_BuildQuery ("UPDATE gam_questions SET QstInd=%u"
|
||||
DB_QueryUPDATE ("can not exchange indexes of questions",
|
||||
"UPDATE gam_questions SET QstInd=%u"
|
||||
" WHERE GamCod=%ld AND QstCod=%ld",
|
||||
QstIndBottom,
|
||||
GamCod,QstCodTop);
|
||||
DB_QueryUPDATE_new ("can not exchange indexes of questions");
|
||||
|
||||
DB_BuildQuery ("UPDATE gam_questions SET QstInd=%u"
|
||||
DB_QueryUPDATE ("can not exchange indexes of questions",
|
||||
"UPDATE gam_questions SET QstInd=%u"
|
||||
" WHERE GamCod=%ld AND QstCod=%ld",
|
||||
QstIndTop,
|
||||
GamCod,QstCodBottom);
|
||||
DB_QueryUPDATE_new ("can not exchange indexes of questions");
|
||||
|
||||
/***** Unlock table *****/
|
||||
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
||||
|
|
61
swad_group.c
61
swad_group.c
|
@ -2818,16 +2818,16 @@ void Grp_OpenGroupsAutomatically (void)
|
|||
{
|
||||
/***** Open all the closed groups in this course the must be opened
|
||||
and with open time in the past ****/
|
||||
DB_BuildQuery ("UPDATE crs_grp SET Open='Y'"
|
||||
DB_QueryUPDATE ("can not open groups",
|
||||
"UPDATE crs_grp SET Open='Y'"
|
||||
" WHERE GrpTypCod=%ld AND Open='N'",
|
||||
GrpTypCod);
|
||||
DB_QueryUPDATE_new ("can not open groups");
|
||||
|
||||
/***** To not try to open groups again, set MustBeOpened to false *****/
|
||||
DB_BuildQuery ("UPDATE crs_grp_types SET MustBeOpened='N'"
|
||||
DB_QueryUPDATE ("can not update the opening of a type of group",
|
||||
"UPDATE crs_grp_types SET MustBeOpened='N'"
|
||||
" WHERE GrpTypCod=%ld",
|
||||
GrpTypCod);
|
||||
DB_QueryUPDATE_new ("can not update the opening of a type of group");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4042,11 +4042,11 @@ static void Grp_RemoveGroupTypeCompletely (void)
|
|||
Svy_RemoveGroupsOfType (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
|
||||
/***** Change all groups of this type in course timetable *****/
|
||||
DB_BuildQuery ("UPDATE timetable_crs SET GrpCod=-1"
|
||||
DB_QueryUPDATE ("can not update all groups of a type in course timetable",
|
||||
"UPDATE timetable_crs SET GrpCod=-1"
|
||||
" WHERE GrpCod IN"
|
||||
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryUPDATE_new ("can not update all groups of a type in course timetable");
|
||||
|
||||
/***** Remove all the students in groups of this type *****/
|
||||
DB_QueryDELETE ("can not remove users from all groups of a type",
|
||||
|
@ -4100,9 +4100,9 @@ static void Grp_RemoveGroupCompletely (void)
|
|||
Svy_RemoveGroup (GrpDat.GrpCod);
|
||||
|
||||
/***** Change this group in course timetable *****/
|
||||
DB_BuildQuery ("UPDATE timetable_crs SET GrpCod=-1 WHERE GrpCod=%ld",
|
||||
DB_QueryUPDATE ("can not update a group in course timetable",
|
||||
"UPDATE timetable_crs SET GrpCod=-1 WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE_new ("can not update a group in course timetable");
|
||||
|
||||
/***** Remove all the students in this group *****/
|
||||
DB_QueryDELETE ("can not remove users from a group",
|
||||
|
@ -4142,9 +4142,9 @@ void Grp_OpenGroup (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
|
||||
/***** Update the table of groups changing open/close status *****/
|
||||
DB_BuildQuery ("UPDATE crs_grp SET Open='Y' WHERE GrpCod=%ld",
|
||||
DB_QueryUPDATE ("can not open a group",
|
||||
"UPDATE crs_grp SET Open='Y' WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE_new ("can not open a group");
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -4175,9 +4175,9 @@ void Grp_CloseGroup (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
|
||||
/***** Update the table of groups changing open/close status *****/
|
||||
DB_BuildQuery ("UPDATE crs_grp SET Open='N' WHERE GrpCod=%ld",
|
||||
DB_QueryUPDATE ("can not close a group",
|
||||
"UPDATE crs_grp SET Open='N' WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE_new ("can not close a group");
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -4208,9 +4208,9 @@ void Grp_EnableFileZonesGrp (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
|
||||
/***** Update the table of groups changing file zones status *****/
|
||||
DB_BuildQuery ("UPDATE crs_grp SET FileZones='Y' WHERE GrpCod=%ld",
|
||||
DB_QueryUPDATE ("can not enable file zones of a group",
|
||||
"UPDATE crs_grp SET FileZones='Y' WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE_new ("can not enable file zones of a group");
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -4241,9 +4241,9 @@ void Grp_DisableFileZonesGrp (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
|
||||
/***** Update the table of groups changing file zones status *****/
|
||||
DB_BuildQuery ("UPDATE crs_grp SET FileZones='N' WHERE GrpCod=%ld",
|
||||
DB_QueryUPDATE ("can not disable file zones of a group",
|
||||
"UPDATE crs_grp SET FileZones='N' WHERE GrpCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE_new ("can not disable file zones of a group");
|
||||
|
||||
/***** Create message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -4292,9 +4292,9 @@ void Grp_ChangeGroupType (void)
|
|||
else // Group is not in database
|
||||
{
|
||||
/* Update the table of groups changing old type by new type */
|
||||
DB_BuildQuery ("UPDATE crs_grp SET GrpTypCod=%ld WHERE GrpCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the type of a group",
|
||||
"UPDATE crs_grp SET GrpTypCod=%ld WHERE GrpCod=%ld",
|
||||
NewGrpTypCod,Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE_new ("can not update the type of a group");
|
||||
|
||||
/* Create message to show the change made */
|
||||
AlertType = Ale_SUCCESS;
|
||||
|
@ -4344,11 +4344,11 @@ void Grp_ChangeMandatGrpTyp (void)
|
|||
else
|
||||
{
|
||||
/***** Update of the table of types of group changing the old type of enrolment by the new *****/
|
||||
DB_BuildQuery ("UPDATE crs_grp_types SET Mandatory='%c' WHERE GrpTypCod=%ld",
|
||||
DB_QueryUPDATE ("can not update enrolment type of a type of group",
|
||||
"UPDATE crs_grp_types SET Mandatory='%c' WHERE GrpTypCod=%ld",
|
||||
NewMandatoryEnrolment ? 'Y' :
|
||||
'N',
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryUPDATE_new ("can not update enrolment type of a type of group");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
AlertType = Ale_SUCCESS;
|
||||
|
@ -4399,12 +4399,12 @@ void Grp_ChangeMultiGrpTyp (void)
|
|||
else
|
||||
{
|
||||
/***** Update of the table of types of group changing the old type of enrolment by the new *****/
|
||||
DB_BuildQuery ("UPDATE crs_grp_types SET Multiple='%c'"
|
||||
DB_QueryUPDATE ("can not update enrolment type of a type of group",
|
||||
"UPDATE crs_grp_types SET Multiple='%c'"
|
||||
" WHERE GrpTypCod=%ld",
|
||||
NewMultipleEnrolment ? 'Y' :
|
||||
'N',
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryUPDATE_new ("can not update enrolment type of a type of group");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
AlertType = Ale_SUCCESS;
|
||||
|
@ -4441,14 +4441,14 @@ void Grp_ChangeOpenTimeGrpTyp (void)
|
|||
|
||||
/***** Update the table of types of group
|
||||
changing the old open time of enrolment by the new *****/
|
||||
DB_BuildQuery ("UPDATE crs_grp_types"
|
||||
DB_QueryUPDATE ("can not update enrolment type of a type of group",
|
||||
"UPDATE crs_grp_types"
|
||||
" SET MustBeOpened='%c',OpenTime=FROM_UNIXTIME(%ld)"
|
||||
" WHERE GrpTypCod=%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.MustBeOpened ? 'Y' :
|
||||
'N',
|
||||
(long) Gbl.CurrentCrs.Grps.GrpTyp.OpenTimeUTC,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryUPDATE_new ("can not update enrolment type of a type of group");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed);
|
||||
|
@ -4498,9 +4498,10 @@ void Grp_ChangeMaxStdsGrp (void)
|
|||
else
|
||||
{
|
||||
/***** Update the table of groups changing the old maximum of students to the new *****/
|
||||
DB_BuildQuery ("UPDATE crs_grp SET MaxStudents=%u WHERE GrpCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the maximum number of students"
|
||||
" in a group",
|
||||
"UPDATE crs_grp SET MaxStudents=%u WHERE GrpCod=%ld",
|
||||
NewMaxStds,Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE_new ("can not update the maximum number of students in a group");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
AlertType = Ale_SUCCESS;
|
||||
|
@ -4593,11 +4594,11 @@ void Grp_RenameGroupType (void)
|
|||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE crs_grp_types SET GrpTypName='%s'"
|
||||
DB_QueryUPDATE ("can not update the type of a group",
|
||||
"UPDATE crs_grp_types SET GrpTypName='%s'"
|
||||
" WHERE GrpTypCod=%ld",
|
||||
NewNameGrpTyp,
|
||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||
DB_QueryUPDATE_new ("can not update the type of a group");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
AlertType = Ale_SUCCESS;
|
||||
|
@ -4672,9 +4673,9 @@ void Grp_RenameGroup (void)
|
|||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE crs_grp SET GrpName='%s' WHERE GrpCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of a group",
|
||||
"UPDATE crs_grp SET GrpName='%s' WHERE GrpCod=%ld",
|
||||
NewNameGrp,Gbl.CurrentCrs.Grps.GrpCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of a group");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
AlertType = Ale_SUCCESS;
|
||||
|
|
|
@ -713,9 +713,9 @@ void Hld_ChangeHolidayPlace1 (void)
|
|||
Hld_GetDataOfHolidayByCod (Hld);
|
||||
|
||||
/***** Update the place in database *****/
|
||||
DB_BuildQuery ("UPDATE holidays SET PlcCod=%ld WHERE HldCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the place of a holiday",
|
||||
"UPDATE holidays SET PlcCod=%ld WHERE HldCod=%ld",
|
||||
NewPlace.PlcCod,Hld->HldCod);
|
||||
DB_QueryUPDATE_new ("can not update the place of a holiday");
|
||||
Hld->PlcCod = NewPlace.PlcCod;
|
||||
Str_Copy (Hld->PlaceFullName,NewPlace.FullName,
|
||||
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||
|
@ -759,10 +759,10 @@ void Hld_ChangeHolidayType1 (void)
|
|||
|
||||
/***** Update holiday/no school period in database *****/
|
||||
Dat_AssignDate (&Hld->EndDate,&Hld->StartDate);
|
||||
DB_BuildQuery ("UPDATE holidays SET HldTyp=%u,EndDate=StartDate"
|
||||
DB_QueryUPDATE ("can not update the type of a holiday",
|
||||
"UPDATE holidays SET HldTyp=%u,EndDate=StartDate"
|
||||
" WHERE HldCod=%ld",
|
||||
(unsigned) Hld->HldTyp,Hld->HldCod);
|
||||
DB_QueryUPDATE_new ("can not update the type of a holiday");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Gbl.Alert.Type = Ale_SUCCESS;
|
||||
|
@ -854,13 +854,13 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
|
|||
}
|
||||
|
||||
/***** Update the date in database *****/
|
||||
DB_BuildQuery ("UPDATE holidays SET %s='%04u%02u%02u' WHERE HldCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the date of a holiday",
|
||||
"UPDATE holidays SET %s='%04u%02u%02u' WHERE HldCod=%ld",
|
||||
StrStartOrEndDate,
|
||||
NewDate.Year,
|
||||
NewDate.Month,
|
||||
NewDate.Day,
|
||||
Hld->HldCod);
|
||||
DB_QueryUPDATE_new ("can not update the date of a holiday");
|
||||
Dat_AssignDate (PtrDate,&NewDate);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
|
@ -924,9 +924,9 @@ void Hld_RenameHoliday1 (void)
|
|||
{
|
||||
/***** If degree was in database... *****/
|
||||
/* Update the table changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE holidays SET Name='%s' WHERE HldCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the text of a holiday",
|
||||
"UPDATE holidays SET Name='%s' WHERE HldCod=%ld",
|
||||
NewHldName,Hld->HldCod);
|
||||
DB_QueryUPDATE_new ("can not update the text of a holiday");
|
||||
Str_Copy (Hld->Name,NewHldName,
|
||||
Hld_MAX_BYTES_HOLIDAY_NAME);
|
||||
|
||||
|
|
|
@ -132,12 +132,10 @@ void Ico_ChangeIconSet (void)
|
|||
|
||||
/***** Store icon set in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_data SET IconSet='%s' WHERE UsrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update your preference about icon set",
|
||||
"UPDATE usr_data SET IconSet='%s' WHERE UsrCod=%ld",
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your preference about icon set");
|
||||
}
|
||||
|
||||
/***** Set preferences from current IP *****/
|
||||
Pre_SetPrefsFromIP ();
|
||||
|
|
|
@ -1450,9 +1450,9 @@ int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
|
|||
static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators)
|
||||
{
|
||||
/***** Store number of indicators of a course in database *****/
|
||||
DB_BuildQuery ("UPDATE courses SET NumIndicators=%u WHERE CrsCod=%ld",
|
||||
DB_QueryUPDATE ("can not store number of indicators of a course",
|
||||
"UPDATE courses SET NumIndicators=%u WHERE CrsCod=%ld",
|
||||
NumIndicators,CrsCod);
|
||||
DB_QueryUPDATE_new ("can not store number of indicators of a course");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
17
swad_info.c
17
swad_info.c
|
@ -699,13 +699,13 @@ static bool Inf_GetIfIHaveReadFromForm (void)
|
|||
static void Inf_SetForceReadIntoDB (bool MustBeRead)
|
||||
{
|
||||
/***** Insert or replace info source for a specific type of course information *****/
|
||||
DB_BuildQuery ("UPDATE crs_info_src SET MustBeRead='%c'"
|
||||
DB_QueryUPDATE ("can not update if info must be read",
|
||||
"UPDATE crs_info_src SET MustBeRead='%c'"
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
MustBeRead ? 'Y' :
|
||||
'N',
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
DB_QueryUPDATE_new ("can not update if info must be read");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -715,17 +715,15 @@ static void Inf_SetForceReadIntoDB (bool MustBeRead)
|
|||
static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
|
||||
{
|
||||
if (IHaveRead)
|
||||
{
|
||||
/***** Insert I have read course information *****/
|
||||
DB_BuildQuery ("REPLACE INTO crs_info_read"
|
||||
DB_QueryREPLACE ("can not set that I have read course info",
|
||||
"REPLACE INTO crs_info_read"
|
||||
" (UsrCod,CrsCod,InfoType)"
|
||||
" VALUES"
|
||||
" (%ld,%ld,'%s')",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
DB_QueryUPDATE_new ("can not set that I have read course info");
|
||||
}
|
||||
else
|
||||
/***** Remove I have read course information *****/
|
||||
DB_QueryDELETE ("can not set that I have not read course info",
|
||||
|
@ -1486,18 +1484,19 @@ void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc)
|
|||
if (DB_QueryCOUNT_new ("can not get if info source is already stored in database")) // Info is already stored in database, so update it
|
||||
{ // Update info source
|
||||
if (InfoSrc == Inf_INFO_SRC_NONE)
|
||||
DB_BuildQuery ("UPDATE crs_info_src SET InfoSrc='%s',MustBeRead='N'"
|
||||
DB_QueryUPDATE ("can not update info source",
|
||||
"UPDATE crs_info_src SET InfoSrc='%s',MustBeRead='N'"
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
Inf_NamesInDBForInfoSrc[Inf_INFO_SRC_NONE],
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
else // MustBeRead remains unchanged
|
||||
DB_BuildQuery ("UPDATE crs_info_src SET InfoSrc='%s'"
|
||||
DB_QueryUPDATE ("can not update info source",
|
||||
"UPDATE crs_info_src SET InfoSrc='%s'"
|
||||
" WHERE CrsCod=%ld AND InfoType='%s'",
|
||||
Inf_NamesInDBForInfoSrc[InfoSrc],
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
DB_QueryUPDATE_new ("can not update info source");
|
||||
}
|
||||
else // Info is not stored in database, so insert it
|
||||
DB_QueryINSERT ("can not insert info source",
|
||||
|
|
|
@ -1885,9 +1885,9 @@ static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Nam
|
|||
static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName)
|
||||
{
|
||||
/***** Update institution changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE institutions SET %s='%s' WHERE InsCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of an institution",
|
||||
"UPDATE institutions SET %s='%s' WHERE InsCod=%ld",
|
||||
FieldName,NewInsName,InsCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of an institution");
|
||||
|
||||
/***** Flush caches *****/
|
||||
Ins_FlushCacheShortNameOfInstitution ();
|
||||
|
@ -1967,9 +1967,9 @@ void Ins_ContEditAfterChgInsInConfig (void)
|
|||
static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod)
|
||||
{
|
||||
/***** Update country in table of institutions *****/
|
||||
DB_BuildQuery ("UPDATE institutions SET CtyCod=%ld WHERE InsCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the country of an institution",
|
||||
"UPDATE institutions SET CtyCod=%ld WHERE InsCod=%ld",
|
||||
CtyCod,InsCod);
|
||||
DB_QueryUPDATE_new ("can not update the country of an institution");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2053,9 +2053,9 @@ void Ins_ChangeInsWWWInConfig (void)
|
|||
static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
||||
{
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
DB_BuildQuery ("UPDATE institutions SET WWW='%s' WHERE InsCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the web of an institution",
|
||||
"UPDATE institutions SET WWW='%s' WHERE InsCod=%ld",
|
||||
NewWWW,InsCod);
|
||||
DB_QueryUPDATE_new ("can not update the web of an institution");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2087,9 +2087,9 @@ void Ins_ChangeInsStatus (void)
|
|||
Ins_GetDataOfInstitutionByCod (&Gbl.Inss.EditingIns,Ins_GET_BASIC_DATA);
|
||||
|
||||
/***** Update status in table of institutions *****/
|
||||
DB_BuildQuery ("UPDATE institutions SET Status=%u WHERE InsCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the status of an institution",
|
||||
"UPDATE institutions SET Status=%u WHERE InsCod=%ld",
|
||||
(unsigned) Status,Gbl.Inss.EditingIns.InsCod);
|
||||
DB_QueryUPDATE_new ("can not update the status of an institution");
|
||||
Gbl.Inss.EditingIns.Status = Status;
|
||||
|
||||
/***** Write message to show the change made
|
||||
|
|
|
@ -184,10 +184,10 @@ void Lan_UpdateMyLanguageToCurrentLanguage (void)
|
|||
Gbl.Usrs.Me.UsrDat.Prefs.Language = Gbl.Prefs.Language;
|
||||
|
||||
/***** Update my language in database *****/
|
||||
DB_BuildQuery ("UPDATE usr_data SET Language='%s' WHERE UsrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update your language",
|
||||
"UPDATE usr_data SET Language='%s' WHERE UsrCod=%ld",
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your language");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -642,9 +642,9 @@ static bool Lnk_CheckIfLinkNameExists (const char *FieldName,const char *Name,lo
|
|||
static void Lnk_UpdateLnkNameDB (long LnkCod,const char *FieldName,const char *NewLnkName)
|
||||
{
|
||||
/***** Update institutional link changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE links SET %s='%s' WHERE LnkCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of an institutional link",
|
||||
"UPDATE links SET %s='%s' WHERE LnkCod=%ld",
|
||||
FieldName,NewLnkName,LnkCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of an institutional link");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -672,9 +672,9 @@ void Lnk_ChangeLinkWWW (void)
|
|||
if (NewWWW[0])
|
||||
{
|
||||
/* Update the table changing old WWW by new WWW */
|
||||
DB_BuildQuery ("UPDATE links SET WWW='%s' WHERE LnkCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the web of an institutional link",
|
||||
"UPDATE links SET WWW='%s' WHERE LnkCod=%ld",
|
||||
NewWWW,Lnk->LnkCod);
|
||||
DB_QueryUPDATE_new ("can not update the web of an institutional link");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -707,9 +707,9 @@ static bool Mai_CheckIfMailDomainNameExists (const char *FieldName,const char *N
|
|||
static void Mai_UpdateMailDomainNameDB (long MaiCod,const char *FieldName,const char *NewMaiName)
|
||||
{
|
||||
/***** Update mail domain changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE mail_domains SET %s='%s' WHERE MaiCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of a mail domain",
|
||||
"UPDATE mail_domains SET %s='%s' WHERE MaiCod=%ld",
|
||||
FieldName,NewMaiName,MaiCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of a mail domain");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1857,11 +1857,11 @@ void Mai_ConfirmEmail (void)
|
|||
Email);
|
||||
else
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_emails SET Confirmed='Y'"
|
||||
DB_QueryUPDATE ("can not confirm email",
|
||||
"UPDATE usr_emails SET Confirmed='Y'"
|
||||
" WHERE usr_emails.UsrCod=%ld"
|
||||
" AND usr_emails.E_mail='%s'",
|
||||
UsrCod,Email);
|
||||
DB_QueryUPDATE_new ("can not confirm email");
|
||||
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
Txt_The_email_X_has_been_confirmed,
|
||||
|
|
|
@ -271,7 +271,8 @@ static void Mrk_ChangeNumRowsHeaderOrFooter (Brw_HeadOrFoot_t HeaderOrFooter)
|
|||
{
|
||||
/***** Update properties of marks in the database *****/
|
||||
Cod = Brw_GetCodForFiles ();
|
||||
DB_BuildQuery ("UPDATE marks_properties,files"
|
||||
DB_QueryUPDATE ("can not update properties of marks",
|
||||
"UPDATE marks_properties,files"
|
||||
" SET marks_properties.%s=%u"
|
||||
" WHERE files.FileBrowser=%u AND files.Cod=%ld AND files.Path='%s'"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
|
@ -279,7 +280,6 @@ static void Mrk_ChangeNumRowsHeaderOrFooter (Brw_HeadOrFoot_t HeaderOrFooter)
|
|||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
DB_QueryUPDATE_new ("can not update properties of marks");
|
||||
|
||||
/***** Write message of success *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -460,11 +460,9 @@ void Mnu_ChangeMenu (void)
|
|||
|
||||
/***** Store menu in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_data SET Menu=%u WHERE UsrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update your preference about menu",
|
||||
"UPDATE usr_data SET Menu=%u WHERE UsrCod=%ld",
|
||||
(unsigned) Gbl.Prefs.Menu,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your preference about menu");
|
||||
}
|
||||
|
||||
/***** Set preferences from current IP *****/
|
||||
Pre_SetPrefsFromIP ();
|
||||
|
|
|
@ -1226,16 +1226,16 @@ void Msg_ConRecMsg (void)
|
|||
static void Msg_ExpandSentMsg (long MsgCod)
|
||||
{
|
||||
/***** Expand message in sent message table *****/
|
||||
DB_BuildQuery ("UPDATE msg_snt SET Expanded='Y'"
|
||||
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);
|
||||
DB_QueryUPDATE_new ("can not expand a sent message");
|
||||
|
||||
/***** Contract all my other messages in sent message table *****/
|
||||
DB_BuildQuery ("UPDATE msg_snt SET Expanded='N'"
|
||||
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);
|
||||
DB_QueryUPDATE_new ("can not contract a sent message");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1245,16 +1245,16 @@ static void Msg_ExpandSentMsg (long MsgCod)
|
|||
static void Msg_ExpandReceivedMsg (long MsgCod)
|
||||
{
|
||||
/***** Expand message in received message table and mark it as read by me *****/
|
||||
DB_BuildQuery ("UPDATE msg_rcv SET Open='Y',Expanded='Y'"
|
||||
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);
|
||||
DB_QueryUPDATE_new ("can not expand a received message");
|
||||
|
||||
/***** Contract all my other messages in received message table *****/
|
||||
DB_BuildQuery ("UPDATE msg_rcv SET Expanded='N'"
|
||||
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);
|
||||
DB_QueryUPDATE_new ("can not contract a received message");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1264,10 +1264,10 @@ static void Msg_ExpandReceivedMsg (long MsgCod)
|
|||
static void Msg_ContractSentMsg (long MsgCod)
|
||||
{
|
||||
/***** Contract message in sent message table *****/
|
||||
DB_BuildQuery ("UPDATE msg_snt SET Expanded='N'"
|
||||
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);
|
||||
DB_QueryUPDATE_new ("can not contract a sent message");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1277,10 +1277,10 @@ static void Msg_ContractSentMsg (long MsgCod)
|
|||
static void Msg_ContractReceivedMsg (long MsgCod)
|
||||
{
|
||||
/***** Contract message in received message table *****/
|
||||
DB_BuildQuery ("UPDATE msg_rcv SET Expanded='N'"
|
||||
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);
|
||||
DB_QueryUPDATE_new ("can not contract a received message");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1290,10 +1290,10 @@ static void Msg_ContractReceivedMsg (long MsgCod)
|
|||
void Msg_SetReceivedMsgAsOpen (long MsgCod,long UsrCod)
|
||||
{
|
||||
/***** Mark message as read by user *****/
|
||||
DB_BuildQuery ("UPDATE msg_rcv SET Open='Y'"
|
||||
DB_QueryUPDATE ("can not mark a received message as open",
|
||||
"UPDATE msg_rcv SET Open='Y'"
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
MsgCod,UsrCod);
|
||||
DB_QueryUPDATE_new ("can not mark a received message as open");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1445,10 +1445,10 @@ static void Msg_InsertReceivedMsgIntoDB (long MsgCod,long UsrCod,bool NotifyByEm
|
|||
static void Msg_SetReceivedMsgAsReplied (long MsgCod)
|
||||
{
|
||||
/***** Update received message by setting Replied field to true *****/
|
||||
DB_BuildQuery ("UPDATE msg_rcv SET Replied='Y'"
|
||||
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);
|
||||
DB_QueryUPDATE_new ("can not update a received message");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1524,8 +1524,9 @@ static void Msg_MoveMsgContentToDeleted (long MsgCod)
|
|||
should be deleted to ensure the protection of personal data */
|
||||
|
||||
/* Delete message from msg_content *****/
|
||||
DB_BuildQuery ("DELETE FROM msg_content WHERE MsgCod=%ld",MsgCod);
|
||||
DB_QueryUPDATE_new ("can not remove the content of a message");
|
||||
DB_QueryUPDATE ("can not remove the content of a message",
|
||||
"DELETE FROM msg_content WHERE MsgCod=%ld",
|
||||
MsgCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1547,10 +1548,10 @@ void Msg_MoveUnusedMsgsContentToDeleted (void)
|
|||
should be deleted to ensure the protection of personal data */
|
||||
|
||||
/* Delete message from msg_content *****/
|
||||
DB_BuildQuery ("DELETE FROM msg_content"
|
||||
DB_QueryUPDATE ("can not remove the content of some messages",
|
||||
"DELETE FROM msg_content"
|
||||
" WHERE MsgCod NOT IN (SELECT MsgCod FROM msg_snt)"
|
||||
" AND MsgCod NOT IN (SELECT DISTINCT MsgCod FROM msg_rcv)");
|
||||
DB_QueryUPDATE_new ("can not remove the content of some messages");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -183,9 +183,9 @@ static long Not_InsertNoticeInDB (const char *Content)
|
|||
static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned NumUsrsToBeNotifiedByEMail)
|
||||
{
|
||||
/***** Update number of users notified *****/
|
||||
DB_BuildQuery ("UPDATE notices SET NumNotif=%u WHERE NotCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the number of notifications of a notice",
|
||||
"UPDATE notices SET NumNotif=%u WHERE NotCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,NotCod);
|
||||
DB_QueryUPDATE_new ("can not update the number of notifications of a notice");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -229,11 +229,11 @@ void Not_HideActiveNotice (void)
|
|||
NotCod = Not_GetParamNotCod ();
|
||||
|
||||
/***** Set notice as hidden *****/
|
||||
DB_BuildQuery ("UPDATE notices SET Status=%u"
|
||||
DB_QueryUPDATE ("can not hide notice",
|
||||
"UPDATE notices SET Status=%u"
|
||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||
(unsigned) Not_OBSOLETE_NOTICE,
|
||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not hide notice");
|
||||
|
||||
/***** Update RSS of current course *****/
|
||||
RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);
|
||||
|
@ -251,11 +251,11 @@ void Not_RevealHiddenNotice (void)
|
|||
NotCod = Not_GetParamNotCod ();
|
||||
|
||||
/***** Set notice as active *****/
|
||||
DB_BuildQuery ("UPDATE notices SET Status=%u"
|
||||
DB_QueryUPDATE ("can not reveal notice",
|
||||
"UPDATE notices SET Status=%u"
|
||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||
(unsigned) Not_ACTIVE_NOTICE,
|
||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not reveal notice");
|
||||
|
||||
/***** Update RSS of current course *****/
|
||||
RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);
|
||||
|
|
|
@ -947,22 +947,27 @@ void Ntf_MarkNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long CrsCod,lon
|
|||
/***** Set notification as seen by me *****/
|
||||
if (ToUsrCod > 0) // If the user code is specified
|
||||
{
|
||||
if (Cod > 0) // Set only one notification for the user as seen
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
if (Cod > 0) // Set only one notification
|
||||
// for the user as seen
|
||||
DB_QueryUPDATE ("can not set notification(s) as seen",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND Cod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
ToUsrCod,(unsigned) NotifyEvent,Cod);
|
||||
else if (CrsCod > 0) // Set all notifications of this type in the current course for the user as seen
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
else if (CrsCod > 0) // Set all notifications of this type
|
||||
// in the current course for the user as seen
|
||||
DB_QueryUPDATE ("can not set notification(s) as seen",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND CrsCod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
else // Set all notifications of this type for the user as seen
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
else // Set all notifications of this type
|
||||
// for the user as seen
|
||||
DB_QueryUPDATE ("can not set notification(s) as seen",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
ToUsrCod,(unsigned) NotifyEvent);
|
||||
DB_QueryUPDATE_new ("can not set notification(s) as seen");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -973,11 +978,11 @@ void Ntf_MarkNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long CrsCod,lon
|
|||
void Ntf_MarkNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
||||
{
|
||||
/***** Set notification as removed *****/
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
DB_QueryUPDATE ("can not set notification(s) as removed",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE NotifyEvent=%u AND Cod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
(unsigned) NotifyEvent,Cod);
|
||||
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -988,16 +993,20 @@ void Ntf_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long
|
|||
{
|
||||
/***** Set notification as removed *****/
|
||||
if (Cod > 0) // Set only one notification as removed
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
DB_QueryUPDATE ("can not set notification(s) as removed",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND Cod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
ToUsrCod,(unsigned) NotifyEvent,Cod);
|
||||
else // Set all notifications of this type, in the current course for the user, as removed
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
ToUsrCod,(unsigned) NotifyEvent,
|
||||
Cod);
|
||||
else // Set all notifications of this type,
|
||||
// in the current course for the user, as removed
|
||||
DB_QueryUPDATE ("can not set notification(s) as removed",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND CrsCod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||
ToUsrCod,(unsigned) NotifyEvent,
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1013,7 +1022,8 @@ void Ntf_MarkNotifInCrsAsRemoved (long ToUsrCod,long CrsCod)
|
|||
/***** Set all notifications from the course as removed,
|
||||
except notifications about new messages *****/
|
||||
if (ToUsrCod > 0) // If the user code is specified
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
DB_QueryUPDATE ("can not set notification(s) as removed",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod=%ld"
|
||||
" AND CrsCod=%ld"
|
||||
" AND NotifyEvent<>%u", // messages will remain available
|
||||
|
@ -1021,12 +1031,12 @@ void Ntf_MarkNotifInCrsAsRemoved (long ToUsrCod,long CrsCod)
|
|||
ToUsrCod,
|
||||
CrsCod,(unsigned) Ntf_EVENT_MESSAGE);
|
||||
else // User code not specified ==> any user
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
DB_QueryUPDATE ("can not set notification(s) as removed",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND NotifyEvent<>%u", // messages will remain available
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
CrsCod,(unsigned) Ntf_EVENT_MESSAGE);
|
||||
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1127,7 +1137,8 @@ void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path)
|
|||
default:
|
||||
return;
|
||||
}
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
DB_QueryUPDATE ("can not set notification(s) as removed",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE NotifyEvent=%u AND Cod IN"
|
||||
" (SELECT FilCod FROM files"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||
|
@ -1136,7 +1147,6 @@ void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path)
|
|||
(unsigned) NotifyEvent,
|
||||
(unsigned) FileBrowser,Cod,
|
||||
Path);
|
||||
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1150,7 +1160,8 @@ void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path)
|
|||
void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod)
|
||||
{
|
||||
/***** Set notifications as removed *****/
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
DB_QueryUPDATE ("can not set notification(s) as removed",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE NotifyEvent IN (%u,%u,%u,%u) AND Cod IN"
|
||||
" (SELECT FilCod FROM files"
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u) AND Cod=%ld)",
|
||||
|
@ -1164,7 +1175,6 @@ void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod)
|
|||
(unsigned) Brw_ADMI_SHR_GRP,
|
||||
(unsigned) Brw_ADMI_MRK_GRP,
|
||||
GrpCod);
|
||||
DB_QueryUPDATE_new ("can not set notification(s) as removed");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1513,10 +1523,10 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
|
|||
static void Ntf_UpdateMyLastAccessToNotifications (void)
|
||||
{
|
||||
/***** Reset to 0 my number of new received messages *****/
|
||||
DB_BuildQuery ("UPDATE usr_last SET LastAccNotif=NOW()"
|
||||
DB_QueryUPDATE ("can not update last access to notifications",
|
||||
"UPDATE usr_last SET LastAccNotif=NOW()"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update last access to notifications");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1809,14 +1819,14 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
|||
}
|
||||
|
||||
/***** Mark all the pending notifications of this user as 'sent' *****/
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
DB_QueryUPDATE ("can not set pending notifications of a user as sent",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod=%ld"
|
||||
" AND (Status & %u)<>0 AND (Status & %u)=0 AND (Status & %u)=0",
|
||||
(unsigned) Ntf_STATUS_BIT_SENT,ToUsrDat->UsrCod,
|
||||
(unsigned) Ntf_STATUS_BIT_EMAIL,
|
||||
(unsigned) Ntf_STATUS_BIT_SENT,
|
||||
(unsigned) (Ntf_STATUS_BIT_READ | Ntf_STATUS_BIT_REMOVED));
|
||||
DB_QueryUPDATE_new ("can not set pending notifications of a user as sent");
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -1907,11 +1917,11 @@ static void Ntf_UpdateNumNotifSent (long DegCod,long CrsCod,
|
|||
void Ntf_MarkAllNotifAsSeen (void)
|
||||
{
|
||||
/***** Set all my notifications as seen *****/
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
DB_QueryUPDATE ("can not set notification(s) as seen",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE ToUsrCod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not set notification(s) as seen");
|
||||
|
||||
/***** Show my notifications again *****/
|
||||
Ntf_ShowMyNotifications ();
|
||||
|
@ -2037,13 +2047,13 @@ void Ntf_ChangeNotifyEvents (void)
|
|||
Ntf_GetParamsNotifyEvents ();
|
||||
|
||||
/***** Store preferences about notify events *****/
|
||||
DB_BuildQuery ("UPDATE usr_data"
|
||||
DB_QueryUPDATE ("can not update user's preferences",
|
||||
"UPDATE usr_data"
|
||||
" SET NotifNtfEvents=%u,EmailNtfEvents=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents,
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update user's preferences");
|
||||
|
||||
/***** Show message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Your_preferences_about_notifications_have_changed);
|
||||
|
|
|
@ -801,11 +801,11 @@ unsigned Pag_GetParamPagNum (Pag_WhatPaginate_t WhatPaginate)
|
|||
void Pag_SaveLastPageMsgIntoSession (Pag_WhatPaginate_t WhatPaginate,unsigned NumPage)
|
||||
{
|
||||
/***** Save last page of received/sent messages *****/
|
||||
DB_BuildQuery ("UPDATE sessions SET %s=%u WHERE SessionId='%s'",
|
||||
DB_QueryUPDATE ("can not update last page of messages",
|
||||
"UPDATE sessions SET %s=%u WHERE SessionId='%s'",
|
||||
WhatPaginate == Pag_MESSAGES_RECEIVED ? "LastPageMsgRcv" :
|
||||
"LastPageMsgSnt",
|
||||
NumPage,Gbl.Session.Id);
|
||||
DB_QueryUPDATE_new ("can not update last page of messages");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -146,11 +146,11 @@ bool Pwd_CheckPendingPassword (void)
|
|||
void Pwd_AssignMyPendingPasswordToMyCurrentPassword (void)
|
||||
{
|
||||
/***** Update my current password in database *****/
|
||||
DB_BuildQuery ("UPDATE usr_data SET Password='%s'"
|
||||
DB_QueryUPDATE ("can not update your password",
|
||||
"UPDATE usr_data SET Password='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.PendingPassword,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your password");
|
||||
|
||||
/***** Update my current password *****/
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Password,Gbl.Usrs.Me.PendingPassword,
|
||||
|
|
17
swad_photo.c
17
swad_photo.c
|
@ -999,10 +999,10 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
|||
/* Update number of clicks */
|
||||
if (NumClicks <= Pho_MAX_CLICKS_WITHOUT_PHOTO)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE clicks_without_photo"
|
||||
DB_QueryUPDATE ("can not update number of clicks without photo",
|
||||
"UPDATE clicks_without_photo"
|
||||
" SET NumClicks=NumClicks+1 WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update number of clicks without photo");
|
||||
NumClicks++;
|
||||
}
|
||||
}
|
||||
|
@ -1187,8 +1187,9 @@ bool Pho_RemovePhoto (struct UsrData *UsrDat)
|
|||
static void Pho_ClearPhotoName (long UsrCod)
|
||||
{
|
||||
/***** Clear photo name in user's data *****/
|
||||
DB_BuildQuery ("UPDATE usr_data SET Photo='' WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryUPDATE_new ("can not clear the name of a user's photo");
|
||||
DB_QueryUPDATE ("can not clear the name of a user's photo",
|
||||
"UPDATE usr_data SET Photo='' WHERE UsrCod=%ld",
|
||||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1200,9 +1201,9 @@ void Pho_UpdatePhotoName (struct UsrData *UsrDat)
|
|||
char PathPublPhoto[PATH_MAX + 1];
|
||||
|
||||
/***** Update photo name in database *****/
|
||||
DB_BuildQuery ("UPDATE usr_data SET Photo='%s' WHERE UsrCod=%ld",
|
||||
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);
|
||||
DB_QueryUPDATE_new ("can not update the name of a user's photo");
|
||||
|
||||
/***** Remove the old symbolic link to photo *****/
|
||||
snprintf (PathPublPhoto,sizeof (PathPublPhoto),
|
||||
|
@ -1329,10 +1330,10 @@ void Pho_ChangePhotoVisibility (void)
|
|||
Gbl.Usrs.Me.UsrDat.PhotoVisibility = Pri_GetParamVisibility ("VisPho");
|
||||
|
||||
/***** Store public/private photo in database *****/
|
||||
DB_BuildQuery ("UPDATE usr_data SET PhotoVisibility='%s' WHERE UsrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update your preference about photo visibility",
|
||||
"UPDATE usr_data SET PhotoVisibility='%s' WHERE UsrCod=%ld",
|
||||
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.PhotoVisibility],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your preference about photo visibility");
|
||||
|
||||
/***** Show form again *****/
|
||||
Pre_EditPrefs ();
|
||||
|
|
|
@ -728,9 +728,9 @@ static bool Plc_CheckIfPlaceNameExists (const char *FieldName,const char *Name,l
|
|||
static void Plc_UpdatePlcNameDB (long PlcCod,const char *FieldName,const char *NewPlcName)
|
||||
{
|
||||
/***** Update place changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE places SET %s='%s' WHERE PlcCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of a place",
|
||||
"UPDATE places SET %s='%s' WHERE PlcCod=%ld",
|
||||
FieldName,NewPlcName,PlcCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of a place");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -560,9 +560,9 @@ void Plg_RenamePlugin (void)
|
|||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
DB_BuildQuery ("UPDATE plugins SET Name='%s' WHERE PlgCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the name of a plugin",
|
||||
"UPDATE plugins SET Name='%s' WHERE PlgCod=%ld",
|
||||
NewPlgName,Plg->PlgCod);
|
||||
DB_QueryUPDATE_new ("can not update the name of a plugin");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -624,9 +624,9 @@ void Plg_ChangePlgDescription (void)
|
|||
if (NewDescription[0])
|
||||
{
|
||||
/* Update the table changing old description by new description */
|
||||
DB_BuildQuery ("UPDATE plugins SET Description='%s' WHERE PlgCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the description of a plugin",
|
||||
"UPDATE plugins SET Description='%s' WHERE PlgCod=%ld",
|
||||
NewDescription,Plg->PlgCod);
|
||||
DB_QueryUPDATE_new ("can not update the description of a plugin");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -668,9 +668,9 @@ void Plg_ChangePlgLogo (void)
|
|||
if (NewLogo[0])
|
||||
{
|
||||
/* Update the table changing old logo by new logo */
|
||||
DB_BuildQuery ("UPDATE plugins SET Logo='%s' WHERE PlgCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the logo of a plugin",
|
||||
"UPDATE plugins SET Logo='%s' WHERE PlgCod=%ld",
|
||||
NewLogo,Plg->PlgCod);
|
||||
DB_QueryUPDATE_new ("can not update the logo of a plugin");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -712,9 +712,9 @@ void Plg_ChangePlgAppKey (void)
|
|||
if (NewAppKey[0])
|
||||
{
|
||||
/* Update the table changing old application key by new application key */
|
||||
DB_BuildQuery ("UPDATE plugins SET AppKey='%s' WHERE PlgCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the application key of a plugin",
|
||||
"UPDATE plugins SET AppKey='%s' WHERE PlgCod=%ld",
|
||||
NewAppKey,Plg->PlgCod);
|
||||
DB_QueryUPDATE_new ("can not update the application key of a plugin");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -756,9 +756,9 @@ void Plg_ChangePlgURL (void)
|
|||
if (NewURL[0])
|
||||
{
|
||||
/* Update the table changing old WWW by new WWW */
|
||||
DB_BuildQuery ("UPDATE plugins SET URL='%s' WHERE PlgCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the URL of a plugin",
|
||||
"UPDATE plugins SET URL='%s' WHERE PlgCod=%ld",
|
||||
NewURL,Plg->PlgCod);
|
||||
DB_QueryUPDATE_new ("can not update the URL of a plugin");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -800,9 +800,9 @@ void Plg_ChangePlgIP (void)
|
|||
if (NewIP[0])
|
||||
{
|
||||
/* Update the table changing old IP by new IP */
|
||||
DB_BuildQuery ("UPDATE plugins SET IP='%s' WHERE PlgCod=%ld",
|
||||
DB_QueryUPDATE ("can not update the IP address of a plugin",
|
||||
"UPDATE plugins SET IP='%s' WHERE PlgCod=%ld",
|
||||
NewIP,Plg->PlgCod);
|
||||
DB_QueryUPDATE_new ("can not update the IP address of a plugin");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -195,8 +195,8 @@ void Pre_SetPrefsFromIP (void)
|
|||
|
||||
/***** If a user is logged, update its preferences in database for all its IP's *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE IP_prefs"
|
||||
DB_QueryUPDATE ("can not update your preferences",
|
||||
"UPDATE IP_prefs"
|
||||
" SET FirstDayOfWeek=%u,DateFormat=%u,"
|
||||
"Theme='%s',IconSet='%s',Menu=%u,SideCols=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
|
@ -207,8 +207,6 @@ void Pre_SetPrefsFromIP (void)
|
|||
(unsigned) Gbl.Prefs.Menu,
|
||||
Gbl.Prefs.SideCols,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your preferences");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -350,10 +348,10 @@ void Pre_ShowRightCol (void)
|
|||
|
||||
static void Pre_UpdateSideColsOnUsrDataTable (void)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_data SET SideCols=%u"
|
||||
DB_QueryUPDATE ("can not update your preference about side columns",
|
||||
"UPDATE usr_data SET SideCols=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Prefs.SideCols,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your preference about side columns");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -337,11 +337,12 @@ void Prf_ChangeProfileVisibility (void)
|
|||
Gbl.Usrs.Me.UsrDat.ProfileVisibility = Pri_GetParamVisibility ("VisPrf");
|
||||
|
||||
/***** Store public/private photo in database *****/
|
||||
DB_BuildQuery ("UPDATE usr_data SET ProfileVisibility='%s'"
|
||||
DB_QueryUPDATE ("can not update your preference"
|
||||
" about public profile visibility",
|
||||
"UPDATE usr_data SET ProfileVisibility='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.ProfileVisibility],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your preference about public profile visibility");
|
||||
|
||||
/***** Show form again *****/
|
||||
Pre_EditPrefs ();
|
||||
|
@ -858,13 +859,11 @@ static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
|
|||
|
||||
/***** Update first click time in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_figures"
|
||||
DB_QueryUPDATE ("can not update user's figures",
|
||||
"UPDATE usr_figures"
|
||||
" SET FirstClickTime=FROM_UNIXTIME(%ld)"
|
||||
" WHERE UsrCod=%ld",
|
||||
(long) UsrFigures.FirstClickTimeUTC,UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update user's figures");
|
||||
}
|
||||
else // User entry does not exist
|
||||
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
||||
}
|
||||
|
@ -889,12 +888,10 @@ static void Prf_GetNumClicksAndStoreAsUsrFigure (long UsrCod)
|
|||
|
||||
/***** Update number of clicks in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_figures SET NumClicks=%ld"
|
||||
DB_QueryUPDATE ("can not update user's figures",
|
||||
"UPDATE usr_figures SET NumClicks=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrFigures.NumClicks,UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update user's figures");
|
||||
}
|
||||
else // User entry does not exist
|
||||
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
||||
}
|
||||
|
@ -918,12 +915,10 @@ static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
|
|||
|
||||
/***** Update number of file views in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_figures SET NumFileViews=%ld"
|
||||
DB_QueryUPDATE ("can not update user's figures",
|
||||
"UPDATE usr_figures SET NumFileViews=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrFigures.NumFileViews,UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update user's figures");
|
||||
}
|
||||
else // User entry does not exist
|
||||
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
||||
}
|
||||
|
@ -947,12 +942,10 @@ static void Prf_GetNumForPstAndStoreAsUsrFigure (long UsrCod)
|
|||
|
||||
/***** Update number of forum posts in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_figures SET NumForPst=%ld"
|
||||
DB_QueryUPDATE ("can not update user's figures",
|
||||
"UPDATE usr_figures SET NumForPst=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrFigures.NumForPst,UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update user's figures");
|
||||
}
|
||||
else // User entry does not exist
|
||||
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
||||
}
|
||||
|
@ -976,12 +969,10 @@ static void Prf_GetNumMsgSntAndStoreAsUsrFigure (long UsrCod)
|
|||
|
||||
/***** Update number of messages sent in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_figures SET NumMsgSnt=%ld"
|
||||
DB_QueryUPDATE ("can not update user's figures",
|
||||
"UPDATE usr_figures SET NumMsgSnt=%ld"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrFigures.NumMsgSnt,UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update user's figures");
|
||||
}
|
||||
else // User entry does not exist
|
||||
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
|
||||
}
|
||||
|
|
|
@ -2805,10 +2805,10 @@ void Prj_HideProject (void)
|
|||
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
||||
{
|
||||
/***** Hide project *****/
|
||||
DB_BuildQuery ("UPDATE projects SET Hidden='Y'"
|
||||
DB_QueryUPDATE ("can not hide project",
|
||||
"UPDATE projects SET Hidden='Y'"
|
||||
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
||||
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not hide project");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -2849,10 +2849,10 @@ void Prj_ShowProject (void)
|
|||
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
||||
{
|
||||
/***** Show project *****/
|
||||
DB_BuildQuery ("UPDATE projects SET Hidden='N'"
|
||||
DB_QueryUPDATE ("can not show project",
|
||||
"UPDATE projects SET Hidden='N'"
|
||||
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
||||
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not show project");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -3364,11 +3364,19 @@ static void Prj_UpdateProject (struct Project *Prj)
|
|||
Prj->ModifTime = Gbl.StartExecutionTimeUTC;
|
||||
|
||||
/***** Update the data of the project *****/
|
||||
DB_BuildQuery ("UPDATE projects SET "
|
||||
"DptCod=%ld,Hidden='%c',Preassigned='%c',NumStds=%u,Proposal='%s',"
|
||||
DB_QueryUPDATE ("can not update project",
|
||||
"UPDATE projects"
|
||||
" SET DptCod=%ld,"
|
||||
"Hidden='%c',"
|
||||
"Preassigned='%c',"
|
||||
"NumStds=%u,"
|
||||
"Proposal='%s',"
|
||||
"ModifTime=FROM_UNIXTIME(%ld),"
|
||||
"Title='%s',"
|
||||
"Description='%s',Knowledge='%s',Materials='%s',URL='%s'"
|
||||
"Description='%s',"
|
||||
"Knowledge='%s',"
|
||||
"Materials='%s',"
|
||||
"URL='%s'"
|
||||
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
||||
Prj->DptCod,
|
||||
Prj->Hidden == Prj_HIDDEN ? 'Y' :
|
||||
|
@ -3384,7 +3392,6 @@ static void Prj_UpdateProject (struct Project *Prj)
|
|||
Prj->Materials,
|
||||
Prj->URL,
|
||||
Prj->PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update project");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -832,10 +832,10 @@ void Rec_RenameField (void)
|
|||
else
|
||||
{
|
||||
/* Update the table of fields changing then old name by the new one */
|
||||
DB_BuildQuery ("UPDATE crs_record_fields SET FieldName='%s'"
|
||||
DB_QueryUPDATE ("can not update name of field of record",
|
||||
"UPDATE crs_record_fields SET FieldName='%s'"
|
||||
" WHERE FieldCod=%ld",
|
||||
NewFieldName,Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
DB_QueryUPDATE_new ("can not update name of field of record");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -896,10 +896,10 @@ void Rec_ChangeLinesField (void)
|
|||
else
|
||||
{
|
||||
/***** Update of the table of fields changing the old maximum of students by the new one *****/
|
||||
DB_BuildQuery ("UPDATE crs_record_fields SET NumLines=%u"
|
||||
DB_QueryUPDATE ("can not update the number of lines of a record field",
|
||||
"UPDATE crs_record_fields SET NumLines=%u"
|
||||
" WHERE FieldCod=%ld",
|
||||
NewNumLines,Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
DB_QueryUPDATE_new ("can not update the number of lines of a field of record");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -950,10 +950,11 @@ void Rec_ChangeVisibilityField (void)
|
|||
else
|
||||
{
|
||||
/***** Update of the table of fields changing the old visibility by the new *****/
|
||||
DB_BuildQuery ("UPDATE crs_record_fields SET Visibility=%u"
|
||||
DB_QueryUPDATE ("can not update the visibility of a record field",
|
||||
"UPDATE crs_record_fields SET Visibility=%u"
|
||||
" WHERE FieldCod=%ld",
|
||||
(unsigned) NewVisibility,Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
DB_QueryUPDATE_new ("can not update the visibility of a field of record");
|
||||
(unsigned) NewVisibility,
|
||||
Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1995,15 +1996,13 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
|||
if (FieldAlreadyExists)
|
||||
{
|
||||
if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
|
||||
{
|
||||
/***** Update text of the field of record course *****/
|
||||
DB_BuildQuery ("UPDATE crs_records SET Txt='%s'"
|
||||
DB_QueryUPDATE ("can not update field of record",
|
||||
"UPDATE crs_records SET Txt='%s'"
|
||||
" WHERE UsrCod=%ld AND FieldCod=%ld",
|
||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text,
|
||||
UsrCod,
|
||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod);
|
||||
DB_QueryUPDATE_new ("can not update field of record");
|
||||
}
|
||||
else
|
||||
/***** Remove text of the field of record course *****/
|
||||
DB_QueryDELETE ("can not remove field of record",
|
||||
|
@ -4396,10 +4395,10 @@ void Rec_UpdateMyOffice (void)
|
|||
Par_GetParToText ("Office",Gbl.Usrs.Me.UsrDat.Tch.Office,Usr_MAX_BYTES_ADDRESS);
|
||||
|
||||
/***** Update office *****/
|
||||
DB_BuildQuery ("UPDATE usr_data SET Office='%s' WHERE UsrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update office",
|
||||
"UPDATE usr_data SET Office='%s' WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.Tch.Office,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update office");
|
||||
|
||||
/***** Show form again *****/
|
||||
Rec_ShowMySharedRecordAndMore ();
|
||||
|
@ -4415,10 +4414,10 @@ void Rec_UpdateMyOfficePhone (void)
|
|||
Par_GetParToText ("OfficePhone",Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,Usr_MAX_BYTES_PHONE);
|
||||
|
||||
/***** Update office phone *****/
|
||||
DB_BuildQuery ("UPDATE usr_data SET OfficePhone='%s' WHERE UsrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update office phone",
|
||||
"UPDATE usr_data SET OfficePhone='%s' WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update office phone");
|
||||
|
||||
/***** Show form again *****/
|
||||
Rec_ShowMySharedRecordAndMore ();
|
||||
|
|
|
@ -1321,19 +1321,19 @@ static void Sch_SaveLastSearchIntoSession (void)
|
|||
Gbl.Search.WhatToSearch = Sch_WHAT_TO_SEARCH_DEFAULT;
|
||||
|
||||
/***** Save last search in session *****/
|
||||
DB_BuildQuery ("UPDATE sessions SET WhatToSearch=%u,SearchStr='%s'"
|
||||
DB_QueryUPDATE ("can not update last search in session",
|
||||
"UPDATE sessions SET WhatToSearch=%u,SearchStr='%s'"
|
||||
" WHERE SessionId='%s'",
|
||||
(unsigned) Gbl.Search.WhatToSearch,
|
||||
Gbl.Search.Str,
|
||||
Gbl.Session.Id);
|
||||
DB_QueryUPDATE_new ("can not update last search in session");
|
||||
|
||||
/***** Update my last type of search *****/
|
||||
// WhatToSearch is stored in usr_last for next time I log in
|
||||
// In other existing sessions distinct to this, WhatToSearch will remain unchanged
|
||||
DB_BuildQuery ("UPDATE usr_last SET WhatToSearch=%u WHERE UsrCod=%ld",
|
||||
DB_QueryUPDATE ("can not update type of search in user's last data",
|
||||
"UPDATE usr_last SET WhatToSearch=%u WHERE UsrCod=%ld",
|
||||
(unsigned) Gbl.Search.WhatToSearch,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update type of search in user's last data");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,8 @@ void Ses_InsertSessionInDB (void)
|
|||
void Ses_UpdateSessionDataInDB (void)
|
||||
{
|
||||
/***** Update session in database *****/
|
||||
DB_BuildQuery ("UPDATE sessions SET UsrCod=%ld,Password='%s',Role=%u,"
|
||||
DB_QueryUPDATE ("can not update session",
|
||||
"UPDATE sessions SET UsrCod=%ld,Password='%s',Role=%u,"
|
||||
"CtyCod=%ld,InsCod=%ld,CtrCod=%ld,DegCod=%ld,CrsCod=%ld,"
|
||||
"LastTime=NOW(),LastRefresh=NOW()"
|
||||
" WHERE SessionId='%s'",
|
||||
|
@ -194,7 +195,6 @@ void Ses_UpdateSessionDataInDB (void)
|
|||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Session.Id);
|
||||
DB_QueryUPDATE_new ("can not update session");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -204,9 +204,9 @@ void Ses_UpdateSessionDataInDB (void)
|
|||
void Ses_UpdateSessionLastRefreshInDB (void)
|
||||
{
|
||||
/***** Update session in database *****/
|
||||
DB_BuildQuery ("UPDATE sessions SET LastRefresh=NOW() WHERE SessionId='%s'",
|
||||
DB_QueryUPDATE ("can not update session",
|
||||
"UPDATE sessions SET LastRefresh=NOW() WHERE SessionId='%s'",
|
||||
Gbl.Session.Id);
|
||||
DB_QueryUPDATE_new ("can not update session");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -848,11 +848,12 @@ static long Soc_GetPubCodFromSession (const char *FieldName)
|
|||
static void Soc_UpdateLastPubCodIntoSession (void)
|
||||
{
|
||||
/***** Update last publishing code *****/
|
||||
DB_BuildQuery ("UPDATE sessions"
|
||||
" SET LastPubCod=(SELECT IFNULL(MAX(PubCod),0) FROM social_pubs)"
|
||||
DB_QueryUPDATE ("can not update last publishing code into session",
|
||||
"UPDATE sessions"
|
||||
" SET LastPubCod="
|
||||
"(SELECT IFNULL(MAX(PubCod),0) FROM social_pubs)"
|
||||
" WHERE SessionId='%s'",
|
||||
Gbl.Session.Id);
|
||||
DB_QueryUPDATE_new ("can not update last publishing code into session");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -862,9 +863,9 @@ static void Soc_UpdateLastPubCodIntoSession (void)
|
|||
static void Soc_UpdateFirstPubCodIntoSession (long FirstPubCod)
|
||||
{
|
||||
/***** Update last publishing code *****/
|
||||
DB_BuildQuery ("UPDATE sessions SET FirstPubCod=%ld WHERE SessionId='%s'",
|
||||
DB_QueryUPDATE ("can not update first publishing code into session",
|
||||
"UPDATE sessions SET FirstPubCod=%ld WHERE SessionId='%s'",
|
||||
FirstPubCod,Gbl.Session.Id);
|
||||
DB_QueryUPDATE_new ("can not update first publishing code into session");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1972,19 +1973,19 @@ void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod,struct Soci
|
|||
void Soc_MarkSocialNoteAsUnavailableUsingNotCod (long NotCod)
|
||||
{
|
||||
/***** Mark the social note as unavailable *****/
|
||||
DB_BuildQuery ("UPDATE social_notes SET Unavailable='Y'"
|
||||
DB_QueryUPDATE ("can not mark social note as unavailable",
|
||||
"UPDATE social_notes SET Unavailable='Y'"
|
||||
" WHERE NotCod=%ld",
|
||||
NotCod);
|
||||
DB_QueryUPDATE_new ("can not mark social note as unavailable");
|
||||
}
|
||||
|
||||
void Soc_MarkSocialNoteAsUnavailableUsingNoteTypeAndCod (Soc_NoteType_t NoteType,long Cod)
|
||||
{
|
||||
/***** Mark the social note as unavailable *****/
|
||||
DB_BuildQuery ("UPDATE social_notes SET Unavailable='Y'"
|
||||
DB_QueryUPDATE ("can not mark social note as unavailable",
|
||||
"UPDATE social_notes SET Unavailable='Y'"
|
||||
" WHERE NoteType=%u AND Cod=%ld",
|
||||
(unsigned) NoteType,Cod);
|
||||
DB_QueryUPDATE_new ("can not mark social note as unavailable");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2101,7 +2102,8 @@ void Soc_MarkSocialNotesChildrenOfFolderAsUnavailable (const char *Path)
|
|||
default:
|
||||
return;
|
||||
}
|
||||
DB_BuildQuery ("UPDATE social_notes SET Unavailable='Y'"
|
||||
DB_QueryUPDATE ("can not mark social notes as unavailable",
|
||||
"UPDATE social_notes SET Unavailable='Y'"
|
||||
" WHERE NoteType=%u AND Cod IN"
|
||||
" (SELECT FilCod FROM files"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||
|
@ -2109,7 +2111,6 @@ void Soc_MarkSocialNotesChildrenOfFolderAsUnavailable (const char *Path)
|
|||
(unsigned) NoteType,
|
||||
(unsigned) FileBrowser,Cod,
|
||||
Path);
|
||||
DB_QueryUPDATE_new ("can not mark social notes as unavailable");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1660,11 +1660,11 @@ void Svy_ResetSurvey (void)
|
|||
Svy.SvyCod);
|
||||
|
||||
/***** Reset all the answers in this survey *****/
|
||||
DB_BuildQuery ("UPDATE svy_answers,svy_questions SET svy_answers.NumUsrs=0"
|
||||
DB_QueryUPDATE ("can not reset answers of a survey",
|
||||
"UPDATE svy_answers,svy_questions SET svy_answers.NumUsrs=0"
|
||||
" WHERE svy_questions.SvyCod=%ld"
|
||||
" AND svy_questions.QstCod=svy_answers.QstCod",
|
||||
Svy.SvyCod);
|
||||
DB_QueryUPDATE_new ("can not reset answers of a survey");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1699,8 +1699,9 @@ void Svy_HideSurvey (void)
|
|||
Lay_ShowErrorAndExit ("You can not hide this survey.");
|
||||
|
||||
/***** Hide survey *****/
|
||||
DB_BuildQuery ("UPDATE surveys SET Hidden='Y' WHERE SvyCod=%ld",Svy.SvyCod);
|
||||
DB_QueryUPDATE_new ("can not hide survey");
|
||||
DB_QueryUPDATE ("can not hide survey",
|
||||
"UPDATE surveys SET Hidden='Y' WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -1735,8 +1736,9 @@ void Svy_UnhideSurvey (void)
|
|||
Lay_ShowErrorAndExit ("You can not unhide this survey.");
|
||||
|
||||
/***** Show survey *****/
|
||||
DB_BuildQuery ("UPDATE surveys SET Hidden='N' WHERE SvyCod=%ld",Svy.SvyCod);
|
||||
DB_QueryUPDATE_new ("can not show survey");
|
||||
DB_QueryUPDATE ("can not show survey",
|
||||
"UPDATE surveys SET Hidden='N' WHERE SvyCod=%ld",
|
||||
Svy.SvyCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -2237,10 +2239,10 @@ static void Svy_UpdateNumUsrsNotifiedByEMailAboutSurvey (long SvyCod,
|
|||
unsigned NumUsrsToBeNotifiedByEMail)
|
||||
{
|
||||
/***** Update number of users notified *****/
|
||||
DB_BuildQuery ("UPDATE surveys SET NumNotif=NumNotif+%u"
|
||||
DB_QueryUPDATE ("can not update the number of notifications of a survey",
|
||||
"UPDATE surveys SET NumNotif=NumNotif+%u"
|
||||
" WHERE SvyCod=%ld",
|
||||
NumUsrsToBeNotifiedByEMail,SvyCod);
|
||||
DB_QueryUPDATE_new ("can not update the number of notifications of a survey");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2290,7 +2292,8 @@ static void Svy_UpdateSurvey (struct Survey *Svy,const char *Txt)
|
|||
extern const char *Txt_The_survey_has_been_modified;
|
||||
|
||||
/***** Update the data of the survey *****/
|
||||
DB_BuildQuery ("UPDATE surveys"
|
||||
DB_QueryUPDATE ("can not update survey",
|
||||
"UPDATE surveys"
|
||||
" SET Scope='%s',Cod=%ld,Roles=%u,"
|
||||
"StartTime=FROM_UNIXTIME(%ld),"
|
||||
"EndTime=FROM_UNIXTIME(%ld),"
|
||||
|
@ -2303,7 +2306,6 @@ static void Svy_UpdateSurvey (struct Survey *Svy,const char *Txt)
|
|||
Svy->Title,
|
||||
Txt,
|
||||
Svy->SvyCod);
|
||||
DB_QueryUPDATE_new ("can not update survey");
|
||||
|
||||
/***** Update groups *****/
|
||||
/* Remove old groups */
|
||||
|
@ -3033,14 +3035,12 @@ void Svy_ReceiveQst (void)
|
|||
Svy_StrAnswerTypesDB[SvyQst.AnswerType],Txt);
|
||||
}
|
||||
else // It's an existing question
|
||||
{
|
||||
/* Update question */
|
||||
DB_BuildQuery ("UPDATE svy_questions SET Stem='%s',AnsType='%s'"
|
||||
DB_QueryUPDATE ("can not update question",
|
||||
"UPDATE svy_questions SET Stem='%s',AnsType='%s'"
|
||||
" WHERE QstCod=%ld AND SvyCod=%ld",
|
||||
Txt,Svy_StrAnswerTypesDB[SvyQst.AnswerType],
|
||||
SvyQst.QstCod,SvyCod);
|
||||
DB_QueryUPDATE_new ("can not update question");
|
||||
}
|
||||
|
||||
/* Insert, update or delete answers in the answers table */
|
||||
for (NumAns = 0;
|
||||
|
@ -3049,13 +3049,11 @@ void Svy_ReceiveQst (void)
|
|||
if (Svy_CheckIfAnswerExists (SvyQst.QstCod,NumAns)) // If this answer exists...
|
||||
{
|
||||
if (SvyQst.AnsChoice[NumAns].Text[0]) // Answer is not empty
|
||||
{
|
||||
/* Update answer text */
|
||||
DB_BuildQuery ("UPDATE svy_answers SET Answer='%s'"
|
||||
DB_QueryUPDATE ("can not update answer",
|
||||
"UPDATE svy_answers SET Answer='%s'"
|
||||
" WHERE QstCod=%ld AND AnsInd=%u",
|
||||
SvyQst.AnsChoice[NumAns].Text,SvyQst.QstCod,NumAns);
|
||||
DB_QueryUPDATE_new ("can not update answer");
|
||||
}
|
||||
else // Answer is empty
|
||||
/* Delete answer from database */
|
||||
DB_QueryDELETE ("can not delete answer",
|
||||
|
@ -3603,10 +3601,10 @@ void Svy_RemoveQst (void)
|
|||
Lay_ShowErrorAndExit ("The question to be removed does not exist.");
|
||||
|
||||
/* Change index of questions greater than this */
|
||||
DB_BuildQuery ("UPDATE svy_questions SET QstInd=QstInd-1"
|
||||
DB_QueryUPDATE ("can not update indexes of questions",
|
||||
"UPDATE svy_questions SET QstInd=QstInd-1"
|
||||
" WHERE SvyCod=%ld AND QstInd>%u",
|
||||
SvyCod,SvyQst.QstInd);
|
||||
DB_QueryUPDATE_new ("can not update indexes of questions");
|
||||
|
||||
/***** Write message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
|
||||
|
@ -3723,10 +3721,10 @@ static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod)
|
|||
static void Svy_IncreaseAnswerInDB (long QstCod,unsigned AnsInd)
|
||||
{
|
||||
/***** Increase number of users who have selected the answer AnsInd in the question QstCod *****/
|
||||
DB_BuildQuery ("UPDATE svy_answers SET NumUsrs=NumUsrs+1"
|
||||
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);
|
||||
DB_QueryUPDATE_new ("can not register your answer to the survey");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
39
swad_test.c
39
swad_test.c
|
@ -1243,18 +1243,19 @@ static void Tst_UpdateScoreQst (long QstCod,float ScoreThisQst,bool AnswerIsNotB
|
|||
/***** Update number of clicks and score of the question *****/
|
||||
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
||||
if (AnswerIsNotBlank)
|
||||
DB_BuildQuery ("UPDATE tst_questions"
|
||||
DB_QueryUPDATE ("can not update the score of a question",
|
||||
"UPDATE tst_questions"
|
||||
" SET NumHits=NumHits+1,NumHitsNotBlank=NumHitsNotBlank+1,"
|
||||
"Score=Score+(%lf)"
|
||||
" WHERE QstCod=%ld",
|
||||
ScoreThisQst,QstCod);
|
||||
else // The answer is blank
|
||||
DB_BuildQuery ("UPDATE tst_questions"
|
||||
DB_QueryUPDATE ("can not update the score of a question",
|
||||
"UPDATE tst_questions"
|
||||
" SET NumHits=NumHits+1"
|
||||
" WHERE QstCod=%ld",
|
||||
QstCod);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
DB_QueryUPDATE_new ("can not update the score of a question");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1264,11 +1265,11 @@ static void Tst_UpdateScoreQst (long QstCod,float ScoreThisQst,bool AnswerIsNotB
|
|||
static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst)
|
||||
{
|
||||
/***** Update my number of accesses to test in this course *****/
|
||||
DB_BuildQuery ("UPDATE crs_usr SET NumAccTst=%u"
|
||||
DB_QueryUPDATE ("can not update the number of accesses to test",
|
||||
"UPDATE crs_usr SET NumAccTst=%u"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
NumAccessesTst,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update the number of accesses to test");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1278,12 +1279,12 @@ static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst)
|
|||
static void Tst_UpdateLastAccTst (void)
|
||||
{
|
||||
/***** Update date-time and number of questions of this test *****/
|
||||
DB_BuildQuery ("UPDATE crs_usr SET LastAccTst=NOW(),NumQstsLastTst=%u"
|
||||
DB_QueryUPDATE ("can not update time and number of questions of this test",
|
||||
"UPDATE crs_usr SET LastAccTst=NOW(),NumQstsLastTst=%u"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.Test.NumQsts,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update time and number of questions of this test");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1621,14 +1622,14 @@ void Tst_RenameTag (void)
|
|||
|
||||
/* Change old tag to new tag in questions where it would not be repeated */
|
||||
// New tag did not exist for a question ==> change old tag to new tag
|
||||
DB_BuildQuery ("UPDATE tst_question_tags"
|
||||
DB_QueryUPDATE ("can not update a tag in some questions",
|
||||
"UPDATE tst_question_tags"
|
||||
" SET TagCod=%ld"
|
||||
" WHERE TagCod=%ld"
|
||||
" AND QstCod NOT IN"
|
||||
" (SELECT QstCod FROM tst_question_tags_tmp)",
|
||||
ExistingTagCod,
|
||||
OldTagCod);
|
||||
DB_QueryUPDATE_new ("can not update a tag in some questions");
|
||||
|
||||
/* Drop temporary table, no longer necessary */
|
||||
DB_Query ("can not remove temporary table",
|
||||
|
@ -1643,11 +1644,11 @@ void Tst_RenameTag (void)
|
|||
else // Renaming is easy
|
||||
{
|
||||
/***** Simple update replacing each instance of the old tag by the new tag *****/
|
||||
DB_BuildQuery ("UPDATE tst_tags SET TagTxt='%s',ChangeTime=NOW()"
|
||||
DB_QueryUPDATE ("can not update tag",
|
||||
"UPDATE tst_tags SET TagTxt='%s',ChangeTime=NOW()"
|
||||
" WHERE tst_tags.CrsCod=%ld"
|
||||
" AND tst_tags.TagTxt='%s'",
|
||||
NewTagTxt,Gbl.CurrentCrs.Crs.CrsCod,OldTagTxt);
|
||||
DB_QueryUPDATE_new ("can not update tag");
|
||||
}
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
|
@ -6317,12 +6318,12 @@ static long Tst_CreateNewTag (long CrsCod,const char *TagTxt)
|
|||
static void Tst_EnableOrDisableTag (long TagCod,bool TagHidden)
|
||||
{
|
||||
/***** Insert new tag into tst_tags table *****/
|
||||
DB_BuildQuery ("UPDATE tst_tags SET TagHidden='%c',ChangeTime=NOW()"
|
||||
DB_QueryUPDATE ("can not update the visibility of a tag",
|
||||
"UPDATE tst_tags SET TagHidden='%c',ChangeTime=NOW()"
|
||||
" WHERE TagCod=%ld AND CrsCod=%ld",
|
||||
TagHidden ? 'Y' :
|
||||
'N',
|
||||
TagCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update the visibility of a tag");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -6474,12 +6475,12 @@ void Tst_ChangeShuffleQst (void)
|
|||
|
||||
/***** Remove the question from all the tables *****/
|
||||
/* Update the question changing the current shuffle */
|
||||
DB_BuildQuery ("UPDATE tst_questions SET Shuffle='%c'"
|
||||
DB_QueryUPDATE ("can not update the shuffle type of a question",
|
||||
"UPDATE tst_questions SET Shuffle='%c'"
|
||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
||||
Shuffle ? 'Y' :
|
||||
'N',
|
||||
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update the shuffle type of a question");
|
||||
|
||||
/***** Write message *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
@ -6570,7 +6571,8 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
|
|||
{
|
||||
/***** Update existing question *****/
|
||||
/* Update question in database */
|
||||
DB_BuildQuery ("UPDATE tst_questions"
|
||||
DB_QueryUPDATE ("can not update question",
|
||||
"UPDATE tst_questions"
|
||||
" SET EditTime=NOW(),AnsType='%s',Shuffle='%c',"
|
||||
"Stem='%s',Feedback='%s',"
|
||||
"ImageName='%s',ImageTitle='%s',ImageURL='%s'"
|
||||
|
@ -6584,7 +6586,6 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
|
|||
Gbl.Test.Image.Title ? Gbl.Test.Image.Title : "",
|
||||
Gbl.Test.Image.URL ? Gbl.Test.Image.URL : "",
|
||||
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryUPDATE_new ("can not update question");
|
||||
|
||||
/* Update image status */
|
||||
if (Gbl.Test.Image.Name[0])
|
||||
|
@ -7617,13 +7618,13 @@ static void Tst_StoreScoreOfTestResultInDB (long TstCod,
|
|||
{
|
||||
/***** Update score in test result *****/
|
||||
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
||||
DB_BuildQuery ("UPDATE tst_exams"
|
||||
DB_QueryUPDATE ("can not update result of test result",
|
||||
"UPDATE tst_exams"
|
||||
" SET NumQstsNotBlank=%u,Score='%lf'"
|
||||
" WHERE TstCod=%ld",
|
||||
NumQstsNotBlank,Score,
|
||||
TstCod);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
DB_QueryUPDATE_new ("can not update result of test result");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -293,12 +293,10 @@ void The_ChangeTheme (void)
|
|||
|
||||
/***** Store theme in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
DB_BuildQuery ("UPDATE usr_data SET Theme='%s'"
|
||||
DB_QueryUPDATE ("can not update your preference about theme",
|
||||
"UPDATE usr_data SET Theme='%s'"
|
||||
" WHERE UsrCod=%ld",
|
||||
The_ThemeId[Gbl.Prefs.Theme],Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your preference about theme");
|
||||
}
|
||||
|
||||
/***** Set preferences from current IP *****/
|
||||
Pre_SetPrefsFromIP ();
|
||||
|
|
22
swad_user.c
22
swad_user.c
|
@ -3392,16 +3392,14 @@ void Usr_UpdateMyLastData (void)
|
|||
DB_BuildQuery ("SELECT COUNT(*) FROM usr_last WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (DB_QueryCOUNT_new ("can not get last user's click"))
|
||||
{
|
||||
/***** Update my last accessed course, tab and time of click in database *****/
|
||||
// WhatToSearch, LastAccNotif remain unchanged
|
||||
DB_BuildQuery ("UPDATE usr_last SET LastCrs=%ld,LastTab=%u,LastTime=NOW()"
|
||||
DB_QueryUPDATE ("can not update last user's data",
|
||||
"UPDATE usr_last SET LastCrs=%ld,LastTab=%u,LastTime=NOW()"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
(unsigned) Gbl.Action.Tab,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update last user's data");
|
||||
}
|
||||
else
|
||||
Usr_InsertMyLastData ();
|
||||
}
|
||||
|
@ -7228,11 +7226,11 @@ static void Usr_GetMyUsrListTypeFromDB (void)
|
|||
static void Usr_UpdateMyUsrListTypeInDB (void)
|
||||
{
|
||||
/***** Update type of users listing *****/
|
||||
DB_BuildQuery ("UPDATE crs_usr SET UsrListType='%s'"
|
||||
DB_QueryUPDATE ("can not update type of listing",
|
||||
"UPDATE crs_usr SET UsrListType='%s'"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Usr_StringsUsrListTypeInDB[Gbl.Usrs.Me.ListType],
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update type of listing");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -7324,14 +7322,12 @@ static void Usr_GetMyColsClassPhotoFromDB (void)
|
|||
static void Usr_UpdateMyColsClassPhotoInDB (void)
|
||||
{
|
||||
if (Gbl.Usrs.Me.Logged && Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||
{
|
||||
/***** Update number of colums in class photo for current course *****/
|
||||
DB_BuildQuery ("UPDATE crs_usr SET ColsClassPhoto=%u"
|
||||
DB_QueryUPDATE ("can not update number of columns in class photo",
|
||||
"UPDATE crs_usr SET ColsClassPhoto=%u"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.Usrs.ClassPhoto.Cols,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update number of columns in class photo");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -7426,15 +7422,13 @@ void Usr_GetMyPrefAboutListWithPhotosFromDB (void)
|
|||
static void Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB (void)
|
||||
{
|
||||
if (Gbl.Usrs.Me.Logged && Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||
{
|
||||
/***** Update number of colums in class photo for current course *****/
|
||||
DB_BuildQuery ("UPDATE crs_usr SET ListWithPhotos='%c'"
|
||||
DB_QueryUPDATE ("can not update your preference about photos in listing",
|
||||
"UPDATE crs_usr SET ListWithPhotos='%c'"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
Gbl.Usrs.Listing.WithPhotos ? 'Y' :
|
||||
'N',
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not update your preference about photos in listing");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -3177,11 +3177,11 @@ int swad__markNotificationsAsRead (struct soap *soap,
|
|||
if ((NtfCod = Str_ConvertStrCodToLongCod (LongStr)) > 0)
|
||||
{
|
||||
/***** Mark notification as read in the database *****/
|
||||
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)"
|
||||
DB_QueryUPDATE ("can not mark notification as read",
|
||||
"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE NtfCod=%ld AND ToUsrCod=%ld",
|
||||
(unsigned) Ntf_STATUS_BIT_READ,
|
||||
(long) NtfCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE_new ("can not mark notification as read");
|
||||
|
||||
NumNtfsMarkedAsRead++;
|
||||
}
|
||||
|
@ -3470,13 +3470,11 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
|
|||
|
||||
/***** If this recipient is the original sender of a message been replied... *****/
|
||||
if (RecipientUsrCod == ReplyUsrCod)
|
||||
{
|
||||
/***** ...then update received message setting Replied field to true *****/
|
||||
DB_BuildQuery ("UPDATE msg_rcv SET Replied='Y'"
|
||||
DB_QueryUPDATE ("can not update a received message",
|
||||
"UPDATE msg_rcv SET Replied='Y'"
|
||||
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||
OriginalMsgCod,SenderUsrCod);
|
||||
DB_QueryUPDATE_new ("can not update a received message");
|
||||
}
|
||||
|
||||
return SOAP_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user