Version 20.51.17: Mar 19, 2021 Mail domains database table renamed.

This commit is contained in:
acanas 2021-03-19 00:57:47 +01:00
parent 7d42118a5b
commit 5d03ffc421
4 changed files with 40 additions and 27 deletions

View File

@ -987,9 +987,9 @@ CREATE TABLE IF NOT EXISTS log_ws (
INDEX(PlgCod),
INDEX(FunCod));
--
-- Table mail_domains: stores e-mail domains to which sending of notifications is allowed
-- Table ntf_mail_domains: stores e-mail domains to which sending of notifications is allowed
--
CREATE TABLE IF NOT EXISTS mail_domains (
CREATE TABLE IF NOT EXISTS ntf_mail_domains (
MaiCod INT NOT NULL AUTO_INCREMENT,
Domain VARCHAR(255) NOT NULL,
Info VARCHAR(2047) NOT NULL,

View File

@ -600,13 +600,17 @@ TODO: Salvador Romero Cort
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
*/
#define Log_PLATFORM_VERSION "SWAD 20.51.16 (2021-03-19)"
#define Log_PLATFORM_VERSION "SWAD 20.51.17 (2021-03-19)"
#define CSS_FILE "swad20.45.css"
#define JS_FILE "swad20.6.2.js"
/*
TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 20.51.17: Mar 19, 2021 Mail domains database table renamed. (307992 lines)
1 change necessary in database:
RENAME TABLE mail_domains TO ntf_mail_domains;
Version 20.51.16: Mar 19, 2021 Notifications database table renamed. (307980 lines)
1 change necessary in database:
RENAME TABLE notif TO ntf_notifications;

View File

@ -2065,9 +2065,9 @@ mysql> DESCRIBE log_ws;
"INDEX(PlgCod),"
"INDEX(FunCod))");
/***** Table mail_domains *****/
/***** Table ntf_mail_domains *****/
/*
mysql> DESCRIBE mail_domains;
mysql> DESCRIBE ntf_mail_domains;
+--------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------+------+-----+---------+----------------+
@ -2077,7 +2077,7 @@ mysql> DESCRIBE mail_domains;
+--------+---------------+------+-----+---------+----------------+
3 rows in set (0,00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS mail_domains ("
DB_CreateTable ("CREATE TABLE IF NOT EXISTS ntf_mail_domains ("
"MaiCod INT NOT NULL AUTO_INCREMENT,"
"Domain VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_EMAIL_ADDRESS
"Info VARCHAR(2047) NOT NULL," // Mai_MAX_BYTES_MAIL_INFO

View File

@ -280,20 +280,20 @@ static void Mai_GetListMailDomainsAllowedForNotif (void)
/***** Get mail domains from database *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get mail domains",
"(SELECT mail_domains.MaiCod,"
"mail_domains.Domain AS Domain,"
"mail_domains.Info AS Info,"
"T1.N AS N"
" FROM mail_domains,T1"
" WHERE mail_domains.Domain=T1.Domain COLLATE 'latin1_bin')"
"(SELECT ntf_mail_domains.MaiCod," // row[0]
"ntf_mail_domains.Domain AS Domain," // row[1]
"ntf_mail_domains.Info AS Info," // row[2]
"T1.N AS N" // row[3]
" FROM ntf_mail_domains,T1"
" WHERE ntf_mail_domains.Domain=T1.Domain COLLATE 'latin1_bin')"
" UNION "
"(SELECT MaiCod,"
"Domain,"
"Info,"
"0 AS N"
" FROM mail_domains"
" WHERE Domain NOT IN"
" (SELECT Domain COLLATE 'latin1_bin' FROM T2))"
"(SELECT MaiCod," // row[0]
"Domain," // row[1]
"Info," // row[2]
"0 AS N" // row[3]
" FROM ntf_mail_domains"
" WHERE Domain NOT IN"
" (SELECT Domain COLLATE 'latin1_bin' FROM T2))"
" ORDER BY %s", // COLLATE necessary to avoid error in comparisons
OrderBySubQuery[Gbl.Mails.SelectedOrder]);
@ -385,7 +385,8 @@ static bool Mai_CheckIfMailDomainIsAllowedForNotif (const char MailDomain[Cns_MA
/***** Get number of mail_domains with a name from database *****/
return (DB_QueryCOUNT ("can not check if a mail domain"
" is allowed for notifications",
"SELECT COUNT(*) FROM mail_domains"
"SELECT COUNT(*)"
" FROM ntf_mail_domains"
" WHERE Domain='%s'",
MailDomain) != 0);
}
@ -430,7 +431,9 @@ void Mai_GetDataOfMailDomainByCod (struct Mail *Mai)
/***** Get data of a mail domain from database *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get data"
" of a mail domain",
"SELECT Domain,Info FROM mail_domains"
"SELECT Domain," // row[0]
"Info" // row[1]
" FROM ntf_mail_domains"
" WHERE MaiCod=%ld",
Mai->MaiCod);
@ -575,7 +578,8 @@ void Mai_RemoveMailDomain (void)
/***** Remove mail *****/
DB_QueryDELETE ("can not remove a mail domain",
"DELETE FROM mail_domains WHERE MaiCod=%ld",
"DELETE FROM ntf_mail_domains"
" WHERE MaiCod=%ld",
Mai_EditingMai->MaiCod);
/***** Write message to show the change made *****/
@ -696,8 +700,10 @@ static bool Mai_CheckIfMailDomainNameExists (const char *FieldName,const char *N
/***** Get number of mail_domains with a name from database *****/
return (DB_QueryCOUNT ("can not check if the name"
" of a mail domain already existed",
"SELECT COUNT(*) FROM mail_domains"
" WHERE %s='%s' AND MaiCod<>%ld",
"SELECT COUNT(*)"
" FROM ntf_mail_domains"
" WHERE %s='%s'"
" AND MaiCod<>%ld",
FieldName,Name,MaiCod) != 0);
}
@ -709,7 +715,9 @@ static void Mai_UpdateMailDomainNameDB (long MaiCod,const char *FieldName,const
{
/***** Update mail domain changing old name by new name */
DB_QueryUPDATE ("can not update the name of a mail domain",
"UPDATE mail_domains SET %s='%s' WHERE MaiCod=%ld",
"UPDATE ntf_mail_domains"
" SET %s='%s'"
" WHERE MaiCod=%ld",
FieldName,NewMaiName,MaiCod);
}
@ -855,11 +863,12 @@ static void Mai_CreateMailDomain (struct Mail *Mai)
{
/***** Create a new mail *****/
DB_QueryINSERT ("can not create mail domain",
"INSERT INTO mail_domains"
"INSERT INTO ntf_mail_domains"
" (Domain,Info)"
" VALUES"
" ('%s','%s')",
Mai->Domain,Mai->Info);
Mai->Domain,
Mai->Info);
}
/*****************************************************************************/