Version 20.36.22: Feb 27, 2021 Function moved to module swad_timeline_database.

This commit is contained in:
acanas 2021-02-28 19:55:04 +01:00
parent bb8957e584
commit a90f967243
4 changed files with 23 additions and 10 deletions

View File

@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 20.36.21 (2021-02-27)"
#define Log_PLATFORM_VERSION "SWAD 20.36.22 (2021-02-27)"
#define CSS_FILE "swad20.33.9.css"
#define JS_FILE "swad20.6.2.js"
/*
@ -601,6 +601,7 @@ TODO: DNI de un estudiante sale err
TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede.
TODO: Salvador Romero Cortés: @acanas opción para editar posts
Version 20.36.22: Feb 27, 2021 Function moved to module swad_timeline_database. (305387 lines)
Version 20.36.21: Feb 27, 2021 Function moved to module swad_timeline_database. (305376 lines)
Version 20.36.20: Feb 27, 2021 Query moved to module swad_timeline_database. (305374 lines)
Version 20.36.19: Feb 27, 2021 Queries moved to module swad_timeline_database. (305363 lines)

View File

@ -675,6 +675,25 @@ long TL_DB_GetPubCodFromSession (const char *FieldName,
return PubCod;
}
/*****************************************************************************/
/********************* Insert new publication in database ********************/
/*****************************************************************************/
// Return just created publication code
long TL_DB_CreateNewPub (const struct TL_Pub_Publication *Pub)
{
/***** Insert new publication in database *****/
return
DB_QueryINSERTandReturnCode ("can not publish note/comment",
"INSERT INTO tl_pubs"
" (NotCod,PublisherCod,PubType,TimePublish)"
" VALUES"
" (%ld,%ld,%u,NOW())",
Pub->NotCod,
Pub->PublisherCod,
(unsigned) Pub->PubType);
}
/*****************************************************************************/
/************** Update first publication code stored in session **************/
/*****************************************************************************/

View File

@ -97,6 +97,7 @@ unsigned TL_DB_SelectTheMostRecentPub (const struct TL_Pub_SubQueries *SubQuerie
long TL_DB_GetNotCodFromPubCod (long PubCod);
long TL_DB_GetPubCodFromSession (const char *FieldName,
const char SessionId[Cns_BYTES_SESSION_ID + 1]);
long TL_DB_CreateNewPub (const struct TL_Pub_Publication *Pub);
void TL_DB_UpdateFirstPubCodInSession (long FirstPubCod,
const char SessionId[Cns_BYTES_SESSION_ID + 1]);
void TL_DB_UpdateLastPubCodInSession (const char SessionId[Cns_BYTES_SESSION_ID + 1]);

View File

@ -636,15 +636,7 @@ static TL_Pub_PubType_t TL_Pub_GetPubTypeFromStr (const char *Str)
void TL_Pub_PublishPubInTimeline (struct TL_Pub_Publication *Pub)
{
/***** Publish note in timeline *****/
Pub->PubCod =
DB_QueryINSERTandReturnCode ("can not publish note/comment",
"INSERT INTO tl_pubs"
" (NotCod,PublisherCod,PubType,TimePublish)"
" VALUES"
" (%ld,%ld,%u,NOW())",
Pub->NotCod,
Pub->PublisherCod,
(unsigned) Pub->PubType);
Pub->PubCod = TL_DB_CreateNewPub (Pub);
/***** Increment number of publications in user's figures *****/
Prf_IncrementNumPubsUsr (Pub->PublisherCod);