Version 18.11.23

This commit is contained in:
Antonio Cañas Vargas 2018-11-03 01:45:36 +01:00
parent 56cc0f530d
commit 8c2707a529
25 changed files with 433 additions and 390 deletions

View File

@ -728,46 +728,48 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount)
CommentsLength = strlen (UsrDat->Comments);
else
CommentsLength = 0;
DB_BuildQuery ("INSERT INTO usr_data"
" (EncryptedUsrCod,Password,"
"Surname1,Surname2,FirstName,Sex,"
"Theme,IconSet,Language,FirstDayOfWeek,DateFormat,"
"PhotoVisibility,ProfileVisibility,"
"CtyCod,"
"LocalAddress,LocalPhone,"
"FamilyAddress,FamilyPhone,"
"OriginPlace,Birthday,Comments,"
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)"
" VALUES"
" ('%s','%s',"
"'%s','%s','%s','%s',"
"'%s','%s','%s',%u,%u,"
"'%s','%s',"
"%ld,"
"'%s','%s',"
"'%s','%s','%s',"
"%s,'%s',"
"%u,%u,-1,0)",
UsrDat->EncryptedUsrCod,
UsrDat->Password,
UsrDat->Surname1,UsrDat->Surname2,UsrDat->FirstName,
Usr_StringsSexDB[UsrDat->Sex],
The_ThemeId[UsrDat->Prefs.Theme],
Ico_IconSetId[UsrDat->Prefs.IconSet],
Txt_STR_LANG_ID[UsrDat->Prefs.Language],
Cal_FIRST_DAY_OF_WEEK_DEFAULT,
(unsigned) Dat_FORMAT_DEFAULT,
Pri_VisibilityDB[UsrDat->PhotoVisibility],
Pri_VisibilityDB[UsrDat->ProfileVisibility],
UsrDat->CtyCod,
UsrDat->LocalAddress ,UsrDat->LocalPhone,
UsrDat->FamilyAddress,UsrDat->FamilyPhone,UsrDat->OriginPlace,
BirthdayStrDB,
CommentsLength ? UsrDat->Comments :
"",
(unsigned) Mnu_MENU_DEFAULT,
(unsigned) Cfg_DEFAULT_COLUMNS);
UsrDat->UsrCod = DB_QueryINSERTandReturnCode_new ("can not create user");
UsrDat->UsrCod =
DB_QueryINSERTandReturnCode ("can not create user",
"INSERT INTO usr_data"
" (EncryptedUsrCod,Password,"
"Surname1,Surname2,FirstName,Sex,"
"Theme,IconSet,Language,FirstDayOfWeek,DateFormat,"
"PhotoVisibility,ProfileVisibility,"
"CtyCod,"
"LocalAddress,LocalPhone,"
"FamilyAddress,FamilyPhone,"
"OriginPlace,Birthday,Comments,"
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)"
" VALUES"
" ('%s','%s',"
"'%s','%s','%s','%s',"
"'%s','%s','%s',%u,%u,"
"'%s','%s',"
"%ld,"
"'%s','%s',"
"'%s','%s','%s',"
"%s,'%s',"
"%u,%u,-1,0)",
UsrDat->EncryptedUsrCod,
UsrDat->Password,
UsrDat->Surname1,UsrDat->Surname2,UsrDat->FirstName,
Usr_StringsSexDB[UsrDat->Sex],
The_ThemeId[UsrDat->Prefs.Theme],
Ico_IconSetId[UsrDat->Prefs.IconSet],
Txt_STR_LANG_ID[UsrDat->Prefs.Language],
Cal_FIRST_DAY_OF_WEEK_DEFAULT,
(unsigned) Dat_FORMAT_DEFAULT,
Pri_VisibilityDB[UsrDat->PhotoVisibility],
Pri_VisibilityDB[UsrDat->ProfileVisibility],
UsrDat->CtyCod,
UsrDat->LocalAddress ,UsrDat->LocalPhone,
UsrDat->FamilyAddress,UsrDat->FamilyPhone,UsrDat->OriginPlace,
BirthdayStrDB,
CommentsLength ? UsrDat->Comments :
"",
(unsigned) Mnu_MENU_DEFAULT,
(unsigned) Cfg_DEFAULT_COLUMNS);
/* Insert user's IDs as confirmed */
for (NumID = 0;

View File

@ -1710,18 +1710,19 @@ void Agd_RecFormEvent (void)
static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
{
/***** Create a new event *****/
DB_BuildQuery ("INSERT INTO agendas"
" (UsrCod,StartTime,EndTime,Event,Location,Txt)"
" VALUES"
" (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s')",
AgdEvent->UsrCod,
AgdEvent->TimeUTC[Agd_START_TIME],
AgdEvent->TimeUTC[Agd_END_TIME ],
AgdEvent->Event,
AgdEvent->Location,
Txt);
AgdEvent->AgdCod = DB_QueryINSERTandReturnCode_new ("can not create new event");
AgdEvent->AgdCod =
DB_QueryINSERTandReturnCode ("can not create new event",
"INSERT INTO agendas"
" (UsrCod,StartTime,EndTime,Event,Location,Txt)"
" VALUES"
" (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s')",
AgdEvent->UsrCod,
AgdEvent->TimeUTC[Agd_START_TIME],
AgdEvent->TimeUTC[Agd_END_TIME ],
AgdEvent->Event,
AgdEvent->Location,
Txt);
}
/*****************************************************************************/

View File

@ -1495,19 +1495,20 @@ static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigne
static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt)
{
/***** Create a new assignment *****/
DB_BuildQuery ("INSERT INTO assignments"
" (CrsCod,UsrCod,StartTime,EndTime,Title,Folder,Txt)"
" VALUES"
" (%ld,%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s')",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Asg->TimeUTC[Dat_START_TIME],
Asg->TimeUTC[Dat_END_TIME ],
Asg->Title,
Asg->Folder,
Txt);
Asg->AsgCod = DB_QueryINSERTandReturnCode_new ("can not create new assignment");
Asg->AsgCod =
DB_QueryINSERTandReturnCode ("can not create new assignment",
"INSERT INTO assignments"
" (CrsCod,UsrCod,StartTime,EndTime,Title,Folder,Txt)"
" VALUES"
" (%ld,%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s')",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Asg->TimeUTC[Dat_START_TIME],
Asg->TimeUTC[Dat_END_TIME ],
Asg->Title,
Asg->Folder,
Txt);
/***** Create groups *****/
if (Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps)

View File

@ -1355,23 +1355,24 @@ void Att_RecFormAttEvent (void)
void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt)
{
/***** Create a new attendance event *****/
DB_BuildQuery ("INSERT INTO att_events"
" (CrsCod,Hidden,UsrCod,"
"StartTime,EndTime,CommentTchVisible,Title,Txt)"
" VALUES"
" (%ld,'%c',%ld,"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),'%c','%s','%s')",
Gbl.CurrentCrs.Crs.CrsCod,
Att->Hidden ? 'Y' :
'N',
Gbl.Usrs.Me.UsrDat.UsrCod,
Att->TimeUTC[Att_START_TIME],
Att->TimeUTC[Att_END_TIME ],
Att->CommentTchVisible ? 'Y' :
'N',
Att->Title,
Txt);
Att->AttCod = DB_QueryINSERTandReturnCode_new ("can not create new attendance event");
Att->AttCod =
DB_QueryINSERTandReturnCode ("can not create new attendance event",
"INSERT INTO att_events"
" (CrsCod,Hidden,UsrCod,"
"StartTime,EndTime,CommentTchVisible,Title,Txt)"
" VALUES"
" (%ld,'%c',%ld,"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),'%c','%s','%s')",
Gbl.CurrentCrs.Crs.CrsCod,
Att->Hidden ? 'Y' :
'N',
Gbl.Usrs.Me.UsrDat.UsrCod,
Att->TimeUTC[Att_START_TIME],
Att->TimeUTC[Att_END_TIME ],
Att->CommentTchVisible ? 'Y' :
'N',
Att->Title,
Txt);
/***** Create groups *****/
if (Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps)

View File

@ -2816,20 +2816,21 @@ static void Ctr_CreateCentre (unsigned Status)
extern const char *Txt_Created_new_centre_X;
/***** Create a new centre *****/
DB_BuildQuery ("INSERT INTO centres"
" (InsCod,PlcCod,Status,RequesterUsrCod,"
"ShortName,FullName,WWW,PhotoAttribution)"
" VALUES"
" (%ld,%ld,%u,%ld,"
"'%s','%s','%s','')",
Gbl.Ctrs.EditingCtr.InsCod,
Gbl.Ctrs.EditingCtr.PlcCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Ctrs.EditingCtr.ShrtName,
Gbl.Ctrs.EditingCtr.FullName,
Gbl.Ctrs.EditingCtr.WWW);
Gbl.Ctrs.EditingCtr.CtrCod = DB_QueryINSERTandReturnCode_new ("can not create a new centre");
Gbl.Ctrs.EditingCtr.CtrCod =
DB_QueryINSERTandReturnCode ("can not create a new centre",
"INSERT INTO centres"
" (InsCod,PlcCod,Status,RequesterUsrCod,"
"ShortName,FullName,WWW,PhotoAttribution)"
" VALUES"
" (%ld,%ld,%u,%ld,"
"'%s','%s','%s','')",
Gbl.Ctrs.EditingCtr.InsCod,
Gbl.Ctrs.EditingCtr.PlcCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Ctrs.EditingCtr.ShrtName,
Gbl.Ctrs.EditingCtr.FullName,
Gbl.Ctrs.EditingCtr.WWW);
/***** Write message to show the change made
and put button to go to centre created *****/

View File

@ -355,10 +355,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.11.22 (2018-11-02)"
#define Log_PLATFORM_VERSION "SWAD 18.11.23 (2018-11-03)"
#define CSS_FILE "swad18.4.css"
#define JS_FILE "swad17.17.1.js"
/*
Version 18.11.23: Nov 03, 2018 Joining building and performing query into one function. (236630 lines)
Version 18.11.22: Nov 02, 2018 Joining building and performing query into one function. (236589 lines)
Version 18.11.21: Nov 02, 2018 Joining building and performing query into one function. (236580 lines)
Version 18.11.20: Nov 02, 2018 Joining building and performing query into one function. (236585 lines)

View File

@ -1929,16 +1929,20 @@ static void Crs_CreateCourse (unsigned Status)
extern const char *Txt_Created_new_course_X;
/***** Insert new course into pending requests *****/
DB_BuildQuery ("INSERT INTO courses"
" (DegCod,Year,InsCrsCod,Status,RequesterUsrCod,ShortName,FullName)"
" VALUES"
" (%ld,%u,'%s',%u,%ld,'%s','%s')",
Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year,
Gbl.Degs.EditingCrs.InstitutionalCrsCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Degs.EditingCrs.ShrtName,Gbl.Degs.EditingCrs.FullName);
Gbl.Degs.EditingCrs.CrsCod = DB_QueryINSERTandReturnCode_new ("can not create a new course");
Gbl.Degs.EditingCrs.CrsCod =
DB_QueryINSERTandReturnCode ("can not create a new course",
"INSERT INTO courses"
" (DegCod,Year,InsCrsCod,Status,RequesterUsrCod,"
"ShortName,FullName)"
" VALUES"
" (%ld,%u,'%s',%u,%ld,"
"'%s','%s')",
Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year,
Gbl.Degs.EditingCrs.InstitutionalCrsCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Degs.EditingCrs.ShrtName,
Gbl.Degs.EditingCrs.FullName);
/***** Create success message *****/
Gbl.Alert.Type = Ale_SUCCESS;

View File

@ -3244,19 +3244,31 @@ void DB_QueryINSERT_old (char **Query,const char *MsgError)
/** Make an INSERT query in database and return code of last inserted item ***/
/*****************************************************************************/
long DB_QueryINSERTandReturnCode_new (const char *MsgError)
long DB_QueryINSERTandReturnCode (const char *MsgError,const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Query = NULL;
int Result;
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 ();
/***** Check that query string pointer
does point to an allocated string *****/
if (Gbl.DB.QueryPtr == NULL)
if (Query == NULL)
Lay_ShowErrorAndExit ("Wrong query string.");
/***** Query database and free query string pointer *****/
Result = mysql_query (&Gbl.mysql,Gbl.DB.QueryPtr); // Returns 0 on success
free ((void *) Gbl.DB.QueryPtr);
Gbl.DB.QueryPtr = NULL;
Result = mysql_query (&Gbl.mysql,Query); // Returns 0 on success
free ((void *) Query);
Query = NULL;
if (Result)
DB_ExitOnMySQLError (MsgError);

View File

@ -51,7 +51,7 @@ unsigned long DB_QueryCOUNT_old (char **Query,const char *MsgError);
void DB_QueryINSERT (const char *MsgError,const char *fmt,...);
void DB_QueryINSERT_old (char **Query,const char *MsgError);
long DB_QueryINSERTandReturnCode_new (const char *MsgError);
long DB_QueryINSERTandReturnCode (const char *MsgError,const char *fmt,...);
void DB_QueryREPLACE (const char *MsgError,const char *fmt,...);

View File

@ -1144,17 +1144,18 @@ static void Deg_CreateDegree (unsigned Status)
extern const char *Txt_Created_new_degree_X;
/***** Create a new degree *****/
DB_BuildQuery ("INSERT INTO degrees (CtrCod,DegTypCod,Status,"
"RequesterUsrCod,ShortName,FullName,WWW)"
" VALUES (%ld,%ld,%u,%ld,'%s','%s','%s')",
Gbl.Degs.EditingDeg.CtrCod,
Gbl.Degs.EditingDeg.DegTypCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Degs.EditingDeg.ShrtName,
Gbl.Degs.EditingDeg.FullName,
Gbl.Degs.EditingDeg.WWW);
Gbl.Degs.EditingDeg.DegCod = DB_QueryINSERTandReturnCode_new ("can not create a new degree");
Gbl.Degs.EditingDeg.DegCod =
DB_QueryINSERTandReturnCode ("can not create a new degree",
"INSERT INTO degrees (CtrCod,DegTypCod,Status,"
"RequesterUsrCod,ShortName,FullName,WWW)"
" VALUES (%ld,%ld,%u,%ld,'%s','%s','%s')",
Gbl.Degs.EditingDeg.CtrCod,
Gbl.Degs.EditingDeg.DegTypCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Degs.EditingDeg.ShrtName,
Gbl.Degs.EditingDeg.FullName,
Gbl.Degs.EditingDeg.WWW);
/***** Write message to show the change made
and put button to go to degree created *****/

View File

@ -2054,16 +2054,15 @@ void Enr_SignUpInCrs (void)
DB_QueryUPDATE_new ("can not update enrolment request");
}
else // No request in database for this user in this course
{
DB_BuildQuery ("INSERT INTO crs_usr_requests"
" (CrsCod,UsrCod,Role,RequestTime)"
" VALUES"
" (%ld,%ld,%u,NOW())",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) RoleFromForm);
ReqCod = DB_QueryINSERTandReturnCode_new ("can not save enrolment request");
}
ReqCod =
DB_QueryINSERTandReturnCode ("can not save enrolment request",
"INSERT INTO crs_usr_requests"
" (CrsCod,UsrCod,Role,RequestTime)"
" VALUES"
" (%ld,%ld,%u,NOW())",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) RoleFromForm);
/***** Show confirmation message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -734,34 +734,35 @@ static long Exa_AddExamAnnouncementToDB (void)
long ExaCod;
/***** Add exam announcement *****/
DB_BuildQuery ("INSERT INTO exam_announcements "
"(CrsCod,Status,NumNotif,CrsFullName,Year,ExamSession,"
"CallDate,ExamDate,Duration,"
"Place,ExamMode,Structure,DocRequired,MatRequired,MatAllowed,OtherInfo)"
" VALUES "
"(%ld,%u,0,'%s',%u,'%s',"
"NOW(),'%04u-%02u-%02u %02u:%02u:00','%02u:%02u:00','%s',"
"'%s','%s','%s','%s','%s','%s')",
Gbl.CurrentCrs.Crs.CrsCod,
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT,
Gbl.ExamAnns.ExaDat.CrsFullName,
Gbl.ExamAnns.ExaDat.Year,
Gbl.ExamAnns.ExaDat.Session,
Gbl.ExamAnns.ExaDat.ExamDate.Year,
Gbl.ExamAnns.ExaDat.ExamDate.Month,
Gbl.ExamAnns.ExaDat.ExamDate.Day,
Gbl.ExamAnns.ExaDat.StartTime.Hour,
Gbl.ExamAnns.ExaDat.StartTime.Minute,
Gbl.ExamAnns.ExaDat.Duration.Hour,
Gbl.ExamAnns.ExaDat.Duration.Minute,
Gbl.ExamAnns.ExaDat.Place,
Gbl.ExamAnns.ExaDat.Mode,
Gbl.ExamAnns.ExaDat.Structure,
Gbl.ExamAnns.ExaDat.DocRequired,
Gbl.ExamAnns.ExaDat.MatRequired,
Gbl.ExamAnns.ExaDat.MatAllowed,
Gbl.ExamAnns.ExaDat.OtherInfo);
ExaCod = DB_QueryINSERTandReturnCode_new ("can not create a new exam announcement");
ExaCod =
DB_QueryINSERTandReturnCode ("can not create a new exam announcement",
"INSERT INTO exam_announcements "
"(CrsCod,Status,NumNotif,CrsFullName,Year,ExamSession,"
"CallDate,ExamDate,Duration,"
"Place,ExamMode,Structure,DocRequired,MatRequired,MatAllowed,OtherInfo)"
" VALUES "
"(%ld,%u,0,'%s',%u,'%s',"
"NOW(),'%04u-%02u-%02u %02u:%02u:00','%02u:%02u:00','%s',"
"'%s','%s','%s','%s','%s','%s')",
Gbl.CurrentCrs.Crs.CrsCod,
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT,
Gbl.ExamAnns.ExaDat.CrsFullName,
Gbl.ExamAnns.ExaDat.Year,
Gbl.ExamAnns.ExaDat.Session,
Gbl.ExamAnns.ExaDat.ExamDate.Year,
Gbl.ExamAnns.ExaDat.ExamDate.Month,
Gbl.ExamAnns.ExaDat.ExamDate.Day,
Gbl.ExamAnns.ExaDat.StartTime.Hour,
Gbl.ExamAnns.ExaDat.StartTime.Minute,
Gbl.ExamAnns.ExaDat.Duration.Hour,
Gbl.ExamAnns.ExaDat.Duration.Minute,
Gbl.ExamAnns.ExaDat.Place,
Gbl.ExamAnns.ExaDat.Mode,
Gbl.ExamAnns.ExaDat.Structure,
Gbl.ExamAnns.ExaDat.DocRequired,
Gbl.ExamAnns.ExaDat.MatRequired,
Gbl.ExamAnns.ExaDat.MatAllowed,
Gbl.ExamAnns.ExaDat.OtherInfo);
return ExaCod;
}

View File

@ -11831,21 +11831,22 @@ long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
/***** Add path to the database *****/
DB_BuildQuery ("INSERT INTO files"
" (FileBrowser,Cod,ZoneUsrCod,"
"PublisherUsrCod,FileType,Path,Hidden,Public,License)"
" VALUES"
" (%u,%ld,%ld,"
"%ld,%u,'%s','N','%c',%u)",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Cod,ZoneUsrCod,
PublisherUsrCod,
(unsigned) FileType,
FullPathInTree,
IsPublic ? 'Y' :
'N',
(unsigned) License);
return DB_QueryINSERTandReturnCode_new ("can not add path to database");
return
DB_QueryINSERTandReturnCode ("can not add path to database",
"INSERT INTO files"
" (FileBrowser,Cod,ZoneUsrCod,"
"PublisherUsrCod,FileType,Path,Hidden,Public,License)"
" VALUES"
" (%u,%ld,%ld,"
"%ld,%u,'%s','N','%c',%u)",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Cod,ZoneUsrCod,
PublisherUsrCod,
(unsigned) FileType,
FullPathInTree,
IsPublic ? 'Y' :
'N',
(unsigned) License);
}
/*****************************************************************************/

View File

@ -507,18 +507,19 @@ static long For_InsertForumPst (long ThrCod,long UsrCod,
Img_MoveImageToDefinitiveDirectory (Image);
/***** Insert forum post in the database *****/
DB_BuildQuery ("INSERT INTO forum_post"
" (ThrCod,UsrCod,CreatTime,ModifTime,NumNotif,"
"Subject,Content,ImageName,ImageTitle,ImageURL)"
" VALUES"
" (%ld,%ld,NOW(),NOW(),0,"
"'%s','%s','%s','%s','%s')",
ThrCod,UsrCod,
Subject,Content,
Image->Name,
Image->Title ? Image->Title : "",
Image->URL ? Image->URL : "");
PstCod = DB_QueryINSERTandReturnCode_new ("can not create a new post in a forum");
PstCod =
DB_QueryINSERTandReturnCode ("can not create a new post in a forum",
"INSERT INTO forum_post"
" (ThrCod,UsrCod,CreatTime,ModifTime,NumNotif,"
"Subject,Content,ImageName,ImageTitle,ImageURL)"
" VALUES"
" (%ld,%ld,NOW(),NOW(),0,"
"'%s','%s','%s','%s','%s')",
ThrCod,UsrCod,
Subject,Content,
Image->Name,
Image->Title ? Image->Title : "",
Image->URL ? Image->URL : "");
return PstCod;
}
@ -595,14 +596,15 @@ static unsigned For_NumPstsInThrWithPstCod (long PstCod,long *ThrCod)
static long For_InsertForumThread (long FirstPstCod)
{
/***** Insert new thread in the database *****/
DB_BuildQuery ("INSERT INTO forum_thread"
" (ForumType,Location,FirstPstCod,LastPstCod)"
" VALUES"
" (%u,%ld,%ld,%ld)",
(unsigned) Gbl.Forum.ForumSelected.Type,
Gbl.Forum.ForumSelected.Location,
FirstPstCod,FirstPstCod);
return DB_QueryINSERTandReturnCode_new ("can not create a new thread in a forum");
return
DB_QueryINSERTandReturnCode ("can not create a new thread in a forum",
"INSERT INTO forum_thread"
" (ForumType,Location,FirstPstCod,LastPstCod)"
" VALUES"
" (%u,%ld,%ld,%ld)",
(unsigned) Gbl.Forum.ForumSelected.Type,
Gbl.Forum.ForumSelected.Location,
FirstPstCod,FirstPstCod);
}
/*****************************************************************************/

View File

@ -2180,20 +2180,21 @@ static void Gam_CreateGame (struct Game *Game,const char *Txt)
extern const char *Txt_Created_new_game_X;
/***** Create a new game *****/
DB_BuildQuery ("INSERT INTO games"
" (Scope,Cod,Hidden,Roles,UsrCod,StartTime,EndTime,Title,Txt)"
" VALUES"
" ('%s',%ld,'N',%u,%ld,"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s')",
Sco_ScopeDB[Game->Scope],Game->Cod,
Game->Roles,
Gbl.Usrs.Me.UsrDat.UsrCod,
Game->TimeUTC[Gam_START_TIME],
Game->TimeUTC[Gam_END_TIME ],
Game->Title,
Txt);
Game->GamCod = DB_QueryINSERTandReturnCode_new ("can not create new game");
Game->GamCod =
DB_QueryINSERTandReturnCode ("can not create new game",
"INSERT INTO games"
" (Scope,Cod,Hidden,Roles,UsrCod,StartTime,EndTime,Title,Txt)"
" VALUES"
" ('%s',%ld,'N',%u,%ld,"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s')",
Sco_ScopeDB[Game->Scope],Game->Cod,
Game->Roles,
Gbl.Usrs.Me.UsrDat.UsrCod,
Game->TimeUTC[Gam_START_TIME],
Game->TimeUTC[Gam_END_TIME ],
Game->Title,
Txt);
/***** Create groups *****/
if (Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps)

View File

@ -3825,19 +3825,20 @@ static bool Grp_CheckIfGroupNameExists (long GrpTypCod,const char *GrpName,long
static void Grp_CreateGroupType (void)
{
/***** Create a new group type *****/
DB_BuildQuery ("INSERT INTO crs_grp_types"
" (CrsCod,GrpTypName,Mandatory,Multiple,MustBeOpened,OpenTime)"
" VALUES"
" (%ld,'%s','%c','%c','%c',FROM_UNIXTIME(%ld))",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment ? 'Y' :
'N',
Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrolment ? 'Y' :
'N',
Gbl.CurrentCrs.Grps.GrpTyp.MustBeOpened ? 'Y' :
'N',
(long) Gbl.CurrentCrs.Grps.GrpTyp.OpenTimeUTC);
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod = DB_QueryINSERTandReturnCode_new ("can not create type of group");
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod =
DB_QueryINSERTandReturnCode ("can not create type of group",
"INSERT INTO crs_grp_types"
" (CrsCod,GrpTypName,Mandatory,Multiple,MustBeOpened,OpenTime)"
" VALUES"
" (%ld,'%s','%c','%c','%c',FROM_UNIXTIME(%ld))",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment ? 'Y' :
'N',
Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrolment ? 'Y' :
'N',
Gbl.CurrentCrs.Grps.GrpTyp.MustBeOpened ? 'Y' :
'N',
(long) Gbl.CurrentCrs.Grps.GrpTyp.OpenTimeUTC);
}
/*****************************************************************************/

View File

@ -2412,17 +2412,18 @@ static void Ins_CreateInstitution (unsigned Status)
extern const char *Txt_Created_new_institution_X;
/***** Create a new institution *****/
DB_BuildQuery ("INSERT INTO institutions"
" (CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
" VALUES"
" (%ld,%u,%ld,'%s','%s','%s')",
Gbl.Inss.EditingIns.CtyCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Inss.EditingIns.ShrtName,
Gbl.Inss.EditingIns.FullName,
Gbl.Inss.EditingIns.WWW);
Gbl.Inss.EditingIns.InsCod = DB_QueryINSERTandReturnCode_new ("can not create institution");
Gbl.Inss.EditingIns.InsCod =
DB_QueryINSERTandReturnCode ("can not create institution",
"INSERT INTO institutions"
" (CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
" VALUES"
" (%ld,%u,%ld,'%s','%s','%s')",
Gbl.Inss.EditingIns.CtyCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Inss.EditingIns.ShrtName,
Gbl.Inss.EditingIns.FullName,
Gbl.Inss.EditingIns.WWW);
/***** Write message to show the change made
and put button to go to institution created *****/

View File

@ -1313,15 +1313,16 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
Img_MoveImageToDefinitiveDirectory (Image);
/***** Insert message subject and content in the database *****/
DB_BuildQuery ("INSERT INTO msg_content"
" (Subject,Content,ImageName,ImageTitle,ImageURL)"
" VALUES"
" ('%s','%s','%s','%s','%s')",
Subject,Content,
Image->Name,
Image->Title ? Image->Title : "",
Image->URL ? Image->URL : "");
MsgCod = DB_QueryINSERTandReturnCode_new ("can not create message");
MsgCod =
DB_QueryINSERTandReturnCode ("can not create message",
"INSERT INTO msg_content"
" (Subject,Content,ImageName,ImageTitle,ImageURL)"
" VALUES"
" ('%s','%s','%s','%s','%s')",
Subject,Content,
Image->Name,
Image->Title ? Image->Title : "",
Image->URL ? Image->URL : "");
/***** Insert message in sent messages *****/
DB_QueryINSERT ("can not create message",

View File

@ -165,13 +165,15 @@ void Not_ReceiveNotice (void)
static long Not_InsertNoticeInDB (const char *Content)
{
/***** Insert notice in the database *****/
DB_BuildQuery ("INSERT INTO notices"
" (CrsCod,UsrCod,CreatTime,Content,Status)"
" VALUES"
" (%ld,%ld,NOW(),'%s',%u)",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
Content,(unsigned) Not_ACTIVE_NOTICE);
return DB_QueryINSERTandReturnCode_new ("can not create notice");
return
DB_QueryINSERTandReturnCode ("can not create notice",
"INSERT INTO notices"
" (CrsCod,UsrCod,CreatTime,Content,Status)"
" VALUES"
" (%ld,%ld,NOW(),'%s',%u)",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Content,(unsigned) Not_ACTIVE_NOTICE);
}
/*****************************************************************************/

View File

@ -3314,30 +3314,31 @@ static void Prj_CreateProject (struct Project *Prj)
Prj->ModifTime = Gbl.StartExecutionTimeUTC;
/***** Create a new project *****/
DB_BuildQuery ("INSERT INTO projects"
" (CrsCod,DptCod,Hidden,Preassigned,NumStds,Proposal,"
"CreatTime,ModifTime,"
"Title,Description,Knowledge,Materials,URL)"
" VALUES"
" (%ld,%ld,'%c','%c',%u,'%s',"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s','%s','%s')",
Gbl.CurrentCrs.Crs.CrsCod,
Prj->DptCod,
Prj->Hidden == Prj_HIDDEN ? 'Y' :
'N',
Prj->Preassigned == Prj_PREASSIGNED ? 'Y' :
'N',
Prj->NumStds,
Prj_Proposal_DB[Prj->Proposal],
Prj->CreatTime,
Prj->ModifTime,
Prj->Title,
Prj->Description,
Prj->Knowledge,
Prj->Materials,
Prj->URL);
Prj->PrjCod = DB_QueryINSERTandReturnCode_new ("can not create new project");
Prj->PrjCod =
DB_QueryINSERTandReturnCode ("can not create new project",
"INSERT INTO projects"
" (CrsCod,DptCod,Hidden,Preassigned,NumStds,Proposal,"
"CreatTime,ModifTime,"
"Title,Description,Knowledge,Materials,URL)"
" VALUES"
" (%ld,%ld,'%c','%c',%u,'%s',"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s','%s','%s')",
Gbl.CurrentCrs.Crs.CrsCod,
Prj->DptCod,
Prj->Hidden == Prj_HIDDEN ? 'Y' :
'N',
Prj->Preassigned == Prj_PREASSIGNED ? 'Y' :
'N',
Prj->NumStds,
Prj_Proposal_DB[Prj->Proposal],
Prj->CreatTime,
Prj->ModifTime,
Prj->Title,
Prj->Description,
Prj->Knowledge,
Prj->Materials,
Prj->URL);
/***** Insert creator as first tutor *****/
DB_QueryINSERT ("can not add tutor",

View File

@ -1950,12 +1950,14 @@ void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod,struct Soci
}
/***** Store social note *****/
DB_BuildQuery ("INSERT INTO social_notes"
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
" VALUES"
" (%u,%ld,%ld,%ld,'N',NOW())",
(unsigned) NoteType,Cod,Gbl.Usrs.Me.UsrDat.UsrCod,HieCod);
SocPub->NotCod = DB_QueryINSERTandReturnCode_new ("can not create new social note");
SocPub->NotCod =
DB_QueryINSERTandReturnCode ("can not create new social note",
"INSERT INTO social_notes"
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
" VALUES"
" (%u,%ld,%ld,%ld,'N',NOW())",
(unsigned) NoteType,
Cod,Gbl.Usrs.Me.UsrDat.UsrCod,HieCod);
/***** Publish social note in timeline *****/
SocPub->PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
@ -2122,14 +2124,15 @@ void Soc_MarkSocialNotesChildrenOfFolderAsUnavailable (const char *Path)
static void Soc_PublishSocialNoteInTimeline (struct SocialPublishing *SocPub)
{
/***** Publish social note in timeline *****/
DB_BuildQuery ("INSERT INTO social_pubs"
" (NotCod,PublisherCod,PubType,TimePublish)"
" VALUES"
" (%ld,%ld,%u,NOW())",
SocPub->NotCod,
SocPub->PublisherCod,
(unsigned) SocPub->PubType);
SocPub->PubCod = DB_QueryINSERTandReturnCode_new ("can not publish social note");
SocPub->PubCod =
DB_QueryINSERTandReturnCode ("can not publish social note",
"INSERT INTO social_pubs"
" (NotCod,PublisherCod,PubType,TimePublish)"
" VALUES"
" (%ld,%ld,%u,NOW())",
SocPub->NotCod,
SocPub->PublisherCod,
(unsigned) SocPub->PubType);
}
/*****************************************************************************/
@ -2300,17 +2303,18 @@ static long Soc_ReceiveSocialPost (void)
/***** Publish *****/
/* Insert post content in the database */
DB_BuildQuery ("INSERT INTO social_posts"
" (Content,ImageName,ImageTitle,ImageURL)"
" VALUES"
" ('%s','%s','%s','%s')",
Content,
Image.Name,
(Image.Name[0] && // Save image title only if image attached
Image.Title) ? Image.Title : "",
(Image.Name[0] && // Save image URL only if image attached
Image.URL ) ? Image.URL : "");
PstCod = DB_QueryINSERTandReturnCode_new ("can not create post");
PstCod =
DB_QueryINSERTandReturnCode ("can not create post",
"INSERT INTO social_posts"
" (Content,ImageName,ImageTitle,ImageURL)"
" VALUES"
" ('%s','%s','%s','%s')",
Content,
Image.Name,
(Image.Name[0] && // Save image title only if image attached
Image.Title) ? Image.Title : "",
(Image.Name[0] && // Save image URL only if image attached
Image.URL ) ? Image.URL : "");
/* Insert post in social notes */
Soc_StoreAndPublishSocialNote (Soc_NOTE_SOCIAL_POST,PstCod,&SocPub);

View File

@ -293,24 +293,25 @@ void Sta_LogAccess (const char *Comments)
/***** Insert access into database *****/
/* Log access in historical log (log_full) */
DB_BuildQuery ("INSERT INTO log_full "
"(ActCod,CtyCod,InsCod,CtrCod,DegCod,CrsCod,UsrCod,"
"Role,ClickTime,TimeToGenerate,TimeToSend,IP)"
" VALUES "
"(%ld,%ld,%ld,%ld,%ld,%ld,%ld,"
"%u,NOW(),%ld,%ld,'%s')",
ActCod,
Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentCtr.Ctr.CtrCod,
Gbl.CurrentDeg.Deg.DegCod,
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) RoleToStore,
Gbl.TimeGenerationInMicroseconds,
Gbl.TimeSendInMicroseconds,
Gbl.IP);
LogCod = DB_QueryINSERTandReturnCode_new ("can not log access (full)");
LogCod =
DB_QueryINSERTandReturnCode ("can not log access (full)",
"INSERT INTO log_full "
"(ActCod,CtyCod,InsCod,CtrCod,DegCod,CrsCod,UsrCod,"
"Role,ClickTime,TimeToGenerate,TimeToSend,IP)"
" VALUES "
"(%ld,%ld,%ld,%ld,%ld,%ld,%ld,"
"%u,NOW(),%ld,%ld,'%s')",
ActCod,
Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentCtr.Ctr.CtrCod,
Gbl.CurrentDeg.Deg.DegCod,
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) RoleToStore,
Gbl.TimeGenerationInMicroseconds,
Gbl.TimeSendInMicroseconds,
Gbl.IP);
/* Log access in recent log (log_recent) */
DB_QueryINSERT ("can not log access (recent)",

View File

@ -2253,20 +2253,21 @@ static void Svy_CreateSurvey (struct Survey *Svy,const char *Txt)
extern const char *Txt_Created_new_survey_X;
/***** Create a new survey *****/
DB_BuildQuery ("INSERT INTO surveys"
" (Scope,Cod,Hidden,Roles,UsrCod,StartTime,EndTime,Title,Txt)"
" VALUES"
" ('%s',%ld,'N',%u,%ld,"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s')",
Sco_ScopeDB[Svy->Scope],Svy->Cod,
Svy->Roles,
Gbl.Usrs.Me.UsrDat.UsrCod,
Svy->TimeUTC[Svy_START_TIME],
Svy->TimeUTC[Svy_END_TIME ],
Svy->Title,
Txt);
Svy->SvyCod = DB_QueryINSERTandReturnCode_new ("can not create new survey");
Svy->SvyCod =
DB_QueryINSERTandReturnCode ("can not create new survey",
"INSERT INTO surveys"
" (Scope,Cod,Hidden,Roles,UsrCod,StartTime,EndTime,Title,Txt)"
" VALUES"
" ('%s',%ld,'N',%u,%ld,"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s')",
Sco_ScopeDB[Svy->Scope],Svy->Cod,
Svy->Roles,
Gbl.Usrs.Me.UsrDat.UsrCod,
Svy->TimeUTC[Svy_START_TIME],
Svy->TimeUTC[Svy_END_TIME ],
Svy->Title,
Txt);
/***** Create groups *****/
if (Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps)
@ -3022,13 +3023,14 @@ void Svy_ReceiveQst (void)
SvyQst.QstInd = Svy_GetNextQuestionIndexInSvy (SvyCod);
/* Insert question in the table of questions */
DB_BuildQuery ("INSERT INTO svy_questions"
" (SvyCod,QstInd,AnsType,Stem)"
" VALUES"
" (%ld,%u,'%s','%s')",
SvyCod,SvyQst.QstInd,
Svy_StrAnswerTypesDB[SvyQst.AnswerType],Txt);
SvyQst.QstCod = DB_QueryINSERTandReturnCode_new ("can not create question");
SvyQst.QstCod =
DB_QueryINSERTandReturnCode ("can not create question",
"INSERT INTO svy_questions"
" (SvyCod,QstInd,AnsType,Stem)"
" VALUES"
" (%ld,%u,'%s','%s')",
SvyCod,SvyQst.QstInd,
Svy_StrAnswerTypesDB[SvyQst.AnswerType],Txt);
}
else // It's an existing question
{

View File

@ -6301,12 +6301,13 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt)
static long Tst_CreateNewTag (long CrsCod,const char *TagTxt)
{
/***** Insert new tag into tst_tags table *****/
DB_BuildQuery ("INSERT INTO tst_tags"
" (CrsCod,ChangeTime,TagTxt,TagHidden)"
" VALUES"
" (%ld,NOW(),'%s','N')",
CrsCod,TagTxt);
return DB_QueryINSERTandReturnCode_new ("can not create new tag");
return
DB_QueryINSERTandReturnCode ("can not create new tag",
"INSERT INTO tst_tags"
" (CrsCod,ChangeTime,TagTxt,TagHidden)"
" VALUES"
" (%ld,NOW(),'%s','N')",
CrsCod,TagTxt);
}
/*****************************************************************************/
@ -6541,24 +6542,25 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
if (Gbl.Test.QstCod < 0) // It's a new question
{
/***** Insert question in the table of questions *****/
DB_BuildQuery ("INSERT INTO tst_questions"
" (CrsCod,EditTime,AnsType,Shuffle,"
"Stem,Feedback,ImageName,ImageTitle,ImageURL,"
"NumHits,Score)"
" VALUES"
" (%ld,NOW(),'%s','%c',"
"'%s','%s','%s','%s','%s',"
"0,0)",
Gbl.CurrentCrs.Crs.CrsCod,
Tst_StrAnswerTypesDB[Gbl.Test.AnswerType],
Gbl.Test.Shuffle ? 'Y' :
'N',
Gbl.Test.Stem.Text,
Gbl.Test.Feedback.Text ? Gbl.Test.Feedback.Text : "",
Gbl.Test.Image.Name,
Gbl.Test.Image.Title ? Gbl.Test.Image.Title : "",
Gbl.Test.Image.URL ? Gbl.Test.Image.URL : "");
Gbl.Test.QstCod = DB_QueryINSERTandReturnCode_new ("can not create question");
Gbl.Test.QstCod =
DB_QueryINSERTandReturnCode ("can not create question",
"INSERT INTO tst_questions"
" (CrsCod,EditTime,AnsType,Shuffle,"
"Stem,Feedback,ImageName,ImageTitle,ImageURL,"
"NumHits,Score)"
" VALUES"
" (%ld,NOW(),'%s','%c',"
"'%s','%s','%s','%s','%s',"
"0,0)",
Gbl.CurrentCrs.Crs.CrsCod,
Tst_StrAnswerTypesDB[Gbl.Test.AnswerType],
Gbl.Test.Shuffle ? 'Y' :
'N',
Gbl.Test.Stem.Text,
Gbl.Test.Feedback.Text ? Gbl.Test.Feedback.Text : "",
Gbl.Test.Image.Name,
Gbl.Test.Image.Title ? Gbl.Test.Image.Title : "",
Gbl.Test.Image.URL ? Gbl.Test.Image.URL : "");
/* Update image status */
if (Gbl.Test.Image.Name[0])
@ -7593,16 +7595,17 @@ void Tst_SelDatesToSeeMyTestResults (void)
static long Tst_CreateTestResultInDB (void)
{
/***** Insert new test result into table *****/
DB_BuildQuery ("INSERT INTO tst_exams"
" (CrsCod,UsrCod,AllowTeachers,TstTime,NumQsts)"
" VALUES"
" (%ld,%ld,'%c',NOW(),%u)",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Test.AllowTeachers ? 'Y' :
'N',
Gbl.Test.NumQsts);
return DB_QueryINSERTandReturnCode_new ("can not create new test result");
return
DB_QueryINSERTandReturnCode ("can not create new test result",
"INSERT INTO tst_exams"
" (CrsCod,UsrCod,AllowTeachers,TstTime,NumQsts)"
" VALUES"
" (%ld,%ld,'%c',NOW(),%u)",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Test.AllowTeachers ? 'Y' :
'N',
Gbl.Test.NumQsts);
}
/*****************************************************************************/

View File

@ -3424,16 +3424,16 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
if (!MsgAlreadyInserted) // The message is inserted only once in the table of messages sent
{
/***** Insert message subject and body in the database *****/
/* Build query */
DB_BuildQuery ("INSERT INTO msg_content"
" (Subject,Content,ImageName,ImageTitle,ImageURL)"
" VALUES"
" ('%s','%s','','','')",
Subject,Content);
/* Get the code of the inserted item */
NewMsgCod = DB_QueryINSERTandReturnCode_new ("can not create message");
NewMsgCod =
DB_QueryINSERTandReturnCode ("can not create message",
"INSERT INTO msg_content"
" (Subject,Content,ImageName,ImageTitle,ImageURL)"
" VALUES"
" ('%s','%s','','','')",
Subject,Content);
/***** Insert message in sent messages *****/
/* Insert message in sent messages */
DB_QueryINSERT ("can not create message",
"INSERT INTO msg_snt"
" (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
@ -3528,16 +3528,15 @@ int swad__sendNotice (struct soap *soap,
"Requester must be a teacher");
/***** Insert notice in the database *****/
/* Build query */
DB_BuildQuery ("INSERT INTO notices"
" (CrsCod,UsrCod,CreatTime,Content,Status)"
" VALUES"
" (%ld,%ld,NOW(),'%s',%u)",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
body,(unsigned) Not_ACTIVE_NOTICE);
/* Get the code of the inserted item */
NotCod = DB_QueryINSERTandReturnCode_new ("can not create message");
NotCod =
DB_QueryINSERTandReturnCode ("can not create message",
"INSERT INTO notices"
" (CrsCod,UsrCod,CreatTime,Content,Status)"
" VALUES"
" (%ld,%ld,NOW(),'%s',%u)",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
body,(unsigned) Not_ACTIVE_NOTICE);
/***** Create notifications *****/
// TODO: create notifications