Version 18.11.24

This commit is contained in:
Antonio Cañas Vargas 2018-11-03 12:16:40 +01:00
parent 8c2707a529
commit 358eb7e95e
53 changed files with 1182 additions and 1173 deletions

View File

@ -381,11 +381,11 @@ void MFU_UpdateMFUActions (void)
Gbl.Usrs.Me.UsrDat.UsrCod,ActCod,Score); Gbl.Usrs.Me.UsrDat.UsrCod,ActCod,Score);
/***** Update score for other actions *****/ /***** 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",
" WHERE UsrCod=%ld AND ActCod<>%ld", "UPDATE actions_MFU SET Score=GREATEST(Score*'%f','%f')"
MFU_DECREASE_FACTOR,MFU_MIN_SCORE, " WHERE UsrCod=%ld AND ActCod<>%ld",
Gbl.Usrs.Me.UsrDat.UsrCod,ActCod); MFU_DECREASE_FACTOR,MFU_MIN_SCORE,
DB_QueryUPDATE_new ("can not update most frequently used actions"); Gbl.Usrs.Me.UsrDat.UsrCod,ActCod);
Str_SetDecimalPointToLocal (); // Return to local system Str_SetDecimalPointToLocal (); // Return to local system
} }

View File

@ -1373,10 +1373,10 @@ void Agd_HideEvent (void)
Agd_GetDataOfEventByCod (&AgdEvent); Agd_GetDataOfEventByCod (&AgdEvent);
/***** Set event private *****/ /***** Set event private *****/
DB_BuildQuery ("UPDATE agendas SET Hidden='Y'" DB_QueryUPDATE ("can not hide event",
" WHERE AgdCod=%ld AND UsrCod=%ld", "UPDATE agendas SET Hidden='Y'"
AgdEvent.AgdCod,AgdEvent.UsrCod); " WHERE AgdCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not hide event"); AgdEvent.AgdCod,AgdEvent.UsrCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1406,10 +1406,10 @@ void Agd_UnhideEvent (void)
Agd_GetDataOfEventByCod (&AgdEvent); Agd_GetDataOfEventByCod (&AgdEvent);
/***** Set event public *****/ /***** Set event public *****/
DB_BuildQuery ("UPDATE agendas SET Hidden='N'" DB_QueryUPDATE ("can not show event",
" WHERE AgdCod=%ld AND UsrCod=%ld", "UPDATE agendas SET Hidden='N'"
AgdEvent.AgdCod,AgdEvent.UsrCod); " WHERE AgdCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not show event"); AgdEvent.AgdCod,AgdEvent.UsrCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1439,10 +1439,10 @@ void Agd_MakeEventPrivate (void)
Agd_GetDataOfEventByCod (&AgdEvent); Agd_GetDataOfEventByCod (&AgdEvent);
/***** Make event private *****/ /***** Make event private *****/
DB_BuildQuery ("UPDATE agendas SET Public='N'" DB_QueryUPDATE ("can not make event private",
" WHERE AgdCod=%ld AND UsrCod=%ld", "UPDATE agendas SET Public='N'"
AgdEvent.AgdCod,AgdEvent.UsrCod); " WHERE AgdCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not make event private"); AgdEvent.AgdCod,AgdEvent.UsrCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1472,10 +1472,10 @@ void Agd_MakeEventPublic (void)
Agd_GetDataOfEventByCod (&AgdEvent); Agd_GetDataOfEventByCod (&AgdEvent);
/***** Make event public *****/ /***** Make event public *****/
DB_BuildQuery ("UPDATE agendas SET Public='Y'" DB_QueryUPDATE ("can not make event public",
" WHERE AgdCod=%ld AND UsrCod=%ld", "UPDATE agendas SET Public='Y'"
AgdEvent.AgdCod,AgdEvent.UsrCod); " WHERE AgdCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not make event public"); AgdEvent.AgdCod,AgdEvent.UsrCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1732,16 +1732,16 @@ static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt) static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
{ {
/***** Update the data of the event *****/ /***** Update the data of the event *****/
DB_BuildQuery ("UPDATE agendas SET " DB_QueryUPDATE ("can not update event",
"StartTime=FROM_UNIXTIME(%ld)," "UPDATE agendas SET "
"EndTime=FROM_UNIXTIME(%ld)," "StartTime=FROM_UNIXTIME(%ld),"
"Event='%s',Location='%s',Txt='%s'" "EndTime=FROM_UNIXTIME(%ld),"
" WHERE AgdCod=%ld AND UsrCod=%ld", "Event='%s',Location='%s',Txt='%s'"
AgdEvent->TimeUTC[Agd_START_TIME], " WHERE AgdCod=%ld AND UsrCod=%ld",
AgdEvent->TimeUTC[Agd_END_TIME ], AgdEvent->TimeUTC[Agd_START_TIME],
AgdEvent->Event,AgdEvent->Location,Txt, AgdEvent->TimeUTC[Agd_END_TIME ],
AgdEvent->AgdCod,AgdEvent->UsrCod); AgdEvent->Event,AgdEvent->Location,Txt,
DB_QueryUPDATE_new ("can not update event"); AgdEvent->AgdCod,AgdEvent->UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -532,10 +532,10 @@ void Ann_HideActiveAnnouncement (void)
AnnCod = Ann_GetParamAnnCod (); AnnCod = Ann_GetParamAnnCod ();
/***** Set global announcement as hidden *****/ /***** Set global announcement as hidden *****/
DB_BuildQuery ("UPDATE announcements SET Status=%u" DB_QueryUPDATE ("can not hide announcement",
" WHERE AnnCod=%ld", "UPDATE announcements SET Status=%u"
(unsigned) Ann_OBSOLETE_ANNOUNCEMENT,AnnCod); " WHERE AnnCod=%ld",
DB_QueryUPDATE_new ("can not hide announcement"); (unsigned) Ann_OBSOLETE_ANNOUNCEMENT,AnnCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -550,10 +550,10 @@ void Ann_RevealHiddenAnnouncement (void)
AnnCod = Ann_GetParamAnnCod (); AnnCod = Ann_GetParamAnnCod ();
/***** Set global announcement as shown *****/ /***** Set global announcement as shown *****/
DB_BuildQuery ("UPDATE announcements SET Status=%u" DB_QueryUPDATE ("can not reveal announcement",
" WHERE AnnCod=%ld", "UPDATE announcements SET Status=%u"
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,AnnCod); " WHERE AnnCod=%ld",
DB_QueryUPDATE_new ("can not reveal announcement"); (unsigned) Ann_ACTIVE_ANNOUNCEMENT,AnnCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1060,10 +1060,10 @@ void Asg_HideAssignment (void)
Asg_GetDataOfAssignmentByCod (&Asg); Asg_GetDataOfAssignmentByCod (&Asg);
/***** Hide assignment *****/ /***** Hide assignment *****/
DB_BuildQuery ("UPDATE assignments SET Hidden='Y'" DB_QueryUPDATE ("can not hide assignment",
" WHERE AsgCod=%ld AND CrsCod=%ld", "UPDATE assignments SET Hidden='Y'"
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod); " WHERE AsgCod=%ld AND CrsCod=%ld",
DB_QueryUPDATE_new ("can not hide assignment"); Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1092,10 +1092,10 @@ void Asg_ShowAssignment (void)
Asg_GetDataOfAssignmentByCod (&Asg); Asg_GetDataOfAssignmentByCod (&Asg);
/***** Hide assignment *****/ /***** Hide assignment *****/
DB_BuildQuery ("UPDATE assignments SET Hidden='N'" DB_QueryUPDATE ("can not show assignment",
" WHERE AsgCod=%ld AND CrsCod=%ld", "UPDATE assignments SET Hidden='N'"
Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod); " WHERE AsgCod=%ld AND CrsCod=%ld",
DB_QueryUPDATE_new ("can not show assignment"); Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1482,10 +1482,11 @@ void Asg_RecFormAssignment (void)
static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigned NumUsrsToBeNotifiedByEMail) static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigned NumUsrsToBeNotifiedByEMail)
{ {
/***** Update number of users notified *****/ /***** Update number of users notified *****/
DB_BuildQuery ("UPDATE assignments SET NumNotif=NumNotif+%u" DB_QueryUPDATE ("can not update the number of notifications"
" WHERE AsgCod=%ld", " of an assignment",
NumUsrsToBeNotifiedByEMail,AsgCod); "UPDATE assignments SET NumNotif=NumNotif+%u"
DB_QueryUPDATE_new ("can not update the number of notifications of an assignment"); " WHERE AsgCod=%ld",
NumUsrsToBeNotifiedByEMail,AsgCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1522,18 +1523,18 @@ static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt)
static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt) static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt)
{ {
/***** Update the data of the assignment *****/ /***** Update the data of the assignment *****/
DB_BuildQuery ("UPDATE assignments SET " DB_QueryUPDATE ("can not update assignment",
"StartTime=FROM_UNIXTIME(%ld)," "UPDATE assignments SET "
"EndTime=FROM_UNIXTIME(%ld)," "StartTime=FROM_UNIXTIME(%ld),"
"Title='%s',Folder='%s',Txt='%s'" "EndTime=FROM_UNIXTIME(%ld),"
" WHERE AsgCod=%ld AND CrsCod=%ld", "Title='%s',Folder='%s',Txt='%s'"
Asg->TimeUTC[Dat_START_TIME], " WHERE AsgCod=%ld AND CrsCod=%ld",
Asg->TimeUTC[Dat_END_TIME ], Asg->TimeUTC[Dat_START_TIME],
Asg->Title, Asg->TimeUTC[Dat_END_TIME ],
Asg->Folder, Asg->Title,
Txt, Asg->Folder,
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod); Txt,
DB_QueryUPDATE_new ("can not update assignment"); Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Update groups *****/ /***** Update groups *****/
/* Remove old groups */ /* Remove old groups */

View File

@ -979,10 +979,10 @@ void Att_HideAttEvent (void)
Att_GetDataOfAttEventByCodAndCheckCrs (&Att); Att_GetDataOfAttEventByCodAndCheckCrs (&Att);
/***** Hide attendance event *****/ /***** Hide attendance event *****/
DB_BuildQuery ("UPDATE att_events SET Hidden='Y'" DB_QueryUPDATE ("can not hide attendance event",
" WHERE AttCod=%ld AND CrsCod=%ld", "UPDATE att_events SET Hidden='Y'"
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod); " WHERE AttCod=%ld AND CrsCod=%ld",
DB_QueryUPDATE_new ("can not hide attendance event"); Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1011,10 +1011,10 @@ void Att_ShowAttEvent (void)
Att_GetDataOfAttEventByCodAndCheckCrs (&Att); Att_GetDataOfAttEventByCodAndCheckCrs (&Att);
/***** Hide attendance event *****/ /***** Hide attendance event *****/
DB_BuildQuery ("UPDATE att_events SET Hidden='N'" DB_QueryUPDATE ("can not show attendance event",
" WHERE AttCod=%ld AND CrsCod=%ld", "UPDATE att_events SET Hidden='N'"
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod); " WHERE AttCod=%ld AND CrsCod=%ld",
DB_QueryUPDATE_new ("can not show attendance event"); Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1386,22 +1386,22 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt)
void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt) void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt)
{ {
/***** Update the data of the attendance event *****/ /***** Update the data of the attendance event *****/
DB_BuildQuery ("UPDATE att_events SET " DB_QueryUPDATE ("can not update attendance event",
"Hidden='%c'," "UPDATE att_events SET "
"StartTime=FROM_UNIXTIME(%ld)," "Hidden='%c',"
"EndTime=FROM_UNIXTIME(%ld)," "StartTime=FROM_UNIXTIME(%ld),"
"CommentTchVisible='%c',Title='%s',Txt='%s'" "EndTime=FROM_UNIXTIME(%ld),"
" WHERE AttCod=%ld AND CrsCod=%ld", "CommentTchVisible='%c',Title='%s',Txt='%s'"
Att->Hidden ? 'Y' : " WHERE AttCod=%ld AND CrsCod=%ld",
'N', Att->Hidden ? 'Y' :
Att->TimeUTC[Att_START_TIME], 'N',
Att->TimeUTC[Att_END_TIME ], Att->TimeUTC[Att_START_TIME],
Att->CommentTchVisible ? 'Y' : Att->TimeUTC[Att_END_TIME ],
'N', Att->CommentTchVisible ? 'Y' :
Att->Title, 'N',
Txt, Att->Title,
Att->AttCod,Gbl.CurrentCrs.Crs.CrsCod); Txt,
DB_QueryUPDATE_new ("can not update attendance event"); Att->AttCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Update groups *****/ /***** Update groups *****/
/* Remove old groups */ /* Remove old groups */
@ -2592,13 +2592,11 @@ void Att_RegUsrInAttEventNotChangingComments (long AttCod,long UsrCod)
{ {
// If already present ==> nothing to do // If already present ==> nothing to do
if (!Present) if (!Present)
{
/***** Set user as present in database *****/ /***** 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",
" WHERE AttCod=%ld AND UsrCod=%ld", "UPDATE att_usr SET Present='Y'"
AttCod,UsrCod); " WHERE AttCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not set user as present in an event"); AttCod,UsrCod);
}
} }
else // User is not in table att_usr else // User is not in table att_usr
Att_RegUsrInAttEventChangingComments (AttCod,UsrCod,true,"",""); Att_RegUsrInAttEventChangingComments (AttCod,UsrCod,true,"","");

View File

@ -572,14 +572,12 @@ static void Ban_ShowOrHideBanner (bool Hide)
/***** Mark file as hidden/visible in database *****/ /***** Mark file as hidden/visible in database *****/
if (Ban.Hidden != Hide) if (Ban.Hidden != Hide)
{ DB_QueryUPDATE ("can not change status of a banner in database",
DB_BuildQuery ("UPDATE banners SET Hidden='%c'" "UPDATE banners SET Hidden='%c'"
" WHERE BanCod=%ld", " WHERE BanCod=%ld",
Hide ? 'Y' : Hide ? 'Y' :
'N', 'N',
Ban.BanCod); Ban.BanCod);
DB_QueryUPDATE_new ("can not change status of a banner in database");
}
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -725,9 +723,9 @@ static void Ban_UpdateBanNameDB (long BanCod,const char *FieldName,
const char *NewBanName) const char *NewBanName)
{ {
/***** Update banner changing old name by new name *****/ /***** 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",
FieldName,NewBanName,BanCod); "UPDATE banners SET %s='%s' WHERE BanCod=%ld",
DB_QueryUPDATE_new ("can not update the name of a banner"); FieldName,NewBanName,BanCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -755,9 +753,9 @@ void Ban_ChangeBannerImg (void)
if (NewImg[0]) if (NewImg[0])
{ {
/* Update the table changing old image by new image */ /* 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",
NewImg,Ban->BanCod); "UPDATE banners SET Img='%s' WHERE BanCod=%ld",
DB_QueryUPDATE_new ("can not update the image of a banner"); NewImg,Ban->BanCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -800,9 +798,9 @@ void Ban_ChangeBannerWWW (void)
if (NewWWW[0]) if (NewWWW[0])
{ {
/* Update the table changing old WWW by new WWW */ /* 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",
NewWWW,Ban->BanCod); "UPDATE banners SET WWW='%s' WHERE BanCod=%ld",
DB_QueryUPDATE_new ("can not update the web of a banner"); NewWWW,Ban->BanCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -151,13 +151,11 @@ void Cal_ChangeFirstDayOfWeek (void)
/***** Store icon first day of week database *****/ /***** Store icon first day of week database *****/
if (Gbl.Usrs.Me.Logged) if (Gbl.Usrs.Me.Logged)
{ DB_QueryUPDATE ("can not update your preference about first day of week",
DB_BuildQuery ("UPDATE usr_data SET FirstDayOfWeek=%u" "UPDATE usr_data SET FirstDayOfWeek=%u"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
Gbl.Prefs.FirstDayOfWeek, Gbl.Prefs.FirstDayOfWeek,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE_new ("can not update your preference about first day of week");
}
/***** Set preferences from current IP *****/ /***** Set preferences from current IP *****/
Pre_SetPrefsFromIP (); Pre_SetPrefsFromIP ();

View File

@ -1876,9 +1876,9 @@ void Ctr_ContEditAfterChgCtrInConfig (void)
static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod) static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod)
{ {
/***** Update institution in table of centres *****/ /***** 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",
InsCod,CtrCod); "UPDATE centres SET InsCod=%ld WHERE CtrCod=%ld",
DB_QueryUPDATE_new ("can not update the institution of a centre"); InsCod,CtrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1939,9 +1939,9 @@ void Ctr_ChangeCtrPlcInConfig (void)
static void Ctr_UpdateCtrPlcDB (long CtrCod,long NewPlcCod) 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",
NewPlcCod,CtrCod); "UPDATE centres SET PlcCod=%ld WHERE CtrCod=%ld",
DB_QueryUPDATE_new ("can not update the place of a centre"); NewPlcCod,CtrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -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) static void Ctr_UpdateInsNameDB (long CtrCod,const char *FieldName,const char *NewCtrName)
{ {
/***** Update centre changing old name by new name */ /***** 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",
FieldName,NewCtrName,CtrCod); "UPDATE centres SET %s='%s' WHERE CtrCod=%ld",
DB_QueryUPDATE_new ("can not update the name of a centre"); FieldName,NewCtrName,CtrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2165,9 +2165,9 @@ static void Ctr_UpdateCtrWWWDB (long CtrCod,
const char NewWWW[Cns_MAX_BYTES_WWW + 1]) const char NewWWW[Cns_MAX_BYTES_WWW + 1])
{ {
/***** Update database changing old WWW by new WWW *****/ /***** 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",
NewWWW,CtrCod); "UPDATE centres SET WWW='%s' WHERE CtrCod=%ld",
DB_QueryUPDATE_new ("can not update the web of a centre"); NewWWW,CtrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2198,9 +2198,9 @@ void Ctr_ChangeCtrStatus (void)
Ctr_GetDataOfCentreByCod (&Gbl.Ctrs.EditingCtr); Ctr_GetDataOfCentreByCod (&Gbl.Ctrs.EditingCtr);
/***** Update status in table of centres *****/ /***** 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",
(unsigned) Status,Gbl.Ctrs.EditingCtr.CtrCod); "UPDATE centres SET Status=%u WHERE CtrCod=%ld",
DB_QueryUPDATE_new ("can not update the status of a centre"); (unsigned) Status,Gbl.Ctrs.EditingCtr.CtrCod);
Gbl.Ctrs.EditingCtr.Status = Status; Gbl.Ctrs.EditingCtr.Status = Status;
/***** Write message to show the change made /***** Write message to show the change made
@ -2480,10 +2480,11 @@ void Ctr_ChangeCtrPhotoAttribution (void)
Par_GetParToText ("Attribution",NewPhotoAttribution,Img_MAX_BYTES_ATTRIBUTION); Par_GetParToText ("Attribution",NewPhotoAttribution,Img_MAX_BYTES_ATTRIBUTION);
/***** Update the table changing old attribution by new 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"
" WHERE CtrCod=%ld", " of the current centre",
NewPhotoAttribution,Gbl.CurrentCtr.Ctr.CtrCod); "UPDATE centres SET PhotoAttribution='%s'"
DB_QueryUPDATE_new ("can not update the photo attribution of the current centre"); " WHERE CtrCod=%ld",
NewPhotoAttribution,Gbl.CurrentCtr.Ctr.CtrCod);
/***** Show the centre information again *****/ /***** Show the centre information again *****/
Ctr_ShowConfiguration (); Ctr_ShowConfiguration ();

View File

@ -355,10 +355,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf 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 CSS_FILE "swad18.4.css"
#define JS_FILE "swad17.17.1.js" #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.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.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) Version 18.11.21: Nov 02, 2018 Joining building and performing query into one function. (236580 lines)

View File

@ -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) static void Cty_UpdateCtyNameDB (long CtyCod,const char *FieldName,const char *NewCtyName)
{ {
/***** Update country changing old name by new name */ /***** 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",
FieldName,NewCtyName,CtyCod); "UPDATE countries SET %s='%s' WHERE CtyCod='%03ld'",
DB_QueryUPDATE_new ("can not update the name of a country"); FieldName,NewCtyName,CtyCod);
/***** Flush cache *****/ /***** Flush cache *****/
Cty_FlushCacheCountryName (); Cty_FlushCacheCountryName ();
@ -1903,10 +1903,10 @@ void Cty_ChangeCtyWWW (void)
Cty_GetDataOfCountryByCod (Cty,Cty_GET_EXTRA_DATA); Cty_GetDataOfCountryByCod (Cty,Cty_GET_EXTRA_DATA);
/***** Update the table changing old WWW by new WWW *****/ /***** 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",
" WHERE CtyCod='%03ld'", "UPDATE countries SET WWW_%s='%s'"
Txt_STR_LANG_ID[Language],NewWWW,Cty->CtyCod); " WHERE CtyCod='%03ld'",
DB_QueryUPDATE_new ("can not update the web of a country"); Txt_STR_LANG_ID[Language],NewWWW,Cty->CtyCod);
Str_Copy (Cty->WWW[Language],NewWWW, Str_Copy (Cty->WWW[Language],NewWWW,
Cns_MAX_BYTES_WWW); Cns_MAX_BYTES_WWW);
@ -1933,10 +1933,10 @@ void Cty_ChangeCtyMapAttribution (void)
Par_GetParToText ("Attribution",NewMapAttribution,Img_MAX_BYTES_ATTRIBUTION); Par_GetParToText ("Attribution",NewMapAttribution,Img_MAX_BYTES_ATTRIBUTION);
/***** Update the table changing old attribution by new 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",
" WHERE CtyCod='%03ld'", "UPDATE countries SET MapAttribution='%s'"
NewMapAttribution,Gbl.CurrentCty.Cty.CtyCod); " WHERE CtyCod='%03ld'",
DB_QueryUPDATE_new ("can not update the map attribution of a country"); NewMapAttribution,Gbl.CurrentCty.Cty.CtyCod);
/***** Show the country information again *****/ /***** Show the country information again *****/
Cty_ShowConfiguration (); Cty_ShowConfiguration ();

View File

@ -2183,10 +2183,10 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
/***** Remove exam announcements in the course *****/ /***** Remove exam announcements in the course *****/
/* Mark all exam announcements in the course as deleted */ /* 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",
" WHERE CrsCod=%ld", "UPDATE exam_announcements SET Status=%u"
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,CrsCod); " WHERE CrsCod=%ld",
DB_QueryUPDATE_new ("can not remove exam announcements of a course"); (unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,CrsCod);
/***** Remove course cards of the course *****/ /***** Remove course cards of the course *****/
/* Remove content of course cards */ /* Remove content of course cards */
@ -2445,9 +2445,9 @@ void Crs_ContEditAfterChgCrsInConfig (void)
static void Crs_UpdateCrsDegDB (long CrsCod,long DegCod) static void Crs_UpdateCrsDegDB (long CrsCod,long DegCod)
{ {
/***** Update degree in table of courses *****/ /***** 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",
DegCod,CrsCod); "UPDATE courses SET DegCod=%ld WHERE CrsCod=%ld",
DB_QueryUPDATE_new ("can not move course to another degree"); DegCod,CrsCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2591,9 +2591,9 @@ void Crs_ChangeCrsYear (void)
static void Crs_UpdateCrsYear (struct Course *Crs,unsigned NewYear) static void Crs_UpdateCrsYear (struct Course *Crs,unsigned NewYear)
{ {
/***** Update year/semester in table of courses *****/ /***** 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",
NewYear,Crs->CrsCod); "UPDATE courses SET Year=%u WHERE CrsCod=%ld",
DB_QueryUPDATE_new ("can not update the year of a course"); NewYear,Crs->CrsCod);
/***** Copy course year/semester *****/ /***** Copy course year/semester *****/
Crs->Year = NewYear; 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) void Crs_UpdateInstitutionalCrsCod (struct Course *Crs,const char *NewInstitutionalCrsCod)
{ {
/***** Update institutional course code in table of courses *****/ /***** 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"
NewInstitutionalCrsCod,Crs->CrsCod); " of the current course",
DB_QueryUPDATE_new ("can not update the institutional code" "UPDATE courses SET InsCrsCod='%s' WHERE CrsCod=%ld",
" of the current course"); NewInstitutionalCrsCod,Crs->CrsCod);
/***** Copy institutional course code *****/ /***** Copy institutional course code *****/
Str_Copy (Crs->InstitutionalCrsCod,NewInstitutionalCrsCod, 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) static void Crs_UpdateCrsNameDB (long CrsCod,const char *FieldName,const char *NewCrsName)
{ {
/***** Update course changing old name by new name *****/ /***** 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",
FieldName,NewCrsName,CrsCod); "UPDATE courses SET %s='%s' WHERE CrsCod=%ld",
DB_QueryUPDATE_new ("can not update the name of a course"); FieldName,NewCrsName,CrsCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2800,9 +2800,9 @@ void Crs_ChangeCrsStatus (void)
Crs_GetDataOfCourseByCod (&Gbl.Degs.EditingCrs); Crs_GetDataOfCourseByCod (&Gbl.Degs.EditingCrs);
/***** Update status in table of courses *****/ /***** 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",
(unsigned) Status,Gbl.Degs.EditingCrs.CrsCod); "UPDATE courses SET Status=%u WHERE CrsCod=%ld",
DB_QueryUPDATE_new ("can not update the status of a course"); (unsigned) Status,Gbl.Degs.EditingCrs.CrsCod);
Gbl.Degs.EditingCrs.Status = Status; Gbl.Degs.EditingCrs.Status = Status;
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
@ -3356,13 +3356,11 @@ void Crs_UpdateCrsLast (void)
{ {
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Gbl.Usrs.Me.Role.Logged >= Rol_STD) Gbl.Usrs.Me.Role.Logged >= Rol_STD)
{
/***** Update my last access to current course *****/ /***** 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",
" VALUES (%ld,NOW())", "REPLACE INTO crs_last (CrsCod,LastTime)"
Gbl.CurrentCrs.Crs.CrsCod); " VALUES (%ld,NOW())",
DB_QueryUPDATE_new ("can not update last access to current course"); Gbl.CurrentCrs.Crs.CrsCod);
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -3313,9 +3313,22 @@ void DB_QueryREPLACE (const char *MsgError,const char *fmt,...)
/******************** Make a UPDATE query from database **********************/ /******************** 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) void DB_QueryUPDATE_old (char **Query,const char *MsgError)

View File

@ -55,7 +55,7 @@ long DB_QueryINSERTandReturnCode (const char *MsgError,const char *fmt,...);
void DB_QueryREPLACE (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_QueryUPDATE_old (char **Query,const char *MsgError);
void DB_QueryDELETE (const char *MsgError,const char *fmt,...); void DB_QueryDELETE (const char *MsgError,const char *fmt,...);

View File

@ -184,13 +184,11 @@ void Dat_ChangeDateFormat (void)
/***** Store date format in database *****/ /***** Store date format in database *****/
if (Gbl.Usrs.Me.Logged) if (Gbl.Usrs.Me.Logged)
{ DB_QueryUPDATE ("can not update your preference about date format",
DB_BuildQuery ("UPDATE usr_data SET DateFormat=%u" "UPDATE usr_data SET DateFormat=%u"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
(unsigned) Gbl.Prefs.DateFormat, (unsigned) Gbl.Prefs.DateFormat,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE_new ("can not update your preference about date format");
}
/***** Set preferences from current IP *****/ /***** Set preferences from current IP *****/
Pre_SetPrefsFromIP (); Pre_SetPrefsFromIP ();

View File

@ -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) static void Deg_UpdateDegNameDB (long DegCod,const char *FieldName,const char *NewDegName)
{ {
/***** Update degree changing old name by new name *****/ /***** 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",
FieldName,NewDegName,DegCod); "UPDATE degrees SET %s='%s' WHERE DegCod=%ld",
DB_QueryUPDATE_new ("can not update the name of a degree"); FieldName,NewDegName,DegCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2119,9 +2119,9 @@ void Deg_ContEditAfterChgDegInConfig (void)
static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod) static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod)
{ {
/***** Update centre in table of degrees *****/ /***** 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",
CtrCod,DegCod); "UPDATE degrees SET CtrCod=%ld WHERE DegCod=%ld",
DB_QueryUPDATE_new ("can not update the centre of a degree"); CtrCod,DegCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2205,9 +2205,9 @@ void Deg_ChangeDegWWWInConfig (void)
static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]) static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
{ {
/***** Update database changing old WWW by new WWW *****/ /***** 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",
NewWWW,DegCod); "UPDATE degrees SET WWW='%s' WHERE DegCod=%ld",
DB_QueryUPDATE_new ("can not update the web of a degree"); NewWWW,DegCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2239,9 +2239,9 @@ void Deg_ChangeDegStatus (void)
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg); Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
/***** Update status in table of degrees *****/ /***** 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",
(unsigned) Status,Gbl.Degs.EditingDeg.DegCod); "UPDATE degrees SET Status=%u WHERE DegCod=%ld",
DB_QueryUPDATE_new ("can not update the status of a degree"); (unsigned) Status,Gbl.Degs.EditingDeg.DegCod);
Gbl.Degs.EditingDeg.Status = Status; Gbl.Degs.EditingDeg.Status = Status;

View File

@ -957,10 +957,10 @@ void DT_RenameDegreeType (void)
else else
{ {
/* Update the table changing old name by new name */ /* 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",
" WHERE DegTypCod=%ld", "UPDATE deg_types SET DegTypName='%s'"
NewNameDegTyp,DegTyp->DegTypCod); " WHERE DegTypCod=%ld",
DB_QueryUPDATE_new ("can not update the type of a degree"); NewNameDegTyp,DegTyp->DegTypCod);
/* Write message to show the change made */ /* Write message to show the change made */
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1017,9 +1017,9 @@ void DT_ChangeDegreeType (void)
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg); Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
/***** Update the table of degrees changing old type by new type *****/ /***** 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",
NewDegTypCod,Gbl.Degs.EditingDeg.DegCod); "UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld",
DB_QueryUPDATE_new ("can not update the type of a degree"); NewDegTypCod,Gbl.Degs.EditingDeg.DegCod);
/***** Write message to show the change made /***** Write message to show the change made
and put button to go to degree changed *****/ and put button to go to degree changed *****/

View File

@ -652,9 +652,9 @@ void Dpt_ChangeDepartIns (void)
Dpt->InsCod = Ins_GetAndCheckParamOtherInsCod (1); Dpt->InsCod = Ins_GetAndCheckParamOtherInsCod (1);
/***** Update institution in table of departments *****/ /***** 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",
Dpt->InsCod,Dpt->DptCod); "UPDATE departments SET InsCod=%ld WHERE DptCod=%ld",
DB_QueryUPDATE_new ("can not update the institution of a department"); Dpt->InsCod,Dpt->DptCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_institution_of_the_department_has_changed); 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) static void Dpt_UpdateDegNameDB (long DptCod,const char *FieldName,const char *NewDptName)
{ {
/***** Update department changing old name by new name *****/ /***** 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",
FieldName,NewDptName,DptCod); "UPDATE departments SET %s='%s' WHERE DptCod=%ld",
DB_QueryUPDATE_new ("can not update the name of a department"); FieldName,NewDptName,DptCod);
} }
/******************************************************************************/ /******************************************************************************/
@ -823,9 +823,9 @@ void Dpt_ChangeDptWWW (void)
if (NewWWW[0]) if (NewWWW[0])
{ {
/* Update the table changing old WWW by new WWW */ /* 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",
NewWWW,Dpt->DptCod); "UPDATE departments SET WWW='%s' WHERE DptCod=%ld",
DB_QueryUPDATE_new ("can not update the web of a department"); NewWWW,Dpt->DptCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -221,10 +221,10 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
} }
/***** Update the role of a user in a course *****/ /***** 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",
" WHERE CrsCod=%ld AND UsrCod=%ld", "UPDATE crs_usr SET Role=%u"
(unsigned) NewRole,Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod); " WHERE CrsCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not modify user's role in course"); (unsigned) NewRole,Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
/***** Flush caches *****/ /***** Flush caches *****/
Usr_FlushCachesUsr (); Usr_FlushCachesUsr ();
@ -526,27 +526,27 @@ void Enr_UpdateUsrData (struct UsrData *UsrDat)
/***** Update user's common data *****/ /***** Update user's common data *****/
Usr_CreateBirthdayStrDB (UsrDat,BirthdayStrDB); // It can include start and ending apostrophes Usr_CreateBirthdayStrDB (UsrDat,BirthdayStrDB); // It can include start and ending apostrophes
DB_BuildQuery ("UPDATE usr_data" DB_QueryUPDATE ("can not update user's data",
" SET Password='%s'," "UPDATE usr_data"
"Surname1='%s',Surname2='%s',FirstName='%s',Sex='%s'," " SET Password='%s',"
"CtyCod=%ld," "Surname1='%s',Surname2='%s',FirstName='%s',Sex='%s',"
"LocalAddress='%s',LocalPhone='%s'," "CtyCod=%ld,"
"FamilyAddress='%s',FamilyPhone='%s'," "LocalAddress='%s',LocalPhone='%s',"
"OriginPlace='%s',Birthday=%s," "FamilyAddress='%s',FamilyPhone='%s',"
"Comments='%s'" "OriginPlace='%s',Birthday=%s,"
" WHERE UsrCod=%ld", "Comments='%s'"
UsrDat->Password, " WHERE UsrCod=%ld",
UsrDat->Surname1,UsrDat->Surname2,UsrDat->FirstName, UsrDat->Password,
Usr_StringsSexDB[UsrDat->Sex], UsrDat->Surname1,UsrDat->Surname2,UsrDat->FirstName,
UsrDat->CtyCod, Usr_StringsSexDB[UsrDat->Sex],
UsrDat->LocalAddress,UsrDat->LocalPhone, UsrDat->CtyCod,
UsrDat->FamilyAddress,UsrDat->FamilyPhone, UsrDat->LocalAddress,UsrDat->LocalPhone,
UsrDat->OriginPlace, UsrDat->FamilyAddress,UsrDat->FamilyPhone,
BirthdayStrDB, UsrDat->OriginPlace,
UsrDat->Comments ? UsrDat->Comments : BirthdayStrDB,
"", UsrDat->Comments ? UsrDat->Comments :
UsrDat->UsrCod); "",
DB_QueryUPDATE_new ("can not update user's data"); UsrDat->UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -569,15 +569,15 @@ void Enr_FilterUsrDat (struct UsrData *UsrDat)
void Enr_UpdateInstitutionCentreDepartment (void) void Enr_UpdateInstitutionCentreDepartment (void)
{ {
DB_BuildQuery ("UPDATE usr_data" DB_QueryUPDATE ("can not update institution, centre and department",
" SET InsCtyCod=%ld,InsCod=%ld,CtrCod=%ld,DptCod=%ld" "UPDATE usr_data"
" WHERE UsrCod=%ld", " SET InsCtyCod=%ld,InsCod=%ld,CtrCod=%ld,DptCod=%ld"
Gbl.Usrs.Me.UsrDat.InsCtyCod, " WHERE UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.InsCod, Gbl.Usrs.Me.UsrDat.InsCtyCod,
Gbl.Usrs.Me.UsrDat.Tch.CtrCod, Gbl.Usrs.Me.UsrDat.InsCod,
Gbl.Usrs.Me.UsrDat.Tch.DptCod, Gbl.Usrs.Me.UsrDat.Tch.CtrCod,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.Tch.DptCod,
DB_QueryUPDATE_new ("can not update institution, centre and department"); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2044,15 +2044,13 @@ void Enr_SignUpInCrs (void)
/***** Request user in current course in database *****/ /***** Request user in current course in database *****/
if (ReqCod > 0) // Old request exists in database if (ReqCod > 0) // Old request exists in database
{ DB_QueryUPDATE ("can not update enrolment request",
DB_BuildQuery ("UPDATE crs_usr_requests SET Role=%u,RequestTime=NOW()" "UPDATE crs_usr_requests SET Role=%u,RequestTime=NOW()"
" WHERE ReqCod=%ld AND CrsCod=%ld AND UsrCod=%ld", " WHERE ReqCod=%ld AND CrsCod=%ld AND UsrCod=%ld",
(unsigned) RoleFromForm, (unsigned) RoleFromForm,
ReqCod, ReqCod,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE_new ("can not update enrolment request");
}
else // No request in database for this user in this course else // No request in database for this user in this course
ReqCod = ReqCod =
DB_QueryINSERTandReturnCode ("can not save enrolment request", DB_QueryINSERTandReturnCode ("can not save enrolment request",
@ -3061,15 +3059,15 @@ static void Enr_RemoveExpiredEnrolmentRequests (void)
{ {
/***** Mark possible notifications as removed /***** Mark possible notifications as removed
Important: do this before removing the request *****/ Important: do this before removing the request *****/
DB_BuildQuery ("UPDATE notif,crs_usr_requests" DB_QueryUPDATE ("can not set notification(s) as removed",
" SET notif.Status=(notif.Status | %u)" "UPDATE notif,crs_usr_requests"
" WHERE notif.NotifyEvent=%u" " SET notif.Status=(notif.Status | %u)"
" AND notif.Cod=crs_usr_requests.ReqCod" " WHERE notif.NotifyEvent=%u"
" AND crs_usr_requests.RequestTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')", " AND notif.Cod=crs_usr_requests.ReqCod"
(unsigned) Ntf_STATUS_BIT_REMOVED, " AND crs_usr_requests.RequestTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
(unsigned) Ntf_EVENT_ENROLMENT_REQUEST, (unsigned) Ntf_STATUS_BIT_REMOVED,
Cfg_TIME_TO_DELETE_ENROLMENT_REQUESTS); (unsigned) Ntf_EVENT_ENROLMENT_REQUEST,
DB_QueryUPDATE_new ("can not set notification(s) as removed"); Cfg_TIME_TO_DELETE_ENROLMENT_REQUESTS);
/***** Remove expired requests for enrolment *****/ /***** Remove expired requests for enrolment *****/
DB_QueryDELETE ("can not 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) void Enr_AcceptUsrInCrs (long UsrCod)
{ {
/***** Set enrolment of a user to "accepted" in the current course *****/ /***** 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",
" WHERE CrsCod=%ld AND UsrCod=%ld", "UPDATE crs_usr SET Accepted='Y'"
Gbl.CurrentCrs.Crs.CrsCod,UsrCod); " WHERE CrsCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not confirm user's enrolment"); Gbl.CurrentCrs.Crs.CrsCod,UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -319,10 +319,11 @@ void Exa_ReceiveExamAnnouncement2 (void)
static void Exa_UpdateNumUsrsNotifiedByEMailAboutExamAnnouncement (long ExaCod,unsigned NumUsrsToBeNotifiedByEMail) static void Exa_UpdateNumUsrsNotifiedByEMailAboutExamAnnouncement (long ExaCod,unsigned NumUsrsToBeNotifiedByEMail)
{ {
/***** Update number of users notified *****/ /***** Update number of users notified *****/
DB_BuildQuery ("UPDATE exam_announcements SET NumNotif=NumNotif+%u" DB_QueryUPDATE ("can not update the number of notifications"
" WHERE ExaCod=%ld", " of an exam announcement",
NumUsrsToBeNotifiedByEMail,ExaCod); "UPDATE exam_announcements SET NumNotif=NumNotif+%u"
DB_QueryUPDATE_new ("can not update the number of notifications of an exam announcement"); " WHERE ExaCod=%ld",
NumUsrsToBeNotifiedByEMail,ExaCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -391,11 +392,11 @@ void Exa_RemoveExamAnnouncement1 (void)
Lay_ShowErrorAndExit ("Code of exam announcement is missing."); Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
/***** Mark the exam announcement as deleted in the database *****/ /***** Mark the exam announcement as deleted in the database *****/
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u" DB_QueryUPDATE ("can not remove exam announcement",
" WHERE ExaCod=%ld AND CrsCod=%ld", "UPDATE exam_announcements SET Status=%u"
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT, " WHERE ExaCod=%ld AND CrsCod=%ld",
ExaCod,Gbl.CurrentCrs.Crs.CrsCod); (unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,
DB_QueryUPDATE_new ("can not remove exam announcement"); ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Mark possible notifications as removed *****/ /***** Mark possible notifications as removed *****/
Ntf_MarkNotifAsRemoved (Ntf_EVENT_EXAM_ANNOUNCEMENT,ExaCod); Ntf_MarkNotifAsRemoved (Ntf_EVENT_EXAM_ANNOUNCEMENT,ExaCod);
@ -433,11 +434,11 @@ void Exa_HideExamAnnouncement1 (void)
Lay_ShowErrorAndExit ("Code of exam announcement is missing."); Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
/***** Mark the exam announcement as hidden in the database *****/ /***** Mark the exam announcement as hidden in the database *****/
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u" DB_QueryUPDATE ("can not hide exam announcement",
" WHERE ExaCod=%ld AND CrsCod=%ld", "UPDATE exam_announcements SET Status=%u"
(unsigned) Exa_HIDDEN_EXAM_ANNOUNCEMENT, " WHERE ExaCod=%ld AND CrsCod=%ld",
ExaCod,Gbl.CurrentCrs.Crs.CrsCod); (unsigned) Exa_HIDDEN_EXAM_ANNOUNCEMENT,
DB_QueryUPDATE_new ("can not hide exam announcement"); ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
} }
void Exa_HideExamAnnouncement2 (void) void Exa_HideExamAnnouncement2 (void)
@ -466,11 +467,11 @@ void Exa_UnhideExamAnnouncement1 (void)
Lay_ShowErrorAndExit ("Code of exam announcement is missing."); Lay_ShowErrorAndExit ("Code of exam announcement is missing.");
/***** Mark the exam announcement as visible in the database *****/ /***** Mark the exam announcement as visible in the database *****/
DB_BuildQuery ("UPDATE exam_announcements SET Status=%u" DB_QueryUPDATE ("can not unhide exam announcement",
" WHERE ExaCod=%ld AND CrsCod=%ld", "UPDATE exam_announcements SET Status=%u"
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT, " WHERE ExaCod=%ld AND CrsCod=%ld",
ExaCod,Gbl.CurrentCrs.Crs.CrsCod); (unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT,
DB_QueryUPDATE_new ("can not unhide exam announcement"); ExaCod,Gbl.CurrentCrs.Crs.CrsCod);
} }
void Exa_UnhideExamAnnouncement2 (void) void Exa_UnhideExamAnnouncement2 (void)
@ -774,32 +775,32 @@ static long Exa_AddExamAnnouncementToDB (void)
static void Exa_ModifyExamAnnouncementInDB (void) static void Exa_ModifyExamAnnouncementInDB (void)
{ {
/***** Modify exam announcement *****/ /***** Modify exam announcement *****/
DB_BuildQuery ("UPDATE exam_announcements" DB_QueryUPDATE ("can not update an exam announcement",
" SET CrsFullName='%s',Year=%u,ExamSession='%s'," "UPDATE exam_announcements"
"ExamDate='%04u-%02u-%02u %02u:%02u:00'," " SET CrsFullName='%s',Year=%u,ExamSession='%s',"
"Duration='%02u:%02u:00'," "ExamDate='%04u-%02u-%02u %02u:%02u:00',"
"Place='%s',ExamMode='%s',Structure='%s'," "Duration='%02u:%02u:00',"
"DocRequired='%s',MatRequired='%s',MatAllowed='%s',OtherInfo='%s'" "Place='%s',ExamMode='%s',Structure='%s',"
" WHERE ExaCod=%ld", "DocRequired='%s',MatRequired='%s',MatAllowed='%s',OtherInfo='%s'"
Gbl.ExamAnns.ExaDat.CrsFullName, " WHERE ExaCod=%ld",
Gbl.ExamAnns.ExaDat.Year, Gbl.ExamAnns.ExaDat.CrsFullName,
Gbl.ExamAnns.ExaDat.Session, Gbl.ExamAnns.ExaDat.Year,
Gbl.ExamAnns.ExaDat.ExamDate.Year, Gbl.ExamAnns.ExaDat.Session,
Gbl.ExamAnns.ExaDat.ExamDate.Month, Gbl.ExamAnns.ExaDat.ExamDate.Year,
Gbl.ExamAnns.ExaDat.ExamDate.Day, Gbl.ExamAnns.ExaDat.ExamDate.Month,
Gbl.ExamAnns.ExaDat.StartTime.Hour, Gbl.ExamAnns.ExaDat.ExamDate.Day,
Gbl.ExamAnns.ExaDat.StartTime.Minute, Gbl.ExamAnns.ExaDat.StartTime.Hour,
Gbl.ExamAnns.ExaDat.Duration.Hour, Gbl.ExamAnns.ExaDat.StartTime.Minute,
Gbl.ExamAnns.ExaDat.Duration.Minute, Gbl.ExamAnns.ExaDat.Duration.Hour,
Gbl.ExamAnns.ExaDat.Place, Gbl.ExamAnns.ExaDat.Duration.Minute,
Gbl.ExamAnns.ExaDat.Mode, Gbl.ExamAnns.ExaDat.Place,
Gbl.ExamAnns.ExaDat.Structure, Gbl.ExamAnns.ExaDat.Mode,
Gbl.ExamAnns.ExaDat.DocRequired, Gbl.ExamAnns.ExaDat.Structure,
Gbl.ExamAnns.ExaDat.MatRequired, Gbl.ExamAnns.ExaDat.DocRequired,
Gbl.ExamAnns.ExaDat.MatAllowed, Gbl.ExamAnns.ExaDat.MatRequired,
Gbl.ExamAnns.ExaDat.OtherInfo, Gbl.ExamAnns.ExaDat.MatAllowed,
Gbl.ExamAnns.ExaDat.ExaCod); Gbl.ExamAnns.ExaDat.OtherInfo,
DB_QueryUPDATE_new ("can not update an exam announcement"); Gbl.ExamAnns.ExaDat.ExaCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -4262,11 +4262,11 @@ static void Brw_UpdateLastAccess (void)
static void Brw_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod) static void Brw_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod)
{ {
/***** Update the group of my last access to a common zone *****/ /***** 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",
" WHERE CrsCod=%ld AND UsrCod=%ld", "UPDATE crs_usr SET %s=%ld"
FieldNameDB,GrpCod, " WHERE CrsCod=%ld AND UsrCod=%ld",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); FieldNameDB,GrpCod,
DB_QueryUPDATE_new ("can not update the group of the last access to a file browser"); Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -7831,15 +7831,15 @@ static void Brw_UpdatePathInClipboard (void)
long WorksUsrCod = Brw_GetWorksUsrCodForClipboard (); long WorksUsrCod = Brw_GetWorksUsrCodForClipboard ();
/***** Update path in my clipboard *****/ /***** Update path in my clipboard *****/
DB_BuildQuery ("UPDATE clipboard SET FileBrowser=%u," DB_QueryUPDATE ("can not update source of copy in clipboard",
"Cod=%ld,WorksUsrCod=%ld," "UPDATE clipboard SET FileBrowser=%u,"
"FileType=%u,Path='%s'" "Cod=%ld,WorksUsrCod=%ld,"
" WHERE UsrCod=%ld", "FileType=%u,Path='%s'"
(unsigned) Gbl.FileBrowser.Type, " WHERE UsrCod=%ld",
Cod,WorksUsrCod, (unsigned) Gbl.FileBrowser.Type,
(unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree, Cod,WorksUsrCod,
Gbl.Usrs.Me.UsrDat.UsrCod); (unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree,
DB_QueryUPDATE_new ("can not update source of copy in clipboard"); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -7986,27 +7986,29 @@ static void Brw_UpdateClickTimeOfThisFileBrowserInExpandedFolders (void)
if (Cod > 0) if (Cod > 0)
{ {
if (WorksUsrCod > 0) if (WorksUsrCod > 0)
DB_BuildQuery ("UPDATE expanded_folders SET ClickTime=NOW()" DB_QueryUPDATE ("can not update expanded folder",
" WHERE UsrCod=%ld AND FileBrowser=%u" "UPDATE expanded_folders SET ClickTime=NOW()"
" AND Cod=%ld AND WorksUsrCod=%ld", " WHERE UsrCod=%ld AND FileBrowser=%u"
Gbl.Usrs.Me.UsrDat.UsrCod, " AND Cod=%ld AND WorksUsrCod=%ld",
(unsigned) FileBrowserForExpandedFolders, Gbl.Usrs.Me.UsrDat.UsrCod,
Cod, (unsigned) FileBrowserForExpandedFolders,
WorksUsrCod); Cod,
WorksUsrCod);
else else
DB_BuildQuery ("UPDATE expanded_folders SET ClickTime=NOW()" DB_QueryUPDATE ("can not update expanded folder",
" WHERE UsrCod=%ld AND FileBrowser=%u" "UPDATE expanded_folders SET ClickTime=NOW()"
" AND Cod=%ld", " WHERE UsrCod=%ld AND FileBrowser=%u"
Gbl.Usrs.Me.UsrDat.UsrCod, " AND Cod=%ld",
(unsigned) FileBrowserForExpandedFolders, Gbl.Usrs.Me.UsrDat.UsrCod,
Cod); (unsigned) FileBrowserForExpandedFolders,
Cod);
} }
else // Briefcase else // Briefcase
DB_BuildQuery ("UPDATE expanded_folders SET ClickTime=NOW()" DB_QueryUPDATE ("can not update expanded folder",
" WHERE UsrCod=%ld AND FileBrowser=%u", "UPDATE expanded_folders SET ClickTime=NOW()"
Gbl.Usrs.Me.UsrDat.UsrCod, " WHERE UsrCod=%ld AND FileBrowser=%u",
(unsigned) FileBrowserForExpandedFolders); Gbl.Usrs.Me.UsrDat.UsrCod,
DB_QueryUPDATE_new ("can not update expanded folder"); (unsigned) FileBrowserForExpandedFolders);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -8104,53 +8106,57 @@ static void Brw_RenameAffectedExpandedFolders (Brw_FileBrowser_t FileBrowser,
if (MyUsrCod > 0) if (MyUsrCod > 0)
{ {
if (WorksUsrCod > 0) if (WorksUsrCod > 0)
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))" DB_QueryUPDATE ("can not update expanded folders",
" WHERE UsrCod=%ld AND FileBrowser=%u" "UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
" AND Cod=%ld AND WorksUsrCod=%ld" " WHERE UsrCod=%ld AND FileBrowser=%u"
" AND Path LIKE '%s/%%'", " AND Cod=%ld AND WorksUsrCod=%ld"
NewPath,StartFinalSubpathNotChanged, " AND Path LIKE '%s/%%'",
MyUsrCod,(unsigned) FileBrowserForExpandedFolders, NewPath,StartFinalSubpathNotChanged,
Cod,WorksUsrCod, MyUsrCod,(unsigned) FileBrowserForExpandedFolders,
OldPath); Cod,WorksUsrCod,
OldPath);
else else
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))" DB_QueryUPDATE ("can not update expanded folders",
" WHERE UsrCod=%ld AND FileBrowser=%u" "UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
" AND Cod=%ld" " WHERE UsrCod=%ld AND FileBrowser=%u"
" AND Path LIKE '%s/%%'", " AND Cod=%ld"
NewPath,StartFinalSubpathNotChanged, " AND Path LIKE '%s/%%'",
MyUsrCod,(unsigned) FileBrowserForExpandedFolders, NewPath,StartFinalSubpathNotChanged,
Cod, MyUsrCod,(unsigned) FileBrowserForExpandedFolders,
OldPath); Cod,
OldPath);
} }
else // MyUsrCod <= 0 means expanded folders for any user else // MyUsrCod <= 0 means expanded folders for any user
{ {
if (WorksUsrCod > 0) if (WorksUsrCod > 0)
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))" DB_QueryUPDATE ("can not update expanded folders",
" WHERE FileBrowser=%u AND Cod=%ld" "UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
" AND WorksUsrCod=%ld" " WHERE FileBrowser=%u AND Cod=%ld"
" AND Path LIKE '%s/%%'", " AND WorksUsrCod=%ld"
NewPath,StartFinalSubpathNotChanged, " AND Path LIKE '%s/%%'",
(unsigned) FileBrowserForExpandedFolders,Cod, NewPath,StartFinalSubpathNotChanged,
WorksUsrCod, (unsigned) FileBrowserForExpandedFolders,Cod,
OldPath); WorksUsrCod,
OldPath);
else else
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))" DB_QueryUPDATE ("can not update expanded folders",
" WHERE FileBrowser=%u AND Cod=%ld" "UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
" AND Path LIKE '%s/%%'", " WHERE FileBrowser=%u AND Cod=%ld"
NewPath,StartFinalSubpathNotChanged, " AND Path LIKE '%s/%%'",
(unsigned) FileBrowserForExpandedFolders,Cod, NewPath,StartFinalSubpathNotChanged,
OldPath); (unsigned) FileBrowserForExpandedFolders,Cod,
OldPath);
} }
} }
else // Briefcase else // Briefcase
DB_BuildQuery ("UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))" DB_QueryUPDATE ("can not update expanded folders",
" WHERE UsrCod=%ld AND FileBrowser=%u" "UPDATE expanded_folders SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
" AND Path LIKE '%s/%%'", " WHERE UsrCod=%ld AND FileBrowser=%u"
NewPath,StartFinalSubpathNotChanged, " AND Path LIKE '%s/%%'",
MyUsrCod, NewPath,StartFinalSubpathNotChanged,
(unsigned) FileBrowserForExpandedFolders, MyUsrCod,
OldPath); (unsigned) FileBrowserForExpandedFolders,
DB_QueryUPDATE_new ("can not update expanded folders"); OldPath);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -11552,13 +11558,11 @@ static unsigned Brw_GetFileViewsFromMe (long FilCod)
static void Brw_UpdateFileViews (unsigned NumViews,long FilCod) static void Brw_UpdateFileViews (unsigned NumViews,long FilCod)
{ {
if (NumViews) if (NumViews)
{
/* Update number of views in database */ /* 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",
" WHERE FilCod=%ld AND UsrCod=%ld", "UPDATE file_view SET NumViews=NumViews+1"
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod); " WHERE FilCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not update number of views of a file"); FilCod,Gbl.Usrs.Me.UsrDat.UsrCod);
}
else // NumViews == 0 else // NumViews == 0
/* Insert number of views in database */ /* Insert number of views in database */
DB_QueryINSERT ("can not insert number of views of a file", DB_QueryINSERT ("can not insert number of views of a file",
@ -11629,15 +11633,15 @@ static void Brw_ChangeFileOrFolderHiddenInDB (const char Path[PATH_MAX + 1],bool
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles (); long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
/***** Mark file as hidden in database *****/ /***** Mark file as hidden in database *****/
DB_BuildQuery ("UPDATE files SET Hidden='%c'" DB_QueryUPDATE ("can not change status of a file in database",
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld" "UPDATE files SET Hidden='%c'"
" AND Path='%s'", " WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
IsHidden ? 'Y' : " AND Path='%s'",
'N', IsHidden ? 'Y' :
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type], 'N',
Cod,ZoneUsrCod, (unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Path); Cod,ZoneUsrCod,
DB_QueryUPDATE_new ("can not change status of a file in database"); Path);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -11651,17 +11655,17 @@ static void Brw_ChangeFilePublicInDB (long PublisherUsrCod,const char *Path,
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles (); long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
/***** Change publisher, public and license of file in database *****/ /***** 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",
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld" "UPDATE files SET PublisherUsrCod=%ld,Public='%c',License=%u"
" AND Path='%s'", " WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
PublisherUsrCod, " AND Path='%s'",
IsPublic ? 'Y' : PublisherUsrCod,
'N', IsPublic ? 'Y' :
(unsigned) License, 'N',
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type], (unsigned) License,
Cod,ZoneUsrCod, (unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Path); Cod,ZoneUsrCod,
DB_QueryUPDATE_new ("can not change metadata of a file in database"); Path);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -11948,13 +11952,13 @@ static void Brw_RenameOneFolderInDB (const char OldPath[PATH_MAX + 1],
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles (); long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
/***** Update file or folder in table of common files *****/ /***** 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",
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld AND Path='%s'", "UPDATE files SET Path='%s'"
NewPath, " WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld AND Path='%s'",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type], NewPath,
Cod,ZoneUsrCod, (unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
OldPath); Cod,ZoneUsrCod,
DB_QueryUPDATE_new ("can not update folder name in a common zone"); OldPath);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -11969,14 +11973,14 @@ static void Brw_RenameChildrenFilesOrFoldersInDB (const char OldPath[PATH_MAX +
unsigned StartFinalSubpathNotChanged = strlen (OldPath) + 2; unsigned StartFinalSubpathNotChanged = strlen (OldPath) + 2;
/***** Update children of a folder in table of files *****/ /***** 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",
" WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld" "UPDATE files SET Path=CONCAT('%s','/',SUBSTRING(Path,%u))"
" AND Path LIKE '%s/%%'", " WHERE FileBrowser=%u AND Cod=%ld AND ZoneUsrCod=%ld"
NewPath,StartFinalSubpathNotChanged, " AND Path LIKE '%s/%%'",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type], NewPath,StartFinalSubpathNotChanged,
Cod,ZoneUsrCod, (unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
OldPath); Cod,ZoneUsrCod,
DB_QueryUPDATE_new ("can not rename file or folder names in a common zone"); OldPath);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -720,10 +720,10 @@ void For_GetForumTypeAndLocationOfAPost (long PstCod,struct Forum *Forum)
static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod) static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod)
{ {
/***** Update the code of the first and last posts of a thread *****/ /***** 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",
" WHERE ThrCod=%ld", "UPDATE forum_thread SET FirstPstCod=%ld,LastPstCod=%ld"
FirstPstCod,LastPstCod,ThrCod); " WHERE ThrCod=%ld",
DB_QueryUPDATE_new ("can not update a thread of a forum"); FirstPstCod,LastPstCod,ThrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -733,10 +733,10 @@ static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long Last
static void For_UpdateThrLastPst (long ThrCod,long LastPstCod) static void For_UpdateThrLastPst (long ThrCod,long LastPstCod)
{ {
/***** Update the code of the last post of a thread *****/ /***** 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",
" WHERE ThrCod=%ld", "UPDATE forum_thread SET LastPstCod=%ld"
LastPstCod,ThrCod); " WHERE ThrCod=%ld",
DB_QueryUPDATE_new ("can not update a thread of a forum"); LastPstCod,ThrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4072,10 +4072,10 @@ void For_ReceiveForumPost (void)
static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumUsrsToBeNotifiedByEMail) static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumUsrsToBeNotifiedByEMail)
{ {
/***** Update number of users notified *****/ /***** 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",
" WHERE PstCod=%ld", "UPDATE forum_post SET NumNotif=NumNotif+%u"
NumUsrsToBeNotifiedByEMail,PstCod); " WHERE PstCod=%ld",
DB_QueryUPDATE_new ("can not update the number of notifications of a post"); NumUsrsToBeNotifiedByEMail,PstCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4418,53 +4418,57 @@ static void For_MoveThrToCurrentForum (long ThrCod)
case For_FORUM_GLOBAL_TCHS: case For_FORUM_GLOBAL_TCHS:
case For_FORUM__SWAD__USRS: case For_FORUM__SWAD__USRS:
case For_FORUM__SWAD__TCHS: case For_FORUM__SWAD__TCHS:
DB_BuildQuery ("UPDATE forum_thread" DB_QueryUPDATE ("can not move a thread to current forum",
" SET ForumType=%u,Location=-1" "UPDATE forum_thread"
" WHERE ThrCod=%ld", " SET ForumType=%u,Location=-1"
(unsigned) Gbl.Forum.ForumSelected.Type, " WHERE ThrCod=%ld",
ThrCod); (unsigned) Gbl.Forum.ForumSelected.Type,
ThrCod);
break; break;
case For_FORUM_INSTIT_USRS: case For_FORUM_INSTIT_USRS:
case For_FORUM_INSTIT_TCHS: case For_FORUM_INSTIT_TCHS:
DB_BuildQuery ("UPDATE forum_thread" DB_QueryUPDATE ("can not move a thread to current forum",
" SET ForumType=%u,Location=%ld" "UPDATE forum_thread"
" WHERE ThrCod=%ld", " SET ForumType=%u,Location=%ld"
(unsigned) Gbl.Forum.ForumSelected.Type, " WHERE ThrCod=%ld",
Gbl.Forum.ForumSelected.Location, (unsigned) Gbl.Forum.ForumSelected.Type,
ThrCod); Gbl.Forum.ForumSelected.Location,
ThrCod);
break; break;
case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_USRS:
case For_FORUM_CENTRE_TCHS: case For_FORUM_CENTRE_TCHS:
DB_BuildQuery ("UPDATE forum_thread" DB_QueryUPDATE ("can not move a thread to current forum",
" SET ForumType=%u,Location=%ld" "UPDATE forum_thread"
" WHERE ThrCod=%ld", " SET ForumType=%u,Location=%ld"
(unsigned) Gbl.Forum.ForumSelected.Type, " WHERE ThrCod=%ld",
Gbl.Forum.ForumSelected.Location, (unsigned) Gbl.Forum.ForumSelected.Type,
ThrCod); Gbl.Forum.ForumSelected.Location,
ThrCod);
break; break;
case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS: case For_FORUM_DEGREE_TCHS:
DB_BuildQuery ("UPDATE forum_thread" DB_QueryUPDATE ("can not move a thread to current forum",
" SET ForumType=%u,Location=%ld" "UPDATE forum_thread"
" WHERE ThrCod=%ld", " SET ForumType=%u,Location=%ld"
(unsigned) Gbl.Forum.ForumSelected.Type, " WHERE ThrCod=%ld",
Gbl.Forum.ForumSelected.Location, (unsigned) Gbl.Forum.ForumSelected.Type,
ThrCod); Gbl.Forum.ForumSelected.Location,
ThrCod);
break; break;
case For_FORUM_COURSE_USRS: case For_FORUM_COURSE_USRS:
case For_FORUM_COURSE_TCHS: case For_FORUM_COURSE_TCHS:
DB_BuildQuery ("UPDATE forum_thread" DB_QueryUPDATE ("can not move a thread to current forum",
" SET ForumType=%u,Location=%ld" "UPDATE forum_thread"
" WHERE ThrCod=%ld", " SET ForumType=%u,Location=%ld"
(unsigned) Gbl.Forum.ForumSelected.Type, " WHERE ThrCod=%ld",
Gbl.Forum.ForumSelected.Location, (unsigned) Gbl.Forum.ForumSelected.Type,
ThrCod); Gbl.Forum.ForumSelected.Location,
ThrCod);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong forum."); Lay_ShowErrorAndExit ("Wrong forum.");
break; break;
} }
DB_QueryUPDATE_new ("can not move a thread to current forum");
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1623,11 +1623,12 @@ void Gam_ResetGame (void)
Game.GamCod); Game.GamCod);
/***** Reset all the answers in this game *****/ /***** 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",
" WHERE gam_questions.GamCod=%ld" "UPDATE gam_answers,gam_questions"
" AND gam_questions.QstCod=gam_answers.QstCod", " SET gam_answers.NumUsrs=0"
Game.GamCod); " WHERE gam_questions.GamCod=%ld"
DB_QueryUPDATE_new ("can not reset answers of a game"); " AND gam_questions.QstCod=gam_answers.QstCod",
Game.GamCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1658,8 +1659,9 @@ void Gam_HideGame (void)
Lay_ShowErrorAndExit ("You can not hide this game."); Lay_ShowErrorAndExit ("You can not hide this game.");
/***** Hide game *****/ /***** Hide game *****/
DB_BuildQuery ("UPDATE games SET Hidden='Y' WHERE GamCod=%ld",Game.GamCod); DB_QueryUPDATE ("can not hide game",
DB_QueryUPDATE_new ("can not hide game"); "UPDATE games SET Hidden='Y' WHERE GamCod=%ld",
Game.GamCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1690,8 +1692,9 @@ void Gam_UnhideGame (void)
Lay_ShowErrorAndExit ("You can not unhide this game."); Lay_ShowErrorAndExit ("You can not unhide this game.");
/***** Show game *****/ /***** Show game *****/
DB_BuildQuery ("UPDATE games SET Hidden='N' WHERE GamCod=%ld",Game.GamCod); DB_QueryUPDATE ("can not show game",
DB_QueryUPDATE_new ("can not show game"); "UPDATE games SET Hidden='N' WHERE GamCod=%ld",
Game.GamCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -2217,20 +2220,20 @@ static void Gam_UpdateGame (struct Game *Game,const char *Txt)
extern const char *Txt_The_game_has_been_modified; extern const char *Txt_The_game_has_been_modified;
/***** Update the data of the game *****/ /***** Update the data of the game *****/
DB_BuildQuery ("UPDATE games" DB_QueryUPDATE ("can not update game",
" SET Scope='%s',Cod=%ld,Roles=%u," "UPDATE games"
"StartTime=FROM_UNIXTIME(%ld)," " SET Scope='%s',Cod=%ld,Roles=%u,"
"EndTime=FROM_UNIXTIME(%ld)," "StartTime=FROM_UNIXTIME(%ld),"
"Title='%s',Txt='%s'" "EndTime=FROM_UNIXTIME(%ld),"
" WHERE GamCod=%ld", "Title='%s',Txt='%s'"
Sco_ScopeDB[Game->Scope],Game->Cod, " WHERE GamCod=%ld",
Game->Roles, Sco_ScopeDB[Game->Scope],Game->Cod,
Game->TimeUTC[Gam_START_TIME], Game->Roles,
Game->TimeUTC[Gam_END_TIME ], Game->TimeUTC[Gam_START_TIME],
Game->Title, Game->TimeUTC[Gam_END_TIME ],
Txt, Game->Title,
Game->GamCod); Txt,
DB_QueryUPDATE_new ("can not update game"); Game->GamCod);
/***** Update groups *****/ /***** Update groups *****/
/* Remove old groups */ /* Remove old groups */
@ -3287,10 +3290,10 @@ void Gam_RemoveQst (void)
Lay_ShowErrorAndExit ("The question to be removed does not exist."); Lay_ShowErrorAndExit ("The question to be removed does not exist.");
/* Change index of questions greater than this */ /* Change index of questions greater than this */
DB_BuildQuery ("UPDATE gam_questions SET QstInd=QstInd-1" DB_QueryUPDATE ("can not update indexes of questions",
" WHERE GamCod=%ld AND QstInd>%u", "UPDATE gam_questions SET QstInd=QstInd-1"
Game.GamCod,QstInd); " WHERE GamCod=%ld AND QstInd>%u",
DB_QueryUPDATE_new ("can not update indexes of questions"); Game.GamCod,QstInd);
/***** Write message *****/ /***** Write message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed); Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
@ -3433,17 +3436,17 @@ static void Gam_ExchangeQuestions (long GamCod,
| 2 | 232 | | 2 | 232 | | 2 | 232 | | 2 | 232 | | 2 | 232 | | 2 | 232 |
+--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+
*/ */
DB_BuildQuery ("UPDATE gam_questions SET QstInd=%u" DB_QueryUPDATE ("can not exchange indexes of questions",
" WHERE GamCod=%ld AND QstCod=%ld", "UPDATE gam_questions SET QstInd=%u"
QstIndBottom, " WHERE GamCod=%ld AND QstCod=%ld",
GamCod,QstCodTop); QstIndBottom,
DB_QueryUPDATE_new ("can not exchange indexes of questions"); GamCod,QstCodTop);
DB_BuildQuery ("UPDATE gam_questions SET QstInd=%u" DB_QueryUPDATE ("can not exchange indexes of questions",
" WHERE GamCod=%ld AND QstCod=%ld", "UPDATE gam_questions SET QstInd=%u"
QstIndTop, " WHERE GamCod=%ld AND QstCod=%ld",
GamCod,QstCodBottom); QstIndTop,
DB_QueryUPDATE_new ("can not exchange indexes of questions"); GamCod,QstCodBottom);
/***** Unlock table *****/ /***** Unlock table *****/
Gbl.DB.LockedTables = false; // Set to false before the following unlock... Gbl.DB.LockedTables = false; // Set to false before the following unlock...

View File

@ -2818,16 +2818,16 @@ void Grp_OpenGroupsAutomatically (void)
{ {
/***** Open all the closed groups in this course the must be opened /***** Open all the closed groups in this course the must be opened
and with open time in the past ****/ and with open time in the past ****/
DB_BuildQuery ("UPDATE crs_grp SET Open='Y'" DB_QueryUPDATE ("can not open groups",
" WHERE GrpTypCod=%ld AND Open='N'", "UPDATE crs_grp SET Open='Y'"
GrpTypCod); " WHERE GrpTypCod=%ld AND Open='N'",
DB_QueryUPDATE_new ("can not open groups"); GrpTypCod);
/***** To not try to open groups again, set MustBeOpened to false *****/ /***** 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",
" WHERE GrpTypCod=%ld", "UPDATE crs_grp_types SET MustBeOpened='N'"
GrpTypCod); " WHERE GrpTypCod=%ld",
DB_QueryUPDATE_new ("can not update the opening of a type of group"); GrpTypCod);
} }
} }
@ -4042,11 +4042,11 @@ static void Grp_RemoveGroupTypeCompletely (void)
Svy_RemoveGroupsOfType (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod); Svy_RemoveGroupsOfType (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
/***** Change all groups of this type in course timetable *****/ /***** 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",
" WHERE GrpCod IN" "UPDATE timetable_crs SET GrpCod=-1"
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)", " WHERE GrpCod IN"
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod); " (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)",
DB_QueryUPDATE_new ("can not update all groups of a type in course timetable"); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
/***** Remove all the students in groups of this type *****/ /***** Remove all the students in groups of this type *****/
DB_QueryDELETE ("can not remove users from all groups of a 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); Svy_RemoveGroup (GrpDat.GrpCod);
/***** Change this group in course timetable *****/ /***** 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",
Gbl.CurrentCrs.Grps.GrpCod); "UPDATE timetable_crs SET GrpCod=-1 WHERE GrpCod=%ld",
DB_QueryUPDATE_new ("can not update a group in course timetable"); Gbl.CurrentCrs.Grps.GrpCod);
/***** Remove all the students in this group *****/ /***** Remove all the students in this group *****/
DB_QueryDELETE ("can not remove users from a group", DB_QueryDELETE ("can not remove users from a group",
@ -4142,9 +4142,9 @@ void Grp_OpenGroup (void)
Grp_GetDataOfGroupByCod (&GrpDat); Grp_GetDataOfGroupByCod (&GrpDat);
/***** Update the table of groups changing open/close status *****/ /***** 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",
Gbl.CurrentCrs.Grps.GrpCod); "UPDATE crs_grp SET Open='Y' WHERE GrpCod=%ld",
DB_QueryUPDATE_new ("can not open a group"); Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -4175,9 +4175,9 @@ void Grp_CloseGroup (void)
Grp_GetDataOfGroupByCod (&GrpDat); Grp_GetDataOfGroupByCod (&GrpDat);
/***** Update the table of groups changing open/close status *****/ /***** 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",
Gbl.CurrentCrs.Grps.GrpCod); "UPDATE crs_grp SET Open='N' WHERE GrpCod=%ld",
DB_QueryUPDATE_new ("can not close a group"); Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -4208,9 +4208,9 @@ void Grp_EnableFileZonesGrp (void)
Grp_GetDataOfGroupByCod (&GrpDat); Grp_GetDataOfGroupByCod (&GrpDat);
/***** Update the table of groups changing file zones status *****/ /***** 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",
Gbl.CurrentCrs.Grps.GrpCod); "UPDATE crs_grp SET FileZones='Y' WHERE GrpCod=%ld",
DB_QueryUPDATE_new ("can not enable file zones of a group"); Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -4241,9 +4241,9 @@ void Grp_DisableFileZonesGrp (void)
Grp_GetDataOfGroupByCod (&GrpDat); Grp_GetDataOfGroupByCod (&GrpDat);
/***** Update the table of groups changing file zones status *****/ /***** 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",
Gbl.CurrentCrs.Grps.GrpCod); "UPDATE crs_grp SET FileZones='N' WHERE GrpCod=%ld",
DB_QueryUPDATE_new ("can not disable file zones of a group"); Gbl.CurrentCrs.Grps.GrpCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -4292,9 +4292,9 @@ void Grp_ChangeGroupType (void)
else // Group is not in database else // Group is not in database
{ {
/* Update the table of groups changing old type by new type */ /* 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",
NewGrpTypCod,Gbl.CurrentCrs.Grps.GrpCod); "UPDATE crs_grp SET GrpTypCod=%ld WHERE GrpCod=%ld",
DB_QueryUPDATE_new ("can not update the type of a group"); NewGrpTypCod,Gbl.CurrentCrs.Grps.GrpCod);
/* Create message to show the change made */ /* Create message to show the change made */
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
@ -4344,11 +4344,11 @@ void Grp_ChangeMandatGrpTyp (void)
else else
{ {
/***** Update of the table of types of group changing the old type of enrolment by the new *****/ /***** 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",
NewMandatoryEnrolment ? 'Y' : "UPDATE crs_grp_types SET Mandatory='%c' WHERE GrpTypCod=%ld",
'N', NewMandatoryEnrolment ? 'Y' :
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod); 'N',
DB_QueryUPDATE_new ("can not update enrolment type of a type of group"); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
@ -4399,12 +4399,12 @@ void Grp_ChangeMultiGrpTyp (void)
else else
{ {
/***** Update of the table of types of group changing the old type of enrolment by the new *****/ /***** 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",
" WHERE GrpTypCod=%ld", "UPDATE crs_grp_types SET Multiple='%c'"
NewMultipleEnrolment ? 'Y' : " WHERE GrpTypCod=%ld",
'N', NewMultipleEnrolment ? 'Y' :
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod); 'N',
DB_QueryUPDATE_new ("can not update enrolment type of a type of group"); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
@ -4441,14 +4441,14 @@ void Grp_ChangeOpenTimeGrpTyp (void)
/***** Update the table of types of group /***** Update the table of types of group
changing the old open time of enrolment by the new *****/ 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",
" SET MustBeOpened='%c',OpenTime=FROM_UNIXTIME(%ld)" "UPDATE crs_grp_types"
" WHERE GrpTypCod=%ld", " SET MustBeOpened='%c',OpenTime=FROM_UNIXTIME(%ld)"
Gbl.CurrentCrs.Grps.GrpTyp.MustBeOpened ? 'Y' : " WHERE GrpTypCod=%ld",
'N', Gbl.CurrentCrs.Grps.GrpTyp.MustBeOpened ? 'Y' :
(long) Gbl.CurrentCrs.Grps.GrpTyp.OpenTimeUTC, 'N',
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod); (long) Gbl.CurrentCrs.Grps.GrpTyp.OpenTimeUTC,
DB_QueryUPDATE_new ("can not update enrolment type of a type of group"); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed); Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed);
@ -4498,9 +4498,10 @@ void Grp_ChangeMaxStdsGrp (void)
else else
{ {
/***** Update the table of groups changing the old maximum of students to the new *****/ /***** 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"
NewMaxStds,Gbl.CurrentCrs.Grps.GrpCod); " in a group",
DB_QueryUPDATE_new ("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);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
@ -4593,11 +4594,11 @@ void Grp_RenameGroupType (void)
else else
{ {
/* Update the table changing old name by new name */ /* 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",
" WHERE GrpTypCod=%ld", "UPDATE crs_grp_types SET GrpTypName='%s'"
NewNameGrpTyp, " WHERE GrpTypCod=%ld",
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod); NewNameGrpTyp,
DB_QueryUPDATE_new ("can not update the type of a group"); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;
@ -4672,9 +4673,9 @@ void Grp_RenameGroup (void)
else else
{ {
/* Update the table changing old name by new name */ /* 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",
NewNameGrp,Gbl.CurrentCrs.Grps.GrpCod); "UPDATE crs_grp SET GrpName='%s' WHERE GrpCod=%ld",
DB_QueryUPDATE_new ("can not update the name of a group"); NewNameGrp,Gbl.CurrentCrs.Grps.GrpCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
AlertType = Ale_SUCCESS; AlertType = Ale_SUCCESS;

View File

@ -713,9 +713,9 @@ void Hld_ChangeHolidayPlace1 (void)
Hld_GetDataOfHolidayByCod (Hld); Hld_GetDataOfHolidayByCod (Hld);
/***** Update the place in database *****/ /***** 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",
NewPlace.PlcCod,Hld->HldCod); "UPDATE holidays SET PlcCod=%ld WHERE HldCod=%ld",
DB_QueryUPDATE_new ("can not update the place of a holiday"); NewPlace.PlcCod,Hld->HldCod);
Hld->PlcCod = NewPlace.PlcCod; Hld->PlcCod = NewPlace.PlcCod;
Str_Copy (Hld->PlaceFullName,NewPlace.FullName, Str_Copy (Hld->PlaceFullName,NewPlace.FullName,
Plc_MAX_BYTES_PLACE_FULL_NAME); Plc_MAX_BYTES_PLACE_FULL_NAME);
@ -759,10 +759,10 @@ void Hld_ChangeHolidayType1 (void)
/***** Update holiday/no school period in database *****/ /***** Update holiday/no school period in database *****/
Dat_AssignDate (&Hld->EndDate,&Hld->StartDate); 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",
" WHERE HldCod=%ld", "UPDATE holidays SET HldTyp=%u,EndDate=StartDate"
(unsigned) Hld->HldTyp,Hld->HldCod); " WHERE HldCod=%ld",
DB_QueryUPDATE_new ("can not update the type of a holiday"); (unsigned) Hld->HldTyp,Hld->HldCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Gbl.Alert.Type = Ale_SUCCESS; Gbl.Alert.Type = Ale_SUCCESS;
@ -854,13 +854,13 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
} }
/***** Update the date in database *****/ /***** 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",
StrStartOrEndDate, "UPDATE holidays SET %s='%04u%02u%02u' WHERE HldCod=%ld",
NewDate.Year, StrStartOrEndDate,
NewDate.Month, NewDate.Year,
NewDate.Day, NewDate.Month,
Hld->HldCod); NewDate.Day,
DB_QueryUPDATE_new ("can not update the date of a holiday"); Hld->HldCod);
Dat_AssignDate (PtrDate,&NewDate); Dat_AssignDate (PtrDate,&NewDate);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
@ -924,9 +924,9 @@ void Hld_RenameHoliday1 (void)
{ {
/***** If degree was in database... *****/ /***** If degree was in database... *****/
/* Update the table changing old name by new name */ /* 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",
NewHldName,Hld->HldCod); "UPDATE holidays SET Name='%s' WHERE HldCod=%ld",
DB_QueryUPDATE_new ("can not update the text of a holiday"); NewHldName,Hld->HldCod);
Str_Copy (Hld->Name,NewHldName, Str_Copy (Hld->Name,NewHldName,
Hld_MAX_BYTES_HOLIDAY_NAME); Hld_MAX_BYTES_HOLIDAY_NAME);

View File

@ -132,12 +132,10 @@ void Ico_ChangeIconSet (void)
/***** Store icon set in database *****/ /***** Store icon set in database *****/
if (Gbl.Usrs.Me.Logged) if (Gbl.Usrs.Me.Logged)
{ DB_QueryUPDATE ("can not update your preference about icon set",
DB_BuildQuery ("UPDATE usr_data SET IconSet='%s' WHERE UsrCod=%ld", "UPDATE usr_data SET IconSet='%s' WHERE UsrCod=%ld",
Ico_IconSetId[Gbl.Prefs.IconSet], Ico_IconSetId[Gbl.Prefs.IconSet],
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE_new ("can not update your preference about icon set");
}
/***** Set preferences from current IP *****/ /***** Set preferences from current IP *****/
Pre_SetPrefsFromIP (); Pre_SetPrefsFromIP ();

View File

@ -1450,9 +1450,9 @@ int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators) static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators)
{ {
/***** Store number of indicators of a course in database *****/ /***** 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",
NumIndicators,CrsCod); "UPDATE courses SET NumIndicators=%u WHERE CrsCod=%ld",
DB_QueryUPDATE_new ("can not store number of indicators of a course"); NumIndicators,CrsCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -699,13 +699,13 @@ static bool Inf_GetIfIHaveReadFromForm (void)
static void Inf_SetForceReadIntoDB (bool MustBeRead) static void Inf_SetForceReadIntoDB (bool MustBeRead)
{ {
/***** Insert or replace info source for a specific type of course information *****/ /***** 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",
" WHERE CrsCod=%ld AND InfoType='%s'", "UPDATE crs_info_src SET MustBeRead='%c'"
MustBeRead ? 'Y' : " WHERE CrsCod=%ld AND InfoType='%s'",
'N', MustBeRead ? 'Y' :
Gbl.CurrentCrs.Crs.CrsCod, 'N',
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]); Gbl.CurrentCrs.Crs.CrsCod,
DB_QueryUPDATE_new ("can not update if info must be read"); Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -715,17 +715,15 @@ static void Inf_SetForceReadIntoDB (bool MustBeRead)
static void Inf_SetIHaveReadIntoDB (bool IHaveRead) static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
{ {
if (IHaveRead) if (IHaveRead)
{
/***** Insert I have read course information *****/ /***** Insert I have read course information *****/
DB_BuildQuery ("REPLACE INTO crs_info_read" DB_QueryREPLACE ("can not set that I have read course info",
" (UsrCod,CrsCod,InfoType)" "REPLACE INTO crs_info_read"
" VALUES" " (UsrCod,CrsCod,InfoType)"
" (%ld,%ld,'%s')", " VALUES"
Gbl.Usrs.Me.UsrDat.UsrCod, " (%ld,%ld,'%s')",
Gbl.CurrentCrs.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]); Gbl.CurrentCrs.Crs.CrsCod,
DB_QueryUPDATE_new ("can not set that I have read course info"); Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
}
else else
/***** Remove I have read course information *****/ /***** Remove I have read course information *****/
DB_QueryDELETE ("can not set that I have not read course info", 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 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 { // Update info source
if (InfoSrc == Inf_INFO_SRC_NONE) if (InfoSrc == Inf_INFO_SRC_NONE)
DB_BuildQuery ("UPDATE crs_info_src SET InfoSrc='%s',MustBeRead='N'" DB_QueryUPDATE ("can not update info source",
" WHERE CrsCod=%ld AND InfoType='%s'", "UPDATE crs_info_src SET InfoSrc='%s',MustBeRead='N'"
Inf_NamesInDBForInfoSrc[Inf_INFO_SRC_NONE], " WHERE CrsCod=%ld AND InfoType='%s'",
Gbl.CurrentCrs.Crs.CrsCod, Inf_NamesInDBForInfoSrc[Inf_INFO_SRC_NONE],
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]); Gbl.CurrentCrs.Crs.CrsCod,
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
else // MustBeRead remains unchanged else // MustBeRead remains unchanged
DB_BuildQuery ("UPDATE crs_info_src SET InfoSrc='%s'" DB_QueryUPDATE ("can not update info source",
" WHERE CrsCod=%ld AND InfoType='%s'", "UPDATE crs_info_src SET InfoSrc='%s'"
Inf_NamesInDBForInfoSrc[InfoSrc], " WHERE CrsCod=%ld AND InfoType='%s'",
Gbl.CurrentCrs.Crs.CrsCod, Inf_NamesInDBForInfoSrc[InfoSrc],
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]); Gbl.CurrentCrs.Crs.CrsCod,
DB_QueryUPDATE_new ("can not update info source"); Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
} }
else // Info is not stored in database, so insert it else // Info is not stored in database, so insert it
DB_QueryINSERT ("can not insert info source", DB_QueryINSERT ("can not insert info source",

View File

@ -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) static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName)
{ {
/***** Update institution changing old name by new name */ /***** 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",
FieldName,NewInsName,InsCod); "UPDATE institutions SET %s='%s' WHERE InsCod=%ld",
DB_QueryUPDATE_new ("can not update the name of an institution"); FieldName,NewInsName,InsCod);
/***** Flush caches *****/ /***** Flush caches *****/
Ins_FlushCacheShortNameOfInstitution (); Ins_FlushCacheShortNameOfInstitution ();
@ -1967,9 +1967,9 @@ void Ins_ContEditAfterChgInsInConfig (void)
static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod) static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod)
{ {
/***** Update country in table of institutions *****/ /***** 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",
CtyCod,InsCod); "UPDATE institutions SET CtyCod=%ld WHERE InsCod=%ld",
DB_QueryUPDATE_new ("can not update the country of an institution"); CtyCod,InsCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2053,9 +2053,9 @@ void Ins_ChangeInsWWWInConfig (void)
static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]) static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
{ {
/***** Update database changing old WWW by new WWW *****/ /***** 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",
NewWWW,InsCod); "UPDATE institutions SET WWW='%s' WHERE InsCod=%ld",
DB_QueryUPDATE_new ("can not update the web of an institution"); NewWWW,InsCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2087,9 +2087,9 @@ void Ins_ChangeInsStatus (void)
Ins_GetDataOfInstitutionByCod (&Gbl.Inss.EditingIns,Ins_GET_BASIC_DATA); Ins_GetDataOfInstitutionByCod (&Gbl.Inss.EditingIns,Ins_GET_BASIC_DATA);
/***** Update status in table of institutions *****/ /***** 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",
(unsigned) Status,Gbl.Inss.EditingIns.InsCod); "UPDATE institutions SET Status=%u WHERE InsCod=%ld",
DB_QueryUPDATE_new ("can not update the status of an institution"); (unsigned) Status,Gbl.Inss.EditingIns.InsCod);
Gbl.Inss.EditingIns.Status = Status; Gbl.Inss.EditingIns.Status = Status;
/***** Write message to show the change made /***** Write message to show the change made

View File

@ -184,10 +184,10 @@ void Lan_UpdateMyLanguageToCurrentLanguage (void)
Gbl.Usrs.Me.UsrDat.Prefs.Language = Gbl.Prefs.Language; Gbl.Usrs.Me.UsrDat.Prefs.Language = Gbl.Prefs.Language;
/***** Update my language in database *****/ /***** Update my language in database *****/
DB_BuildQuery ("UPDATE usr_data SET Language='%s' WHERE UsrCod=%ld", DB_QueryUPDATE ("can not update your language",
Txt_STR_LANG_ID[Gbl.Prefs.Language], "UPDATE usr_data SET Language='%s' WHERE UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.UsrCod); Txt_STR_LANG_ID[Gbl.Prefs.Language],
DB_QueryUPDATE_new ("can not update your language"); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -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) static void Lnk_UpdateLnkNameDB (long LnkCod,const char *FieldName,const char *NewLnkName)
{ {
/***** Update institutional link changing old name by new name */ /***** 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",
FieldName,NewLnkName,LnkCod); "UPDATE links SET %s='%s' WHERE LnkCod=%ld",
DB_QueryUPDATE_new ("can not update the name of an institutional link"); FieldName,NewLnkName,LnkCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -672,9 +672,9 @@ void Lnk_ChangeLinkWWW (void)
if (NewWWW[0]) if (NewWWW[0])
{ {
/* Update the table changing old WWW by new WWW */ /* 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",
NewWWW,Lnk->LnkCod); "UPDATE links SET WWW='%s' WHERE LnkCod=%ld",
DB_QueryUPDATE_new ("can not update the web of an institutional link"); NewWWW,Lnk->LnkCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -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) static void Mai_UpdateMailDomainNameDB (long MaiCod,const char *FieldName,const char *NewMaiName)
{ {
/***** Update mail domain changing old name by new name */ /***** 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",
FieldName,NewMaiName,MaiCod); "UPDATE mail_domains SET %s='%s' WHERE MaiCod=%ld",
DB_QueryUPDATE_new ("can not update the name of a mail domain"); FieldName,NewMaiName,MaiCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1857,11 +1857,11 @@ void Mai_ConfirmEmail (void)
Email); Email);
else else
{ {
DB_BuildQuery ("UPDATE usr_emails SET Confirmed='Y'" DB_QueryUPDATE ("can not confirm email",
" WHERE usr_emails.UsrCod=%ld" "UPDATE usr_emails SET Confirmed='Y'"
" AND usr_emails.E_mail='%s'", " WHERE usr_emails.UsrCod=%ld"
UsrCod,Email); " AND usr_emails.E_mail='%s'",
DB_QueryUPDATE_new ("can not confirm email"); UsrCod,Email);
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_The_email_X_has_been_confirmed, Txt_The_email_X_has_been_confirmed,

View File

@ -271,15 +271,15 @@ static void Mrk_ChangeNumRowsHeaderOrFooter (Brw_HeadOrFoot_t HeaderOrFooter)
{ {
/***** Update properties of marks in the database *****/ /***** Update properties of marks in the database *****/
Cod = Brw_GetCodForFiles (); Cod = Brw_GetCodForFiles ();
DB_BuildQuery ("UPDATE marks_properties,files" DB_QueryUPDATE ("can not update properties of marks",
" SET marks_properties.%s=%u" "UPDATE marks_properties,files"
" WHERE files.FileBrowser=%u AND files.Cod=%ld AND files.Path='%s'" " SET marks_properties.%s=%u"
" AND files.FilCod=marks_properties.FilCod", " WHERE files.FileBrowser=%u AND files.Cod=%ld AND files.Path='%s'"
Mrk_HeadOrFootStr[HeaderOrFooter],NumRows, " AND files.FilCod=marks_properties.FilCod",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type], Mrk_HeadOrFootStr[HeaderOrFooter],NumRows,
Cod, (unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Gbl.FileBrowser.Priv.FullPathInTree); Cod,
DB_QueryUPDATE_new ("can not update properties of marks"); Gbl.FileBrowser.Priv.FullPathInTree);
/***** Write message of success *****/ /***** Write message of success *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -460,11 +460,9 @@ void Mnu_ChangeMenu (void)
/***** Store menu in database *****/ /***** Store menu in database *****/
if (Gbl.Usrs.Me.Logged) if (Gbl.Usrs.Me.Logged)
{ DB_QueryUPDATE ("can not update your preference about menu",
DB_BuildQuery ("UPDATE usr_data SET Menu=%u WHERE UsrCod=%ld", "UPDATE usr_data SET Menu=%u WHERE UsrCod=%ld",
(unsigned) Gbl.Prefs.Menu,Gbl.Usrs.Me.UsrDat.UsrCod); (unsigned) Gbl.Prefs.Menu,Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE_new ("can not update your preference about menu");
}
/***** Set preferences from current IP *****/ /***** Set preferences from current IP *****/
Pre_SetPrefsFromIP (); Pre_SetPrefsFromIP ();

View File

@ -1226,16 +1226,16 @@ void Msg_ConRecMsg (void)
static void Msg_ExpandSentMsg (long MsgCod) static void Msg_ExpandSentMsg (long MsgCod)
{ {
/***** Expand message in sent message table *****/ /***** Expand message in sent message table *****/
DB_BuildQuery ("UPDATE msg_snt SET Expanded='Y'" DB_QueryUPDATE ("can not expand a sent message",
" WHERE MsgCod=%ld AND UsrCod=%ld", "UPDATE msg_snt SET Expanded='Y'"
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod); " WHERE MsgCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not expand a sent message"); MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Contract all my other messages in sent message table *****/ /***** 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",
" WHERE UsrCod=%ld AND MsgCod<>%ld", "UPDATE msg_snt SET Expanded='N'"
Gbl.Usrs.Me.UsrDat.UsrCod,MsgCod); " WHERE UsrCod=%ld AND MsgCod<>%ld",
DB_QueryUPDATE_new ("can not contract a sent message"); Gbl.Usrs.Me.UsrDat.UsrCod,MsgCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1245,16 +1245,16 @@ static void Msg_ExpandSentMsg (long MsgCod)
static void Msg_ExpandReceivedMsg (long MsgCod) static void Msg_ExpandReceivedMsg (long MsgCod)
{ {
/***** Expand message in received message table and mark it as read by me *****/ /***** 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",
" WHERE MsgCod=%ld AND UsrCod=%ld", "UPDATE msg_rcv SET Open='Y',Expanded='Y'"
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod); " WHERE MsgCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not expand a received message"); MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Contract all my other messages in received message table *****/ /***** 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",
" WHERE UsrCod=%ld AND MsgCod<>%ld", "UPDATE msg_rcv SET Expanded='N'"
Gbl.Usrs.Me.UsrDat.UsrCod,MsgCod); " WHERE UsrCod=%ld AND MsgCod<>%ld",
DB_QueryUPDATE_new ("can not contract a received message"); Gbl.Usrs.Me.UsrDat.UsrCod,MsgCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1264,10 +1264,10 @@ static void Msg_ExpandReceivedMsg (long MsgCod)
static void Msg_ContractSentMsg (long MsgCod) static void Msg_ContractSentMsg (long MsgCod)
{ {
/***** Contract message in sent message table *****/ /***** Contract message in sent message table *****/
DB_BuildQuery ("UPDATE msg_snt SET Expanded='N'" DB_QueryUPDATE ("can not contract a sent message",
" WHERE MsgCod=%ld AND UsrCod=%ld", "UPDATE msg_snt SET Expanded='N'"
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod); " WHERE MsgCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not contract a sent message"); MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1277,10 +1277,10 @@ static void Msg_ContractSentMsg (long MsgCod)
static void Msg_ContractReceivedMsg (long MsgCod) static void Msg_ContractReceivedMsg (long MsgCod)
{ {
/***** Contract message in received message table *****/ /***** Contract message in received message table *****/
DB_BuildQuery ("UPDATE msg_rcv SET Expanded='N'" DB_QueryUPDATE ("can not contract a received message",
" WHERE MsgCod=%ld AND UsrCod=%ld", "UPDATE msg_rcv SET Expanded='N'"
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod); " WHERE MsgCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not contract a received message"); MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1290,10 +1290,10 @@ static void Msg_ContractReceivedMsg (long MsgCod)
void Msg_SetReceivedMsgAsOpen (long MsgCod,long UsrCod) void Msg_SetReceivedMsgAsOpen (long MsgCod,long UsrCod)
{ {
/***** Mark message as read by user *****/ /***** Mark message as read by user *****/
DB_BuildQuery ("UPDATE msg_rcv SET Open='Y'" DB_QueryUPDATE ("can not mark a received message as open",
" WHERE MsgCod=%ld AND UsrCod=%ld", "UPDATE msg_rcv SET Open='Y'"
MsgCod,UsrCod); " WHERE MsgCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not mark a received message as open"); MsgCod,UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1445,10 +1445,10 @@ static void Msg_InsertReceivedMsgIntoDB (long MsgCod,long UsrCod,bool NotifyByEm
static void Msg_SetReceivedMsgAsReplied (long MsgCod) static void Msg_SetReceivedMsgAsReplied (long MsgCod)
{ {
/***** Update received message by setting Replied field to true *****/ /***** 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",
" WHERE MsgCod=%ld AND UsrCod=%ld", "UPDATE msg_rcv SET Replied='Y'"
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod); " WHERE MsgCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not update a received message"); MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1524,8 +1524,9 @@ static void Msg_MoveMsgContentToDeleted (long MsgCod)
should be deleted to ensure the protection of personal data */ should be deleted to ensure the protection of personal data */
/* Delete message from msg_content *****/ /* Delete message from msg_content *****/
DB_BuildQuery ("DELETE FROM msg_content WHERE MsgCod=%ld",MsgCod); DB_QueryUPDATE ("can not remove the content of a message",
DB_QueryUPDATE_new ("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 */ should be deleted to ensure the protection of personal data */
/* Delete message from msg_content *****/ /* Delete message from msg_content *****/
DB_BuildQuery ("DELETE FROM msg_content" DB_QueryUPDATE ("can not remove the content of some messages",
" WHERE MsgCod NOT IN (SELECT MsgCod FROM msg_snt)" "DELETE FROM msg_content"
" AND MsgCod NOT IN (SELECT DISTINCT MsgCod FROM msg_rcv)"); " WHERE MsgCod NOT IN (SELECT MsgCod FROM msg_snt)"
DB_QueryUPDATE_new ("can not remove the content of some messages"); " AND MsgCod NOT IN (SELECT DISTINCT MsgCod FROM msg_rcv)");
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -183,9 +183,9 @@ static long Not_InsertNoticeInDB (const char *Content)
static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned NumUsrsToBeNotifiedByEMail) static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned NumUsrsToBeNotifiedByEMail)
{ {
/***** Update number of users notified *****/ /***** 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",
NumUsrsToBeNotifiedByEMail,NotCod); "UPDATE notices SET NumNotif=%u WHERE NotCod=%ld",
DB_QueryUPDATE_new ("can not update the number of notifications of a notice"); NumUsrsToBeNotifiedByEMail,NotCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -229,11 +229,11 @@ void Not_HideActiveNotice (void)
NotCod = Not_GetParamNotCod (); NotCod = Not_GetParamNotCod ();
/***** Set notice as hidden *****/ /***** Set notice as hidden *****/
DB_BuildQuery ("UPDATE notices SET Status=%u" DB_QueryUPDATE ("can not hide notice",
" WHERE NotCod=%ld AND CrsCod=%ld", "UPDATE notices SET Status=%u"
(unsigned) Not_OBSOLETE_NOTICE, " WHERE NotCod=%ld AND CrsCod=%ld",
NotCod,Gbl.CurrentCrs.Crs.CrsCod); (unsigned) Not_OBSOLETE_NOTICE,
DB_QueryUPDATE_new ("can not hide notice"); NotCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Update RSS of current course *****/ /***** Update RSS of current course *****/
RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs); RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);
@ -251,11 +251,11 @@ void Not_RevealHiddenNotice (void)
NotCod = Not_GetParamNotCod (); NotCod = Not_GetParamNotCod ();
/***** Set notice as active *****/ /***** Set notice as active *****/
DB_BuildQuery ("UPDATE notices SET Status=%u" DB_QueryUPDATE ("can not reveal notice",
" WHERE NotCod=%ld AND CrsCod=%ld", "UPDATE notices SET Status=%u"
(unsigned) Not_ACTIVE_NOTICE, " WHERE NotCod=%ld AND CrsCod=%ld",
NotCod,Gbl.CurrentCrs.Crs.CrsCod); (unsigned) Not_ACTIVE_NOTICE,
DB_QueryUPDATE_new ("can not reveal notice"); NotCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Update RSS of current course *****/ /***** Update RSS of current course *****/
RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs); RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);

View File

@ -947,22 +947,27 @@ void Ntf_MarkNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long CrsCod,lon
/***** Set notification as seen by me *****/ /***** Set notification as seen by me *****/
if (ToUsrCod > 0) // If the user code is specified if (ToUsrCod > 0) // If the user code is specified
{ {
if (Cod > 0) // Set only one notification for the user as seen if (Cod > 0) // Set only one notification
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)" // for the user as seen
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND Cod=%ld", DB_QueryUPDATE ("can not set notification(s) as seen",
(unsigned) Ntf_STATUS_BIT_READ, "UPDATE notif SET Status=(Status | %u)"
ToUsrCod,(unsigned) NotifyEvent,Cod); " WHERE ToUsrCod=%ld AND NotifyEvent=%u AND Cod=%ld",
else if (CrsCod > 0) // Set all notifications of this type in the current course for the user as seen (unsigned) Ntf_STATUS_BIT_READ,
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)" ToUsrCod,(unsigned) NotifyEvent,Cod);
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND CrsCod=%ld", else if (CrsCod > 0) // Set all notifications of this type
(unsigned) Ntf_STATUS_BIT_READ, // in the current course for the user as seen
ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod); DB_QueryUPDATE ("can not set notification(s) as seen",
else // Set all notifications of this type for the user as seen "UPDATE notif SET Status=(Status | %u)"
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)" " WHERE ToUsrCod=%ld AND NotifyEvent=%u AND CrsCod=%ld",
" WHERE ToUsrCod=%ld AND NotifyEvent=%u", (unsigned) Ntf_STATUS_BIT_READ,
(unsigned) Ntf_STATUS_BIT_READ, ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod);
ToUsrCod,(unsigned) NotifyEvent); else // Set all notifications of this type
DB_QueryUPDATE_new ("can not set notification(s) as seen"); // 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);
} }
} }
@ -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) void Ntf_MarkNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod)
{ {
/***** Set notification as removed *****/ /***** Set notification as removed *****/
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)" DB_QueryUPDATE ("can not set notification(s) as removed",
" WHERE NotifyEvent=%u AND Cod=%ld", "UPDATE notif SET Status=(Status | %u)"
(unsigned) Ntf_STATUS_BIT_REMOVED, " WHERE NotifyEvent=%u AND Cod=%ld",
(unsigned) NotifyEvent,Cod); (unsigned) Ntf_STATUS_BIT_REMOVED,
DB_QueryUPDATE_new ("can not set notification(s) as removed"); (unsigned) NotifyEvent,Cod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -988,16 +993,20 @@ void Ntf_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long
{ {
/***** Set notification as removed *****/ /***** Set notification as removed *****/
if (Cod > 0) // Set only one 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",
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND Cod=%ld", "UPDATE notif SET Status=(Status | %u)"
(unsigned) Ntf_STATUS_BIT_REMOVED, " WHERE ToUsrCod=%ld AND NotifyEvent=%u AND Cod=%ld",
ToUsrCod,(unsigned) NotifyEvent,Cod); (unsigned) Ntf_STATUS_BIT_REMOVED,
else // Set all notifications of this type, in the current course for the user, as removed ToUsrCod,(unsigned) NotifyEvent,
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)" Cod);
" WHERE ToUsrCod=%ld AND NotifyEvent=%u AND CrsCod=%ld", else // Set all notifications of this type,
(unsigned) Ntf_STATUS_BIT_REMOVED, // in the current course for the user, as removed
ToUsrCod,(unsigned) NotifyEvent,Gbl.CurrentCrs.Crs.CrsCod); DB_QueryUPDATE ("can not set notification(s) as removed",
DB_QueryUPDATE_new ("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);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1013,20 +1022,21 @@ void Ntf_MarkNotifInCrsAsRemoved (long ToUsrCod,long CrsCod)
/***** Set all notifications from the course as removed, /***** Set all notifications from the course as removed,
except notifications about new messages *****/ except notifications about new messages *****/
if (ToUsrCod > 0) // If the user code is specified 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",
" WHERE ToUsrCod=%ld" "UPDATE notif SET Status=(Status | %u)"
" AND CrsCod=%ld" " WHERE ToUsrCod=%ld"
" AND NotifyEvent<>%u", // messages will remain available " AND CrsCod=%ld"
(unsigned) Ntf_STATUS_BIT_REMOVED, " AND NotifyEvent<>%u", // messages will remain available
ToUsrCod, (unsigned) Ntf_STATUS_BIT_REMOVED,
CrsCod,(unsigned) Ntf_EVENT_MESSAGE); ToUsrCod,
CrsCod,(unsigned) Ntf_EVENT_MESSAGE);
else // User code not specified ==> any user else // User code not specified ==> any user
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)" DB_QueryUPDATE ("can not set notification(s) as removed",
" WHERE CrsCod=%ld" "UPDATE notif SET Status=(Status | %u)"
" AND NotifyEvent<>%u", // messages will remain available " WHERE CrsCod=%ld"
(unsigned) Ntf_STATUS_BIT_REMOVED, " AND NotifyEvent<>%u", // messages will remain available
CrsCod,(unsigned) Ntf_EVENT_MESSAGE); (unsigned) Ntf_STATUS_BIT_REMOVED,
DB_QueryUPDATE_new ("can not set notification(s) as removed"); CrsCod,(unsigned) Ntf_EVENT_MESSAGE);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1127,16 +1137,16 @@ void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path)
default: default:
return; return;
} }
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)" DB_QueryUPDATE ("can not set notification(s) as removed",
" WHERE NotifyEvent=%u AND Cod IN" "UPDATE notif SET Status=(Status | %u)"
" (SELECT FilCod FROM files" " WHERE NotifyEvent=%u AND Cod IN"
" WHERE FileBrowser=%u AND Cod=%ld" " (SELECT FilCod FROM files"
" AND Path LIKE '%s/%%')", " WHERE FileBrowser=%u AND Cod=%ld"
(unsigned) Ntf_STATUS_BIT_REMOVED, " AND Path LIKE '%s/%%')",
(unsigned) NotifyEvent, (unsigned) Ntf_STATUS_BIT_REMOVED,
(unsigned) FileBrowser,Cod, (unsigned) NotifyEvent,
Path); (unsigned) FileBrowser,Cod,
DB_QueryUPDATE_new ("can not set notification(s) as removed"); Path);
break; break;
default: default:
break; break;
@ -1150,21 +1160,21 @@ void Ntf_MarkNotifChildrenOfFolderAsRemoved (const char *Path)
void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod) void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod)
{ {
/***** Set notifications as removed *****/ /***** Set notifications as removed *****/
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)" DB_QueryUPDATE ("can not set notification(s) as removed",
" WHERE NotifyEvent IN (%u,%u,%u,%u) AND Cod IN" "UPDATE notif SET Status=(Status | %u)"
" (SELECT FilCod FROM files" " WHERE NotifyEvent IN (%u,%u,%u,%u) AND Cod IN"
" WHERE FileBrowser IN (%u,%u,%u,%u) AND Cod=%ld)", " (SELECT FilCod FROM files"
(unsigned) Ntf_STATUS_BIT_REMOVED, " WHERE FileBrowser IN (%u,%u,%u,%u) AND Cod=%ld)",
(unsigned) Ntf_EVENT_DOCUMENT_FILE, (unsigned) Ntf_STATUS_BIT_REMOVED,
(unsigned) Ntf_EVENT_TEACHERS_FILE, (unsigned) Ntf_EVENT_DOCUMENT_FILE,
(unsigned) Ntf_EVENT_SHARED_FILE, (unsigned) Ntf_EVENT_TEACHERS_FILE,
(unsigned) Ntf_EVENT_MARKS_FILE, (unsigned) Ntf_EVENT_SHARED_FILE,
(unsigned) Brw_ADMI_DOC_GRP, (unsigned) Ntf_EVENT_MARKS_FILE,
(unsigned) Brw_ADMI_TCH_GRP, (unsigned) Brw_ADMI_DOC_GRP,
(unsigned) Brw_ADMI_SHR_GRP, (unsigned) Brw_ADMI_TCH_GRP,
(unsigned) Brw_ADMI_MRK_GRP, (unsigned) Brw_ADMI_SHR_GRP,
GrpCod); (unsigned) Brw_ADMI_MRK_GRP,
DB_QueryUPDATE_new ("can not set notification(s) as removed"); GrpCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1513,10 +1523,10 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
static void Ntf_UpdateMyLastAccessToNotifications (void) static void Ntf_UpdateMyLastAccessToNotifications (void)
{ {
/***** Reset to 0 my number of new received messages *****/ /***** 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",
" WHERE UsrCod=%ld", "UPDATE usr_last SET LastAccNotif=NOW()"
Gbl.Usrs.Me.UsrDat.UsrCod); " WHERE UsrCod=%ld",
DB_QueryUPDATE_new ("can not update last access to notifications"); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1809,14 +1819,14 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
} }
/***** Mark all the pending notifications of this user as 'sent' *****/ /***** 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",
" WHERE ToUsrCod=%ld" "UPDATE notif SET Status=(Status | %u)"
" AND (Status & %u)<>0 AND (Status & %u)=0 AND (Status & %u)=0", " WHERE ToUsrCod=%ld"
(unsigned) Ntf_STATUS_BIT_SENT,ToUsrDat->UsrCod, " AND (Status & %u)<>0 AND (Status & %u)=0 AND (Status & %u)=0",
(unsigned) Ntf_STATUS_BIT_EMAIL, (unsigned) Ntf_STATUS_BIT_SENT,ToUsrDat->UsrCod,
(unsigned) Ntf_STATUS_BIT_SENT, (unsigned) Ntf_STATUS_BIT_EMAIL,
(unsigned) (Ntf_STATUS_BIT_READ | Ntf_STATUS_BIT_REMOVED)); (unsigned) Ntf_STATUS_BIT_SENT,
DB_QueryUPDATE_new ("can not set pending notifications of a user as sent"); (unsigned) (Ntf_STATUS_BIT_READ | Ntf_STATUS_BIT_REMOVED));
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
@ -1907,11 +1917,11 @@ static void Ntf_UpdateNumNotifSent (long DegCod,long CrsCod,
void Ntf_MarkAllNotifAsSeen (void) void Ntf_MarkAllNotifAsSeen (void)
{ {
/***** Set all my notifications as seen *****/ /***** Set all my notifications as seen *****/
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)" DB_QueryUPDATE ("can not set notification(s) as seen",
" WHERE ToUsrCod=%ld", "UPDATE notif SET Status=(Status | %u)"
(unsigned) Ntf_STATUS_BIT_READ, " WHERE ToUsrCod=%ld",
Gbl.Usrs.Me.UsrDat.UsrCod); (unsigned) Ntf_STATUS_BIT_READ,
DB_QueryUPDATE_new ("can not set notification(s) as seen"); Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show my notifications again *****/ /***** Show my notifications again *****/
Ntf_ShowMyNotifications (); Ntf_ShowMyNotifications ();
@ -2037,13 +2047,13 @@ void Ntf_ChangeNotifyEvents (void)
Ntf_GetParamsNotifyEvents (); Ntf_GetParamsNotifyEvents ();
/***** Store preferences about notify events *****/ /***** Store preferences about notify events *****/
DB_BuildQuery ("UPDATE usr_data" DB_QueryUPDATE ("can not update user's preferences",
" SET NotifNtfEvents=%u,EmailNtfEvents=%u" "UPDATE usr_data"
" WHERE UsrCod=%ld", " SET NotifNtfEvents=%u,EmailNtfEvents=%u"
Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents, " WHERE UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents, Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents,
DB_QueryUPDATE_new ("can not update user's preferences"); Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show message *****/ /***** Show message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_Your_preferences_about_notifications_have_changed); Ale_ShowAlert (Ale_SUCCESS,Txt_Your_preferences_about_notifications_have_changed);

View File

@ -801,11 +801,11 @@ unsigned Pag_GetParamPagNum (Pag_WhatPaginate_t WhatPaginate)
void Pag_SaveLastPageMsgIntoSession (Pag_WhatPaginate_t WhatPaginate,unsigned NumPage) void Pag_SaveLastPageMsgIntoSession (Pag_WhatPaginate_t WhatPaginate,unsigned NumPage)
{ {
/***** Save last page of received/sent messages *****/ /***** 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",
WhatPaginate == Pag_MESSAGES_RECEIVED ? "LastPageMsgRcv" : "UPDATE sessions SET %s=%u WHERE SessionId='%s'",
"LastPageMsgSnt", WhatPaginate == Pag_MESSAGES_RECEIVED ? "LastPageMsgRcv" :
NumPage,Gbl.Session.Id); "LastPageMsgSnt",
DB_QueryUPDATE_new ("can not update last page of messages"); NumPage,Gbl.Session.Id);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -146,11 +146,11 @@ bool Pwd_CheckPendingPassword (void)
void Pwd_AssignMyPendingPasswordToMyCurrentPassword (void) void Pwd_AssignMyPendingPasswordToMyCurrentPassword (void)
{ {
/***** Update my current password in database *****/ /***** Update my current password in database *****/
DB_BuildQuery ("UPDATE usr_data SET Password='%s'" DB_QueryUPDATE ("can not update your password",
" WHERE UsrCod=%ld", "UPDATE usr_data SET Password='%s'"
Gbl.Usrs.Me.PendingPassword, " WHERE UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.PendingPassword,
DB_QueryUPDATE_new ("can not update your password"); Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Update my current password *****/ /***** Update my current password *****/
Str_Copy (Gbl.Usrs.Me.UsrDat.Password,Gbl.Usrs.Me.PendingPassword, Str_Copy (Gbl.Usrs.Me.UsrDat.Password,Gbl.Usrs.Me.PendingPassword,

View File

@ -999,10 +999,10 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
/* Update number of clicks */ /* Update number of clicks */
if (NumClicks <= Pho_MAX_CLICKS_WITHOUT_PHOTO) if (NumClicks <= Pho_MAX_CLICKS_WITHOUT_PHOTO)
{ {
DB_BuildQuery ("UPDATE clicks_without_photo" DB_QueryUPDATE ("can not update number of clicks without photo",
" SET NumClicks=NumClicks+1 WHERE UsrCod=%ld", "UPDATE clicks_without_photo"
Gbl.Usrs.Me.UsrDat.UsrCod); " SET NumClicks=NumClicks+1 WHERE UsrCod=%ld",
DB_QueryUPDATE_new ("can not update number of clicks without photo"); Gbl.Usrs.Me.UsrDat.UsrCod);
NumClicks++; NumClicks++;
} }
} }
@ -1187,8 +1187,9 @@ bool Pho_RemovePhoto (struct UsrData *UsrDat)
static void Pho_ClearPhotoName (long UsrCod) static void Pho_ClearPhotoName (long UsrCod)
{ {
/***** Clear photo name in user's data *****/ /***** Clear photo name in user's data *****/
DB_BuildQuery ("UPDATE usr_data SET Photo='' WHERE UsrCod=%ld",UsrCod); DB_QueryUPDATE ("can not clear the name of a user's photo",
DB_QueryUPDATE_new ("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]; char PathPublPhoto[PATH_MAX + 1];
/***** Update photo name in database *****/ /***** 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",
Gbl.UniqueNameEncrypted,UsrDat->UsrCod); "UPDATE usr_data SET Photo='%s' WHERE UsrCod=%ld",
DB_QueryUPDATE_new ("can not update the name of a user's photo"); Gbl.UniqueNameEncrypted,UsrDat->UsrCod);
/***** Remove the old symbolic link to photo *****/ /***** Remove the old symbolic link to photo *****/
snprintf (PathPublPhoto,sizeof (PathPublPhoto), snprintf (PathPublPhoto,sizeof (PathPublPhoto),
@ -1329,10 +1330,10 @@ void Pho_ChangePhotoVisibility (void)
Gbl.Usrs.Me.UsrDat.PhotoVisibility = Pri_GetParamVisibility ("VisPho"); Gbl.Usrs.Me.UsrDat.PhotoVisibility = Pri_GetParamVisibility ("VisPho");
/***** Store public/private photo in database *****/ /***** 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",
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.PhotoVisibility], "UPDATE usr_data SET PhotoVisibility='%s' WHERE UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.UsrCod); Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.PhotoVisibility],
DB_QueryUPDATE_new ("can not update your preference about photo visibility"); Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show form again *****/ /***** Show form again *****/
Pre_EditPrefs (); Pre_EditPrefs ();

View File

@ -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) static void Plc_UpdatePlcNameDB (long PlcCod,const char *FieldName,const char *NewPlcName)
{ {
/***** Update place changing old name by new name */ /***** 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",
FieldName,NewPlcName,PlcCod); "UPDATE places SET %s='%s' WHERE PlcCod=%ld",
DB_QueryUPDATE_new ("can not update the name of a place"); FieldName,NewPlcName,PlcCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -560,9 +560,9 @@ void Plg_RenamePlugin (void)
else else
{ {
/* Update the table changing old name by new name */ /* 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",
NewPlgName,Plg->PlgCod); "UPDATE plugins SET Name='%s' WHERE PlgCod=%ld",
DB_QueryUPDATE_new ("can not update the name of a plugin"); NewPlgName,Plg->PlgCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -624,9 +624,9 @@ void Plg_ChangePlgDescription (void)
if (NewDescription[0]) if (NewDescription[0])
{ {
/* Update the table changing old description by new description */ /* 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",
NewDescription,Plg->PlgCod); "UPDATE plugins SET Description='%s' WHERE PlgCod=%ld",
DB_QueryUPDATE_new ("can not update the description of a plugin"); NewDescription,Plg->PlgCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -668,9 +668,9 @@ void Plg_ChangePlgLogo (void)
if (NewLogo[0]) if (NewLogo[0])
{ {
/* Update the table changing old logo by new logo */ /* 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",
NewLogo,Plg->PlgCod); "UPDATE plugins SET Logo='%s' WHERE PlgCod=%ld",
DB_QueryUPDATE_new ("can not update the logo of a plugin"); NewLogo,Plg->PlgCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -712,9 +712,9 @@ void Plg_ChangePlgAppKey (void)
if (NewAppKey[0]) if (NewAppKey[0])
{ {
/* Update the table changing old application key by new application key */ /* 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",
NewAppKey,Plg->PlgCod); "UPDATE plugins SET AppKey='%s' WHERE PlgCod=%ld",
DB_QueryUPDATE_new ("can not update the application key of a plugin"); NewAppKey,Plg->PlgCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -756,9 +756,9 @@ void Plg_ChangePlgURL (void)
if (NewURL[0]) if (NewURL[0])
{ {
/* Update the table changing old WWW by new WWW */ /* 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",
NewURL,Plg->PlgCod); "UPDATE plugins SET URL='%s' WHERE PlgCod=%ld",
DB_QueryUPDATE_new ("can not update the URL of a plugin"); NewURL,Plg->PlgCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -800,9 +800,9 @@ void Plg_ChangePlgIP (void)
if (NewIP[0]) if (NewIP[0])
{ {
/* Update the table changing old IP by new IP */ /* 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",
NewIP,Plg->PlgCod); "UPDATE plugins SET IP='%s' WHERE PlgCod=%ld",
DB_QueryUPDATE_new ("can not update the IP address of a plugin"); NewIP,Plg->PlgCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -195,20 +195,18 @@ void Pre_SetPrefsFromIP (void)
/***** If a user is logged, update its preferences in database for all its IP's *****/ /***** If a user is logged, update its preferences in database for all its IP's *****/
if (Gbl.Usrs.Me.Logged) if (Gbl.Usrs.Me.Logged)
{ DB_QueryUPDATE ("can not update your preferences",
DB_BuildQuery ("UPDATE IP_prefs" "UPDATE IP_prefs"
" SET FirstDayOfWeek=%u,DateFormat=%u," " SET FirstDayOfWeek=%u,DateFormat=%u,"
"Theme='%s',IconSet='%s',Menu=%u,SideCols=%u" "Theme='%s',IconSet='%s',Menu=%u,SideCols=%u"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
Gbl.Prefs.FirstDayOfWeek, Gbl.Prefs.FirstDayOfWeek,
(unsigned) Gbl.Prefs.DateFormat, (unsigned) Gbl.Prefs.DateFormat,
The_ThemeId[Gbl.Prefs.Theme], The_ThemeId[Gbl.Prefs.Theme],
Ico_IconSetId[Gbl.Prefs.IconSet], Ico_IconSetId[Gbl.Prefs.IconSet],
(unsigned) Gbl.Prefs.Menu, (unsigned) Gbl.Prefs.Menu,
Gbl.Prefs.SideCols, Gbl.Prefs.SideCols,
Gbl.Usrs.Me.UsrDat.UsrCod); 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) static void Pre_UpdateSideColsOnUsrDataTable (void)
{ {
DB_BuildQuery ("UPDATE usr_data SET SideCols=%u" DB_QueryUPDATE ("can not update your preference about side columns",
" WHERE UsrCod=%ld", "UPDATE usr_data SET SideCols=%u"
Gbl.Prefs.SideCols,Gbl.Usrs.Me.UsrDat.UsrCod); " WHERE UsrCod=%ld",
DB_QueryUPDATE_new ("can not update your preference about side columns"); Gbl.Prefs.SideCols,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -337,11 +337,12 @@ void Prf_ChangeProfileVisibility (void)
Gbl.Usrs.Me.UsrDat.ProfileVisibility = Pri_GetParamVisibility ("VisPrf"); Gbl.Usrs.Me.UsrDat.ProfileVisibility = Pri_GetParamVisibility ("VisPrf");
/***** Store public/private photo in database *****/ /***** Store public/private photo in database *****/
DB_BuildQuery ("UPDATE usr_data SET ProfileVisibility='%s'" DB_QueryUPDATE ("can not update your preference"
" WHERE UsrCod=%ld", " about public profile visibility",
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.ProfileVisibility], "UPDATE usr_data SET ProfileVisibility='%s'"
Gbl.Usrs.Me.UsrDat.UsrCod); " WHERE UsrCod=%ld",
DB_QueryUPDATE_new ("can not update your preference about public profile visibility"); Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.ProfileVisibility],
Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show form again *****/ /***** Show form again *****/
Pre_EditPrefs (); Pre_EditPrefs ();
@ -858,13 +859,11 @@ static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
/***** Update first click time in user's figures *****/ /***** Update first click time in user's figures *****/
if (Prf_CheckIfUsrFiguresExists (UsrCod)) if (Prf_CheckIfUsrFiguresExists (UsrCod))
{ DB_QueryUPDATE ("can not update user's figures",
DB_BuildQuery ("UPDATE usr_figures" "UPDATE usr_figures"
" SET FirstClickTime=FROM_UNIXTIME(%ld)" " SET FirstClickTime=FROM_UNIXTIME(%ld)"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
(long) UsrFigures.FirstClickTimeUTC,UsrCod); (long) UsrFigures.FirstClickTimeUTC,UsrCod);
DB_QueryUPDATE_new ("can not update user's figures");
}
else // User entry does not exist else // User entry does not exist
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false); Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
} }
@ -889,12 +888,10 @@ static void Prf_GetNumClicksAndStoreAsUsrFigure (long UsrCod)
/***** Update number of clicks in user's figures *****/ /***** Update number of clicks in user's figures *****/
if (Prf_CheckIfUsrFiguresExists (UsrCod)) if (Prf_CheckIfUsrFiguresExists (UsrCod))
{ DB_QueryUPDATE ("can not update user's figures",
DB_BuildQuery ("UPDATE usr_figures SET NumClicks=%ld" "UPDATE usr_figures SET NumClicks=%ld"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
UsrFigures.NumClicks,UsrCod); UsrFigures.NumClicks,UsrCod);
DB_QueryUPDATE_new ("can not update user's figures");
}
else // User entry does not exist else // User entry does not exist
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false); Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
} }
@ -918,12 +915,10 @@ static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
/***** Update number of file views in user's figures *****/ /***** Update number of file views in user's figures *****/
if (Prf_CheckIfUsrFiguresExists (UsrCod)) if (Prf_CheckIfUsrFiguresExists (UsrCod))
{ DB_QueryUPDATE ("can not update user's figures",
DB_BuildQuery ("UPDATE usr_figures SET NumFileViews=%ld" "UPDATE usr_figures SET NumFileViews=%ld"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
UsrFigures.NumFileViews,UsrCod); UsrFigures.NumFileViews,UsrCod);
DB_QueryUPDATE_new ("can not update user's figures");
}
else // User entry does not exist else // User entry does not exist
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false); Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
} }
@ -947,12 +942,10 @@ static void Prf_GetNumForPstAndStoreAsUsrFigure (long UsrCod)
/***** Update number of forum posts in user's figures *****/ /***** Update number of forum posts in user's figures *****/
if (Prf_CheckIfUsrFiguresExists (UsrCod)) if (Prf_CheckIfUsrFiguresExists (UsrCod))
{ DB_QueryUPDATE ("can not update user's figures",
DB_BuildQuery ("UPDATE usr_figures SET NumForPst=%ld" "UPDATE usr_figures SET NumForPst=%ld"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
UsrFigures.NumForPst,UsrCod); UsrFigures.NumForPst,UsrCod);
DB_QueryUPDATE_new ("can not update user's figures");
}
else // User entry does not exist else // User entry does not exist
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false); Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
} }
@ -976,12 +969,10 @@ static void Prf_GetNumMsgSntAndStoreAsUsrFigure (long UsrCod)
/***** Update number of messages sent in user's figures *****/ /***** Update number of messages sent in user's figures *****/
if (Prf_CheckIfUsrFiguresExists (UsrCod)) if (Prf_CheckIfUsrFiguresExists (UsrCod))
{ DB_QueryUPDATE ("can not update user's figures",
DB_BuildQuery ("UPDATE usr_figures SET NumMsgSnt=%ld" "UPDATE usr_figures SET NumMsgSnt=%ld"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
UsrFigures.NumMsgSnt,UsrCod); UsrFigures.NumMsgSnt,UsrCod);
DB_QueryUPDATE_new ("can not update user's figures");
}
else // User entry does not exist else // User entry does not exist
Prf_CreateUsrFigures (UsrCod,&UsrFigures,false); Prf_CreateUsrFigures (UsrCod,&UsrFigures,false);
} }

View File

@ -2805,10 +2805,10 @@ void Prj_HideProject (void)
if (Prj_CheckIfICanEditProject (Prj.PrjCod)) if (Prj_CheckIfICanEditProject (Prj.PrjCod))
{ {
/***** Hide project *****/ /***** Hide project *****/
DB_BuildQuery ("UPDATE projects SET Hidden='Y'" DB_QueryUPDATE ("can not hide project",
" WHERE PrjCod=%ld AND CrsCod=%ld", "UPDATE projects SET Hidden='Y'"
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod); " WHERE PrjCod=%ld AND CrsCod=%ld",
DB_QueryUPDATE_new ("can not hide project"); Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -2849,10 +2849,10 @@ void Prj_ShowProject (void)
if (Prj_CheckIfICanEditProject (Prj.PrjCod)) if (Prj_CheckIfICanEditProject (Prj.PrjCod))
{ {
/***** Show project *****/ /***** Show project *****/
DB_BuildQuery ("UPDATE projects SET Hidden='N'" DB_QueryUPDATE ("can not show project",
" WHERE PrjCod=%ld AND CrsCod=%ld", "UPDATE projects SET Hidden='N'"
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod); " WHERE PrjCod=%ld AND CrsCod=%ld",
DB_QueryUPDATE_new ("can not show project"); Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -3364,27 +3364,34 @@ static void Prj_UpdateProject (struct Project *Prj)
Prj->ModifTime = Gbl.StartExecutionTimeUTC; Prj->ModifTime = Gbl.StartExecutionTimeUTC;
/***** Update the data of the project *****/ /***** Update the data of the project *****/
DB_BuildQuery ("UPDATE projects SET " DB_QueryUPDATE ("can not update project",
"DptCod=%ld,Hidden='%c',Preassigned='%c',NumStds=%u,Proposal='%s'," "UPDATE projects"
"ModifTime=FROM_UNIXTIME(%ld)," " SET DptCod=%ld,"
"Title='%s'," "Hidden='%c',"
"Description='%s',Knowledge='%s',Materials='%s',URL='%s'" "Preassigned='%c',"
" WHERE PrjCod=%ld AND CrsCod=%ld", "NumStds=%u,"
Prj->DptCod, "Proposal='%s',"
Prj->Hidden == Prj_HIDDEN ? 'Y' : "ModifTime=FROM_UNIXTIME(%ld),"
'N', "Title='%s',"
Prj->Preassigned == Prj_PREASSIGNED ? 'Y' : "Description='%s',"
'N', "Knowledge='%s',"
Prj->NumStds, "Materials='%s',"
Prj_Proposal_DB[Prj->Proposal], "URL='%s'"
Prj->ModifTime, " WHERE PrjCod=%ld AND CrsCod=%ld",
Prj->Title, Prj->DptCod,
Prj->Description, Prj->Hidden == Prj_HIDDEN ? 'Y' :
Prj->Knowledge, 'N',
Prj->Materials, Prj->Preassigned == Prj_PREASSIGNED ? 'Y' :
Prj->URL, 'N',
Prj->PrjCod,Gbl.CurrentCrs.Crs.CrsCod); Prj->NumStds,
DB_QueryUPDATE_new ("can not update project"); Prj_Proposal_DB[Prj->Proposal],
Prj->ModifTime,
Prj->Title,
Prj->Description,
Prj->Knowledge,
Prj->Materials,
Prj->URL,
Prj->PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -832,10 +832,10 @@ void Rec_RenameField (void)
else else
{ {
/* Update the table of fields changing then old name by the new one */ /* 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",
" WHERE FieldCod=%ld", "UPDATE crs_record_fields SET FieldName='%s'"
NewFieldName,Gbl.CurrentCrs.Records.Field.FieldCod); " WHERE FieldCod=%ld",
DB_QueryUPDATE_new ("can not update name of field of record"); NewFieldName,Gbl.CurrentCrs.Records.Field.FieldCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -896,10 +896,10 @@ void Rec_ChangeLinesField (void)
else else
{ {
/***** Update of the table of fields changing the old maximum of students by the new one *****/ /***** 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",
" WHERE FieldCod=%ld", "UPDATE crs_record_fields SET NumLines=%u"
NewNumLines,Gbl.CurrentCrs.Records.Field.FieldCod); " WHERE FieldCod=%ld",
DB_QueryUPDATE_new ("can not update the number of lines of a field of record"); NewNumLines,Gbl.CurrentCrs.Records.Field.FieldCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -950,10 +950,11 @@ void Rec_ChangeVisibilityField (void)
else else
{ {
/***** Update of the table of fields changing the old visibility by the new *****/ /***** 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",
" WHERE FieldCod=%ld", "UPDATE crs_record_fields SET Visibility=%u"
(unsigned) NewVisibility,Gbl.CurrentCrs.Records.Field.FieldCod); " WHERE FieldCod=%ld",
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 *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1995,15 +1996,13 @@ void Rec_UpdateCrsRecord (long UsrCod)
if (FieldAlreadyExists) if (FieldAlreadyExists)
{ {
if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0]) if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
{
/***** Update text of the field of record course *****/ /***** Update text of the field of record course *****/
DB_BuildQuery ("UPDATE crs_records SET Txt='%s'" DB_QueryUPDATE ("can not update field of record",
" WHERE UsrCod=%ld AND FieldCod=%ld", "UPDATE crs_records SET Txt='%s'"
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text, " WHERE UsrCod=%ld AND FieldCod=%ld",
UsrCod, Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text,
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod); UsrCod,
DB_QueryUPDATE_new ("can not update field of record"); Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod);
}
else else
/***** Remove text of the field of record course *****/ /***** Remove text of the field of record course *****/
DB_QueryDELETE ("can not remove field of record", 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); Par_GetParToText ("Office",Gbl.Usrs.Me.UsrDat.Tch.Office,Usr_MAX_BYTES_ADDRESS);
/***** Update office *****/ /***** Update office *****/
DB_BuildQuery ("UPDATE usr_data SET Office='%s' WHERE UsrCod=%ld", DB_QueryUPDATE ("can not update office",
Gbl.Usrs.Me.UsrDat.Tch.Office, "UPDATE usr_data SET Office='%s' WHERE UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.Tch.Office,
DB_QueryUPDATE_new ("can not update office"); Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show form again *****/ /***** Show form again *****/
Rec_ShowMySharedRecordAndMore (); Rec_ShowMySharedRecordAndMore ();
@ -4415,10 +4414,10 @@ void Rec_UpdateMyOfficePhone (void)
Par_GetParToText ("OfficePhone",Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,Usr_MAX_BYTES_PHONE); Par_GetParToText ("OfficePhone",Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,Usr_MAX_BYTES_PHONE);
/***** Update office phone *****/ /***** Update office phone *****/
DB_BuildQuery ("UPDATE usr_data SET OfficePhone='%s' WHERE UsrCod=%ld", DB_QueryUPDATE ("can not update office phone",
Gbl.Usrs.Me.UsrDat.Tch.OfficePhone, "UPDATE usr_data SET OfficePhone='%s' WHERE UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
DB_QueryUPDATE_new ("can not update office phone"); Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show form again *****/ /***** Show form again *****/
Rec_ShowMySharedRecordAndMore (); Rec_ShowMySharedRecordAndMore ();

View File

@ -1321,19 +1321,19 @@ static void Sch_SaveLastSearchIntoSession (void)
Gbl.Search.WhatToSearch = Sch_WHAT_TO_SEARCH_DEFAULT; Gbl.Search.WhatToSearch = Sch_WHAT_TO_SEARCH_DEFAULT;
/***** Save last search in session *****/ /***** Save last search in session *****/
DB_BuildQuery ("UPDATE sessions SET WhatToSearch=%u,SearchStr='%s'" DB_QueryUPDATE ("can not update last search in session",
" WHERE SessionId='%s'", "UPDATE sessions SET WhatToSearch=%u,SearchStr='%s'"
(unsigned) Gbl.Search.WhatToSearch, " WHERE SessionId='%s'",
Gbl.Search.Str, (unsigned) Gbl.Search.WhatToSearch,
Gbl.Session.Id); Gbl.Search.Str,
DB_QueryUPDATE_new ("can not update last search in session"); Gbl.Session.Id);
/***** Update my last type of search *****/ /***** Update my last type of search *****/
// WhatToSearch is stored in usr_last for next time I log in // WhatToSearch is stored in usr_last for next time I log in
// In other existing sessions distinct to this, WhatToSearch will remain unchanged // 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",
(unsigned) Gbl.Search.WhatToSearch, "UPDATE usr_last SET WhatToSearch=%u WHERE UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.UsrCod); (unsigned) Gbl.Search.WhatToSearch,
DB_QueryUPDATE_new ("can not update type of search in user's last data"); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
} }

View File

@ -181,20 +181,20 @@ void Ses_InsertSessionInDB (void)
void Ses_UpdateSessionDataInDB (void) void Ses_UpdateSessionDataInDB (void)
{ {
/***** Update session in database *****/ /***** Update session in database *****/
DB_BuildQuery ("UPDATE sessions SET UsrCod=%ld,Password='%s',Role=%u," DB_QueryUPDATE ("can not update session",
"CtyCod=%ld,InsCod=%ld,CtrCod=%ld,DegCod=%ld,CrsCod=%ld," "UPDATE sessions SET UsrCod=%ld,Password='%s',Role=%u,"
"LastTime=NOW(),LastRefresh=NOW()" "CtyCod=%ld,InsCod=%ld,CtrCod=%ld,DegCod=%ld,CrsCod=%ld,"
" WHERE SessionId='%s'", "LastTime=NOW(),LastRefresh=NOW()"
Gbl.Usrs.Me.UsrDat.UsrCod, " WHERE SessionId='%s'",
Gbl.Usrs.Me.UsrDat.Password, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Gbl.Usrs.Me.Role.Logged, Gbl.Usrs.Me.UsrDat.Password,
Gbl.CurrentCty.Cty.CtyCod, (unsigned) Gbl.Usrs.Me.Role.Logged,
Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentCtr.Ctr.CtrCod,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentDeg.Deg.DegCod,
Gbl.Session.Id); Gbl.CurrentCrs.Crs.CrsCod,
DB_QueryUPDATE_new ("can not update session"); Gbl.Session.Id);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -204,9 +204,9 @@ void Ses_UpdateSessionDataInDB (void)
void Ses_UpdateSessionLastRefreshInDB (void) void Ses_UpdateSessionLastRefreshInDB (void)
{ {
/***** Update session in database *****/ /***** Update session in database *****/
DB_BuildQuery ("UPDATE sessions SET LastRefresh=NOW() WHERE SessionId='%s'", DB_QueryUPDATE ("can not update session",
Gbl.Session.Id); "UPDATE sessions SET LastRefresh=NOW() WHERE SessionId='%s'",
DB_QueryUPDATE_new ("can not update session"); Gbl.Session.Id);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -848,11 +848,12 @@ static long Soc_GetPubCodFromSession (const char *FieldName)
static void Soc_UpdateLastPubCodIntoSession (void) static void Soc_UpdateLastPubCodIntoSession (void)
{ {
/***** Update last publishing code *****/ /***** Update last publishing code *****/
DB_BuildQuery ("UPDATE sessions" DB_QueryUPDATE ("can not update last publishing code into session",
" SET LastPubCod=(SELECT IFNULL(MAX(PubCod),0) FROM social_pubs)" "UPDATE sessions"
" WHERE SessionId='%s'", " SET LastPubCod="
Gbl.Session.Id); "(SELECT IFNULL(MAX(PubCod),0) FROM social_pubs)"
DB_QueryUPDATE_new ("can not update last publishing code into session"); " WHERE SessionId='%s'",
Gbl.Session.Id);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -862,9 +863,9 @@ static void Soc_UpdateLastPubCodIntoSession (void)
static void Soc_UpdateFirstPubCodIntoSession (long FirstPubCod) static void Soc_UpdateFirstPubCodIntoSession (long FirstPubCod)
{ {
/***** Update last publishing code *****/ /***** Update last publishing code *****/
DB_BuildQuery ("UPDATE sessions SET FirstPubCod=%ld WHERE SessionId='%s'", DB_QueryUPDATE ("can not update first publishing code into session",
FirstPubCod,Gbl.Session.Id); "UPDATE sessions SET FirstPubCod=%ld WHERE SessionId='%s'",
DB_QueryUPDATE_new ("can not update first publishing code into session"); FirstPubCod,Gbl.Session.Id);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1972,19 +1973,19 @@ void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod,struct Soci
void Soc_MarkSocialNoteAsUnavailableUsingNotCod (long NotCod) void Soc_MarkSocialNoteAsUnavailableUsingNotCod (long NotCod)
{ {
/***** Mark the social note as unavailable *****/ /***** Mark the social note as unavailable *****/
DB_BuildQuery ("UPDATE social_notes SET Unavailable='Y'" DB_QueryUPDATE ("can not mark social note as unavailable",
" WHERE NotCod=%ld", "UPDATE social_notes SET Unavailable='Y'"
NotCod); " WHERE NotCod=%ld",
DB_QueryUPDATE_new ("can not mark social note as unavailable"); NotCod);
} }
void Soc_MarkSocialNoteAsUnavailableUsingNoteTypeAndCod (Soc_NoteType_t NoteType,long Cod) void Soc_MarkSocialNoteAsUnavailableUsingNoteTypeAndCod (Soc_NoteType_t NoteType,long Cod)
{ {
/***** Mark the social note as unavailable *****/ /***** Mark the social note as unavailable *****/
DB_BuildQuery ("UPDATE social_notes SET Unavailable='Y'" DB_QueryUPDATE ("can not mark social note as unavailable",
" WHERE NoteType=%u AND Cod=%ld", "UPDATE social_notes SET Unavailable='Y'"
(unsigned) NoteType,Cod); " WHERE NoteType=%u AND Cod=%ld",
DB_QueryUPDATE_new ("can not mark social note as unavailable"); (unsigned) NoteType,Cod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2101,15 +2102,15 @@ void Soc_MarkSocialNotesChildrenOfFolderAsUnavailable (const char *Path)
default: default:
return; return;
} }
DB_BuildQuery ("UPDATE social_notes SET Unavailable='Y'" DB_QueryUPDATE ("can not mark social notes as unavailable",
" WHERE NoteType=%u AND Cod IN" "UPDATE social_notes SET Unavailable='Y'"
" (SELECT FilCod FROM files" " WHERE NoteType=%u AND Cod IN"
" WHERE FileBrowser=%u AND Cod=%ld" " (SELECT FilCod FROM files"
" AND Path LIKE '%s/%%' AND Public='Y')", // Only public files " WHERE FileBrowser=%u AND Cod=%ld"
(unsigned) NoteType, " AND Path LIKE '%s/%%' AND Public='Y')", // Only public files
(unsigned) FileBrowser,Cod, (unsigned) NoteType,
Path); (unsigned) FileBrowser,Cod,
DB_QueryUPDATE_new ("can not mark social notes as unavailable"); Path);
break; break;
default: default:
break; break;

View File

@ -1660,11 +1660,11 @@ void Svy_ResetSurvey (void)
Svy.SvyCod); Svy.SvyCod);
/***** Reset all the answers in this survey *****/ /***** 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",
" WHERE svy_questions.SvyCod=%ld" "UPDATE svy_answers,svy_questions SET svy_answers.NumUsrs=0"
" AND svy_questions.QstCod=svy_answers.QstCod", " WHERE svy_questions.SvyCod=%ld"
Svy.SvyCod); " AND svy_questions.QstCod=svy_answers.QstCod",
DB_QueryUPDATE_new ("can not reset answers of a survey"); Svy.SvyCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1699,8 +1699,9 @@ void Svy_HideSurvey (void)
Lay_ShowErrorAndExit ("You can not hide this survey."); Lay_ShowErrorAndExit ("You can not hide this survey.");
/***** Hide survey *****/ /***** Hide survey *****/
DB_BuildQuery ("UPDATE surveys SET Hidden='Y' WHERE SvyCod=%ld",Svy.SvyCod); DB_QueryUPDATE ("can not hide survey",
DB_QueryUPDATE_new ("can not hide survey"); "UPDATE surveys SET Hidden='Y' WHERE SvyCod=%ld",
Svy.SvyCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -1735,8 +1736,9 @@ void Svy_UnhideSurvey (void)
Lay_ShowErrorAndExit ("You can not unhide this survey."); Lay_ShowErrorAndExit ("You can not unhide this survey.");
/***** Show survey *****/ /***** Show survey *****/
DB_BuildQuery ("UPDATE surveys SET Hidden='N' WHERE SvyCod=%ld",Svy.SvyCod); DB_QueryUPDATE ("can not show survey",
DB_QueryUPDATE_new ("can not show survey"); "UPDATE surveys SET Hidden='N' WHERE SvyCod=%ld",
Svy.SvyCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -2237,10 +2239,10 @@ static void Svy_UpdateNumUsrsNotifiedByEMailAboutSurvey (long SvyCod,
unsigned NumUsrsToBeNotifiedByEMail) unsigned NumUsrsToBeNotifiedByEMail)
{ {
/***** Update number of users notified *****/ /***** 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",
" WHERE SvyCod=%ld", "UPDATE surveys SET NumNotif=NumNotif+%u"
NumUsrsToBeNotifiedByEMail,SvyCod); " WHERE SvyCod=%ld",
DB_QueryUPDATE_new ("can not update the number of notifications of a survey"); NumUsrsToBeNotifiedByEMail,SvyCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2290,20 +2292,20 @@ static void Svy_UpdateSurvey (struct Survey *Svy,const char *Txt)
extern const char *Txt_The_survey_has_been_modified; extern const char *Txt_The_survey_has_been_modified;
/***** Update the data of the survey *****/ /***** Update the data of the survey *****/
DB_BuildQuery ("UPDATE surveys" DB_QueryUPDATE ("can not update survey",
" SET Scope='%s',Cod=%ld,Roles=%u," "UPDATE surveys"
"StartTime=FROM_UNIXTIME(%ld)," " SET Scope='%s',Cod=%ld,Roles=%u,"
"EndTime=FROM_UNIXTIME(%ld)," "StartTime=FROM_UNIXTIME(%ld),"
"Title='%s',Txt='%s'" "EndTime=FROM_UNIXTIME(%ld),"
" WHERE SvyCod=%ld", "Title='%s',Txt='%s'"
Sco_ScopeDB[Svy->Scope],Svy->Cod, " WHERE SvyCod=%ld",
Svy->Roles, Sco_ScopeDB[Svy->Scope],Svy->Cod,
Svy->TimeUTC[Svy_START_TIME], Svy->Roles,
Svy->TimeUTC[Svy_END_TIME ], Svy->TimeUTC[Svy_START_TIME],
Svy->Title, Svy->TimeUTC[Svy_END_TIME ],
Txt, Svy->Title,
Svy->SvyCod); Txt,
DB_QueryUPDATE_new ("can not update survey"); Svy->SvyCod);
/***** Update groups *****/ /***** Update groups *****/
/* Remove old groups */ /* Remove old groups */
@ -3033,14 +3035,12 @@ void Svy_ReceiveQst (void)
Svy_StrAnswerTypesDB[SvyQst.AnswerType],Txt); Svy_StrAnswerTypesDB[SvyQst.AnswerType],Txt);
} }
else // It's an existing question else // It's an existing question
{
/* Update question */ /* Update question */
DB_BuildQuery ("UPDATE svy_questions SET Stem='%s',AnsType='%s'" DB_QueryUPDATE ("can not update question",
" WHERE QstCod=%ld AND SvyCod=%ld", "UPDATE svy_questions SET Stem='%s',AnsType='%s'"
Txt,Svy_StrAnswerTypesDB[SvyQst.AnswerType], " WHERE QstCod=%ld AND SvyCod=%ld",
SvyQst.QstCod,SvyCod); Txt,Svy_StrAnswerTypesDB[SvyQst.AnswerType],
DB_QueryUPDATE_new ("can not update question"); SvyQst.QstCod,SvyCod);
}
/* Insert, update or delete answers in the answers table */ /* Insert, update or delete answers in the answers table */
for (NumAns = 0; for (NumAns = 0;
@ -3049,13 +3049,11 @@ void Svy_ReceiveQst (void)
if (Svy_CheckIfAnswerExists (SvyQst.QstCod,NumAns)) // If this answer exists... if (Svy_CheckIfAnswerExists (SvyQst.QstCod,NumAns)) // If this answer exists...
{ {
if (SvyQst.AnsChoice[NumAns].Text[0]) // Answer is not empty if (SvyQst.AnsChoice[NumAns].Text[0]) // Answer is not empty
{
/* Update answer text */ /* Update answer text */
DB_BuildQuery ("UPDATE svy_answers SET Answer='%s'" DB_QueryUPDATE ("can not update answer",
" WHERE QstCod=%ld AND AnsInd=%u", "UPDATE svy_answers SET Answer='%s'"
SvyQst.AnsChoice[NumAns].Text,SvyQst.QstCod,NumAns); " WHERE QstCod=%ld AND AnsInd=%u",
DB_QueryUPDATE_new ("can not update answer"); SvyQst.AnsChoice[NumAns].Text,SvyQst.QstCod,NumAns);
}
else // Answer is empty else // Answer is empty
/* Delete answer from database */ /* Delete answer from database */
DB_QueryDELETE ("can not delete answer", DB_QueryDELETE ("can not delete answer",
@ -3603,10 +3601,10 @@ void Svy_RemoveQst (void)
Lay_ShowErrorAndExit ("The question to be removed does not exist."); Lay_ShowErrorAndExit ("The question to be removed does not exist.");
/* Change index of questions greater than this */ /* Change index of questions greater than this */
DB_BuildQuery ("UPDATE svy_questions SET QstInd=QstInd-1" DB_QueryUPDATE ("can not update indexes of questions",
" WHERE SvyCod=%ld AND QstInd>%u", "UPDATE svy_questions SET QstInd=QstInd-1"
SvyCod,SvyQst.QstInd); " WHERE SvyCod=%ld AND QstInd>%u",
DB_QueryUPDATE_new ("can not update indexes of questions"); SvyCod,SvyQst.QstInd);
/***** Write message *****/ /***** Write message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed); 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) static void Svy_IncreaseAnswerInDB (long QstCod,unsigned AnsInd)
{ {
/***** Increase number of users who have selected the answer AnsInd in the question QstCod *****/ /***** 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",
" WHERE QstCod=%ld AND AnsInd=%u", "UPDATE svy_answers SET NumUsrs=NumUsrs+1"
QstCod,AnsInd); " WHERE QstCod=%ld AND AnsInd=%u",
DB_QueryUPDATE_new ("can not register your answer to the survey"); QstCod,AnsInd);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1243,18 +1243,19 @@ static void Tst_UpdateScoreQst (long QstCod,float ScoreThisQst,bool AnswerIsNotB
/***** Update number of clicks and score of the question *****/ /***** Update number of clicks and score of the question *****/
Str_SetDecimalPointToUS (); // To print the floating point as a dot Str_SetDecimalPointToUS (); // To print the floating point as a dot
if (AnswerIsNotBlank) if (AnswerIsNotBlank)
DB_BuildQuery ("UPDATE tst_questions" DB_QueryUPDATE ("can not update the score of a question",
" SET NumHits=NumHits+1,NumHitsNotBlank=NumHitsNotBlank+1," "UPDATE tst_questions"
"Score=Score+(%lf)" " SET NumHits=NumHits+1,NumHitsNotBlank=NumHitsNotBlank+1,"
" WHERE QstCod=%ld", "Score=Score+(%lf)"
ScoreThisQst,QstCod); " WHERE QstCod=%ld",
ScoreThisQst,QstCod);
else // The answer is blank else // The answer is blank
DB_BuildQuery ("UPDATE tst_questions" DB_QueryUPDATE ("can not update the score of a question",
" SET NumHits=NumHits+1" "UPDATE tst_questions"
" WHERE QstCod=%ld", " SET NumHits=NumHits+1"
QstCod); " WHERE QstCod=%ld",
QstCod);
Str_SetDecimalPointToLocal (); // Return to local system 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) static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst)
{ {
/***** Update my number of accesses to test in this course *****/ /***** 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",
" WHERE CrsCod=%ld AND UsrCod=%ld", "UPDATE crs_usr SET NumAccTst=%u"
NumAccessesTst, " WHERE CrsCod=%ld AND UsrCod=%ld",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); NumAccessesTst,
DB_QueryUPDATE_new ("can not update the number of accesses to test"); Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1278,12 +1279,12 @@ static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst)
static void Tst_UpdateLastAccTst (void) static void Tst_UpdateLastAccTst (void)
{ {
/***** Update date-time and number of questions of this test *****/ /***** 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",
" WHERE CrsCod=%ld AND UsrCod=%ld", "UPDATE crs_usr SET LastAccTst=NOW(),NumQstsLastTst=%u"
Gbl.Test.NumQsts, " WHERE CrsCod=%ld AND UsrCod=%ld",
Gbl.CurrentCrs.Crs.CrsCod, Gbl.Test.NumQsts,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.CurrentCrs.Crs.CrsCod,
DB_QueryUPDATE_new ("can not update time and number of questions of this test"); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1621,14 +1622,14 @@ void Tst_RenameTag (void)
/* Change old tag to new tag in questions where it would not be repeated */ /* 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 // 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",
" SET TagCod=%ld" "UPDATE tst_question_tags"
" WHERE TagCod=%ld" " SET TagCod=%ld"
" AND QstCod NOT IN" " WHERE TagCod=%ld"
" (SELECT QstCod FROM tst_question_tags_tmp)", " AND QstCod NOT IN"
ExistingTagCod, " (SELECT QstCod FROM tst_question_tags_tmp)",
OldTagCod); ExistingTagCod,
DB_QueryUPDATE_new ("can not update a tag in some questions"); OldTagCod);
/* Drop temporary table, no longer necessary */ /* Drop temporary table, no longer necessary */
DB_Query ("can not remove temporary table", DB_Query ("can not remove temporary table",
@ -1643,11 +1644,11 @@ void Tst_RenameTag (void)
else // Renaming is easy else // Renaming is easy
{ {
/***** Simple update replacing each instance of the old tag by the new tag *****/ /***** 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",
" WHERE tst_tags.CrsCod=%ld" "UPDATE tst_tags SET TagTxt='%s',ChangeTime=NOW()"
" AND tst_tags.TagTxt='%s'", " WHERE tst_tags.CrsCod=%ld"
NewTagTxt,Gbl.CurrentCrs.Crs.CrsCod,OldTagTxt); " AND tst_tags.TagTxt='%s'",
DB_QueryUPDATE_new ("can not update tag"); NewTagTxt,Gbl.CurrentCrs.Crs.CrsCod,OldTagTxt);
} }
/***** Write message to show the change made *****/ /***** 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) static void Tst_EnableOrDisableTag (long TagCod,bool TagHidden)
{ {
/***** Insert new tag into tst_tags table *****/ /***** 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",
" WHERE TagCod=%ld AND CrsCod=%ld", "UPDATE tst_tags SET TagHidden='%c',ChangeTime=NOW()"
TagHidden ? 'Y' : " WHERE TagCod=%ld AND CrsCod=%ld",
'N', TagHidden ? 'Y' :
TagCod,Gbl.CurrentCrs.Crs.CrsCod); 'N',
DB_QueryUPDATE_new ("can not update the visibility of a tag"); TagCod,Gbl.CurrentCrs.Crs.CrsCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -6474,12 +6475,12 @@ void Tst_ChangeShuffleQst (void)
/***** Remove the question from all the tables *****/ /***** Remove the question from all the tables *****/
/* Update the question changing the current shuffle */ /* 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",
" WHERE QstCod=%ld AND CrsCod=%ld", "UPDATE tst_questions SET Shuffle='%c'"
Shuffle ? 'Y' : " WHERE QstCod=%ld AND CrsCod=%ld",
'N', Shuffle ? 'Y' :
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod); 'N',
DB_QueryUPDATE_new ("can not update the shuffle type of a question"); Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
/***** Write message *****/ /***** Write message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -6570,21 +6571,21 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
{ {
/***** Update existing question *****/ /***** Update existing question *****/
/* Update question in database */ /* Update question in database */
DB_BuildQuery ("UPDATE tst_questions" DB_QueryUPDATE ("can not update question",
" SET EditTime=NOW(),AnsType='%s',Shuffle='%c'," "UPDATE tst_questions"
"Stem='%s',Feedback='%s'," " SET EditTime=NOW(),AnsType='%s',Shuffle='%c',"
"ImageName='%s',ImageTitle='%s',ImageURL='%s'" "Stem='%s',Feedback='%s',"
" WHERE QstCod=%ld AND CrsCod=%ld", "ImageName='%s',ImageTitle='%s',ImageURL='%s'"
Tst_StrAnswerTypesDB[Gbl.Test.AnswerType], " WHERE QstCod=%ld AND CrsCod=%ld",
Gbl.Test.Shuffle ? 'Y' : Tst_StrAnswerTypesDB[Gbl.Test.AnswerType],
'N', Gbl.Test.Shuffle ? 'Y' :
Gbl.Test.Stem.Text, 'N',
Gbl.Test.Feedback.Text ? Gbl.Test.Feedback.Text : "", Gbl.Test.Stem.Text,
Gbl.Test.Image.Name, Gbl.Test.Feedback.Text ? Gbl.Test.Feedback.Text : "",
Gbl.Test.Image.Title ? Gbl.Test.Image.Title : "", Gbl.Test.Image.Name,
Gbl.Test.Image.URL ? Gbl.Test.Image.URL : "", Gbl.Test.Image.Title ? Gbl.Test.Image.Title : "",
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod); Gbl.Test.Image.URL ? Gbl.Test.Image.URL : "",
DB_QueryUPDATE_new ("can not update question"); Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
/* Update image status */ /* Update image status */
if (Gbl.Test.Image.Name[0]) if (Gbl.Test.Image.Name[0])
@ -7617,13 +7618,13 @@ static void Tst_StoreScoreOfTestResultInDB (long TstCod,
{ {
/***** Update score in test result *****/ /***** Update score in test result *****/
Str_SetDecimalPointToUS (); // To print the floating point as a dot Str_SetDecimalPointToUS (); // To print the floating point as a dot
DB_BuildQuery ("UPDATE tst_exams" DB_QueryUPDATE ("can not update result of test result",
" SET NumQstsNotBlank=%u,Score='%lf'" "UPDATE tst_exams"
" WHERE TstCod=%ld", " SET NumQstsNotBlank=%u,Score='%lf'"
NumQstsNotBlank,Score, " WHERE TstCod=%ld",
TstCod); NumQstsNotBlank,Score,
TstCod);
Str_SetDecimalPointToLocal (); // Return to local system Str_SetDecimalPointToLocal (); // Return to local system
DB_QueryUPDATE_new ("can not update result of test result");
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -293,12 +293,10 @@ void The_ChangeTheme (void)
/***** Store theme in database *****/ /***** Store theme in database *****/
if (Gbl.Usrs.Me.Logged) if (Gbl.Usrs.Me.Logged)
{ DB_QueryUPDATE ("can not update your preference about theme",
DB_BuildQuery ("UPDATE usr_data SET Theme='%s'" "UPDATE usr_data SET Theme='%s'"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
The_ThemeId[Gbl.Prefs.Theme],Gbl.Usrs.Me.UsrDat.UsrCod); 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 *****/ /***** Set preferences from current IP *****/
Pre_SetPrefsFromIP (); Pre_SetPrefsFromIP ();

View File

@ -3392,16 +3392,14 @@ void Usr_UpdateMyLastData (void)
DB_BuildQuery ("SELECT COUNT(*) FROM usr_last WHERE UsrCod=%ld", DB_BuildQuery ("SELECT COUNT(*) FROM usr_last WHERE UsrCod=%ld",
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
if (DB_QueryCOUNT_new ("can not get last user's click")) if (DB_QueryCOUNT_new ("can not get last user's click"))
{
/***** Update my last accessed course, tab and time of click in database *****/ /***** Update my last accessed course, tab and time of click in database *****/
// WhatToSearch, LastAccNotif remain unchanged // 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",
" WHERE UsrCod=%ld", "UPDATE usr_last SET LastCrs=%ld,LastTab=%u,LastTime=NOW()"
Gbl.CurrentCrs.Crs.CrsCod, " WHERE UsrCod=%ld",
(unsigned) Gbl.Action.Tab, Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod); (unsigned) Gbl.Action.Tab,
DB_QueryUPDATE_new ("can not update last user's data"); Gbl.Usrs.Me.UsrDat.UsrCod);
}
else else
Usr_InsertMyLastData (); Usr_InsertMyLastData ();
} }
@ -7228,11 +7226,11 @@ static void Usr_GetMyUsrListTypeFromDB (void)
static void Usr_UpdateMyUsrListTypeInDB (void) static void Usr_UpdateMyUsrListTypeInDB (void)
{ {
/***** Update type of users listing *****/ /***** Update type of users listing *****/
DB_BuildQuery ("UPDATE crs_usr SET UsrListType='%s'" DB_QueryUPDATE ("can not update type of listing",
" WHERE CrsCod=%ld AND UsrCod=%ld", "UPDATE crs_usr SET UsrListType='%s'"
Usr_StringsUsrListTypeInDB[Gbl.Usrs.Me.ListType], " WHERE CrsCod=%ld AND UsrCod=%ld",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); Usr_StringsUsrListTypeInDB[Gbl.Usrs.Me.ListType],
DB_QueryUPDATE_new ("can not update type of listing"); Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -7324,14 +7322,12 @@ static void Usr_GetMyColsClassPhotoFromDB (void)
static void Usr_UpdateMyColsClassPhotoInDB (void) static void Usr_UpdateMyColsClassPhotoInDB (void)
{ {
if (Gbl.Usrs.Me.Logged && Gbl.CurrentCrs.Crs.CrsCod > 0) if (Gbl.Usrs.Me.Logged && Gbl.CurrentCrs.Crs.CrsCod > 0)
{
/***** Update number of colums in class photo for current course *****/ /***** 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",
" WHERE CrsCod=%ld AND UsrCod=%ld", "UPDATE crs_usr SET ColsClassPhoto=%u"
Gbl.Usrs.ClassPhoto.Cols, " WHERE CrsCod=%ld AND UsrCod=%ld",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.ClassPhoto.Cols,
DB_QueryUPDATE_new ("can not update number of columns in class photo"); Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -7426,15 +7422,13 @@ void Usr_GetMyPrefAboutListWithPhotosFromDB (void)
static void Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB (void) static void Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB (void)
{ {
if (Gbl.Usrs.Me.Logged && Gbl.CurrentCrs.Crs.CrsCod > 0) if (Gbl.Usrs.Me.Logged && Gbl.CurrentCrs.Crs.CrsCod > 0)
{
/***** Update number of colums in class photo for current course *****/ /***** 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",
" WHERE CrsCod=%ld AND UsrCod=%ld", "UPDATE crs_usr SET ListWithPhotos='%c'"
Gbl.Usrs.Listing.WithPhotos ? 'Y' : " WHERE CrsCod=%ld AND UsrCod=%ld",
'N', Gbl.Usrs.Listing.WithPhotos ? 'Y' :
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); 'N',
DB_QueryUPDATE_new ("can not update your preference about photos in listing"); Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -3177,11 +3177,11 @@ int swad__markNotificationsAsRead (struct soap *soap,
if ((NtfCod = Str_ConvertStrCodToLongCod (LongStr)) > 0) if ((NtfCod = Str_ConvertStrCodToLongCod (LongStr)) > 0)
{ {
/***** Mark notification as read in the database *****/ /***** Mark notification as read in the database *****/
DB_BuildQuery ("UPDATE notif SET Status=(Status | %u)" DB_QueryUPDATE ("can not mark notification as read",
" WHERE NtfCod=%ld AND ToUsrCod=%ld", "UPDATE notif SET Status=(Status | %u)"
(unsigned) Ntf_STATUS_BIT_READ, " WHERE NtfCod=%ld AND ToUsrCod=%ld",
(long) NtfCod,Gbl.Usrs.Me.UsrDat.UsrCod); (unsigned) Ntf_STATUS_BIT_READ,
DB_QueryUPDATE_new ("can not mark notification as read"); (long) NtfCod,Gbl.Usrs.Me.UsrDat.UsrCod);
NumNtfsMarkedAsRead++; NumNtfsMarkedAsRead++;
} }
@ -3470,13 +3470,11 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
/***** If this recipient is the original sender of a message been replied... *****/ /***** If this recipient is the original sender of a message been replied... *****/
if (RecipientUsrCod == ReplyUsrCod) if (RecipientUsrCod == ReplyUsrCod)
{
/***** ...then update received message setting Replied field to true *****/ /***** ...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",
" WHERE MsgCod=%ld AND UsrCod=%ld", "UPDATE msg_rcv SET Replied='Y'"
OriginalMsgCod,SenderUsrCod); " WHERE MsgCod=%ld AND UsrCod=%ld",
DB_QueryUPDATE_new ("can not update a received message"); OriginalMsgCod,SenderUsrCod);
}
return SOAP_OK; return SOAP_OK;
} }