Version 23.33.2: Oct 10, 2023 Code refactoring in short and full names. Not finished.

This commit is contained in:
acanas 2023-10-10 14:42:33 +02:00
parent 429668a241
commit 7d8fa0bebb
22 changed files with 95 additions and 371 deletions

View File

@ -649,14 +649,13 @@ static void Ban_RenameBanner (struct Ban_Banner *Ban,
/* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_banner_X_has_been_renamed_as_Y,
Txt_The_banner_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName);
}
}
else // The same name
/* Write warning message */
Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed,
Ale_CreateAlert (Ale_INFO,NULL,Txt_The_name_X_has_not_changed,
CurrentName[ShrtOrFullName]);
}
@ -882,7 +881,7 @@ void Ban_ReceiveFormNewBanner (void)
if (Ban->ShrtName[0] &&
Ban->FullName[0]) // If there's a banner name
{
/***** If name of banner was in database... *****/
/***** If name of banner was not in database... *****/
if (!Nam_CheckIfNameExists (Ban_DB_CheckIfBannerNameExists,Names,-1L,
-1L,0)) // Unused
{
@ -892,7 +891,7 @@ void Ban_ReceiveFormNewBanner (void)
else if (!Ban->WWW[0])
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_You_must_specify_the_web_address);
else // Add new banner to database
else
{
Ban_DB_CreateBanner (Ban);
Ale_CreateAlert (Ale_SUCCESS,Txt_Created_new_banner_X,

View File

@ -114,7 +114,6 @@ unsigned Ban_DB_GetBannerDataByCod (MYSQL_RES **mysql_res,long BanCod)
/********************* Check if the name of banner exists ********************/
/*****************************************************************************/
// bool Ban_DB_CheckIfBannerNameExists (const char *FldName,const char *Name,long BanCod)
bool Ban_DB_CheckIfBannerNameExists (const char *FldName,const char *Name,long Cod,
__attribute__((unused)) long PrtCod,
__attribute__((unused)) unsigned Year)

View File

@ -531,7 +531,7 @@ static void Bld_RenameBuilding (Nam_ShrtOrFullName_t ShrtOrFullName)
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_building_X_already_exists;
extern const char *Txt_X_already_exists;
extern const char *Txt_The_building_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed;
char *CurrentName[Nam_NUM_SHRT_FULL_NAMES] =
@ -560,10 +560,9 @@ static void Bld_RenameBuilding (Nam_ShrtOrFullName_t ShrtOrFullName)
{
/***** If building was in database... *****/
if (Bld_DB_CheckIfBuildingNameExists (Nam_ParShrtOrFullName[ShrtOrFullName],
NewName,Bld_EditingBuilding->BldCod))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_building_X_already_exists,
NewName);
NewName,Bld_EditingBuilding->BldCod,
-1L,0)) // Unused
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
else
{
/* Update the table changing old name by new name */
@ -722,11 +721,7 @@ static void Bld_PutHeadBuildings (void)
void Bld_ReceiveFormNewBuilding (void)
{
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_building_X_already_exists;
extern const char *Txt_Created_new_building_X;
Nam_ShrtOrFullName_t ShrtOrFullName;
bool Exists;
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
{
[Nam_SHRT_NAME] = Bld_EditingBuilding->ShrtName,
@ -746,19 +741,9 @@ void Bld_ReceiveFormNewBuilding (void)
if (Bld_EditingBuilding->ShrtName[0] &&
Bld_EditingBuilding->FullName[0]) // If there's a building name
{
/***** If name of building was in database... *****/
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
ShrtOrFullName++)
if (Bld_DB_CheckIfBuildingNameExists (Nam_FldShrtOrFullName[ShrtOrFullName],
Names[ShrtOrFullName],-1L))
{
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_building_X_already_exists,
Names[ShrtOrFullName]);
Exists = true;
}
if (!Exists) // Add new building to database
/***** If name of building was not in database... *****/
if (!Nam_CheckIfNameExists (Bld_DB_CheckIfBuildingNameExists,Names,-1L,
-1L,0)) // Unused
{
Bld_DB_CreateBuilding (Bld_EditingBuilding);
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_building_X,

View File

@ -116,7 +116,9 @@ unsigned Bld_DB_GetBuildingDataByCod (MYSQL_RES **mysql_res,long BldCod)
/******************** Check if the name of building exists *******************/
/*****************************************************************************/
bool Bld_DB_CheckIfBuildingNameExists (const char *FldName,const char *Name,long BldCod)
bool Bld_DB_CheckIfBuildingNameExists (const char *FldName,const char *Name,long Cod,
__attribute__((unused)) long PrtCod,
__attribute__((unused)) unsigned Year)
{
return
DB_QueryEXISTS ("can not check if the name of a building already existed",
@ -128,7 +130,7 @@ bool Bld_DB_CheckIfBuildingNameExists (const char *FldName,const char *Name,long
" AND BldCod<>%ld)",
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
FldName,Name,
BldCod);
Cod);
}

View File

@ -41,7 +41,9 @@ unsigned Bld_DB_GetListBuildings (MYSQL_RES **mysql_res,
Bld_WhichData_t WhichData,
Bld_Order_t SelectedOrder);
unsigned Bld_DB_GetBuildingDataByCod (MYSQL_RES **mysql_res,long BldCod);
bool Bld_DB_CheckIfBuildingNameExists (const char *FldName,const char *Name,long BldCod);
bool Bld_DB_CheckIfBuildingNameExists (const char *FldName,const char *Name,long Cod,
__attribute__((unused)) long PrtCod,
__attribute__((unused)) unsigned Year);
void Bld_DB_UpdateBuildingName (long BldCod,const char *FldName,const char *NewBuildingName);

View File

@ -1064,7 +1064,7 @@ void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFullName)
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_center_X_already_exists;
extern const char *Txt_X_already_exists;
extern const char *Txt_The_center_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed;
char *CurrentName[Nam_NUM_SHRT_FULL_NAMES] =
@ -1093,10 +1093,9 @@ void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFullName)
/***** If degree was in database... *****/
if (Ctr_DB_CheckIfCtrNameExistsInIns (Nam_ParShrtOrFullName[ShrtOrFullName],
NewName,Ctr->HieCod,
Gbl.Hierarchy.Node[Hie_INS].HieCod))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_center_X_already_exists,
NewName);
Gbl.Hierarchy.Node[Hie_INS].HieCod,
0)) // Unused
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
else
{
/* Update the table changing old name by new name */
@ -1475,16 +1474,12 @@ void Ctr_ReceiveFormNewCtr (void)
static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
{
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_center_X_already_exists;
extern const char *Txt_Created_new_center_X;
Nam_ShrtOrFullName_t ShrtOrFullName;
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
{
[Nam_SHRT_NAME] = Ctr_EditingCtr->ShrtName,
[Nam_FULL_NAME] = Ctr_EditingCtr->FullName,
};
bool Exists;
/***** Get parameters from form *****/
/* Set center institution */
@ -1505,19 +1500,9 @@ static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
if (Ctr_EditingCtr->WWW[0])
{
/***** If name of center was in database... *****/
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
ShrtOrFullName++)
if (Ctr_DB_CheckIfCtrNameExistsInIns (Nam_FldShrtOrFullName[ShrtOrFullName],
Names[ShrtOrFullName],-1L,
Gbl.Hierarchy.Node[Hie_INS].HieCod))
{
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_center_X_already_exists,
Names[ShrtOrFullName]);
Exists = true;
}
if (!Exists) // Add new center to database
if (!Nam_CheckIfNameExists (Ctr_DB_CheckIfCtrNameExistsInIns,Names,
-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod,
0)) // Unused
{
Ctr_EditingCtr->HieCod = Ctr_DB_CreateCenter (Ctr_EditingCtr,Status);
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_center_X,

View File

@ -1015,13 +1015,9 @@ void CtrCfg_ChangeCtrPhotoAttr (void)
void CtrCfg_ChangeCtrIns (void)
{
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_center_X_already_exists;
extern const char *Txt_The_center_X_has_been_moved_to_the_institution_Y;
struct Hie_Node NewIns;
Nam_ShrtOrFullName_t ShrtOrFullName;
bool Exists;
char *Name[Nam_NUM_SHRT_FULL_NAMES] =
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
{
[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CTR].ShrtName,
[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_CTR].FullName,
@ -1037,20 +1033,9 @@ void CtrCfg_ChangeCtrIns (void)
Ins_GetInstitDataByCod (&NewIns);
/***** Check if it already exists a center with the same name in the new institution *****/
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
ShrtOrFullName++)
if (Ctr_DB_CheckIfCtrNameExistsInIns (Nam_FldShrtOrFullName[ShrtOrFullName],
Name[ShrtOrFullName],
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
NewIns.HieCod))
{
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_center_X_already_exists,
Name[ShrtOrFullName]);
Exists = true;
}
if (!Exists)
if (!Nam_CheckIfNameExists (Ctr_DB_CheckIfCtrNameExistsInIns,Names,
Gbl.Hierarchy.Node[Hie_CTR].HieCod,NewIns.HieCod,
0)) // Unused
{
/***** Update institution in table of centers *****/
Ctr_DB_UpdateCtrIns (Gbl.Hierarchy.Node[Hie_CTR].HieCod,NewIns.HieCod);

View File

@ -297,7 +297,8 @@ unsigned Ctr_DB_GetPhotoAttribution (MYSQL_RES **mysql_res,long CtrCod)
/*****************************************************************************/
bool Ctr_DB_CheckIfCtrNameExistsInIns (const char *FldName,const char *Name,
long CtrCod,long InsCod)
long Cod,long PrtCod,
__attribute__((unused)) unsigned Year)
{
return
DB_QueryEXISTS ("can not check if the name of a center already existed",
@ -307,10 +308,9 @@ bool Ctr_DB_CheckIfCtrNameExistsInIns (const char *FldName,const char *Name,
" WHERE InsCod=%ld"
" AND %s='%s'"
" AND CtrCod<>%ld)",
InsCod,
FldName,
Name,
CtrCod);
PrtCod,
FldName,Name,
Cod);
}
/*****************************************************************************/

View File

@ -51,7 +51,8 @@ long Ctr_DB_GetInsCodOfCenterByCod (long CtrCod);
void Ctr_DB_GetShortNameOfCenterByCod (long CtrCod,char ShrtName[Nam_MAX_BYTES_SHRT_NAME + 1]);
unsigned Ctr_DB_GetPhotoAttribution (MYSQL_RES **mysql_res,long CtrCod);
bool Ctr_DB_CheckIfCtrNameExistsInIns (const char *FldName,const char *Name,
long CtrCod,long InsCod);
long Cod,long PrtCod,
__attribute__((unused)) unsigned Year);
unsigned Ctr_DB_SearchCtrs (MYSQL_RES **mysql_res,
const char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY + 1],

View File

@ -633,12 +633,13 @@ Me sale este error, no s
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/
#define Log_PLATFORM_VERSION "SWAD 23.33.1 (2023-10-10)"
#define Log_PLATFORM_VERSION "SWAD 23.33.2 (2023-10-10)"
#define CSS_FILE "swad23.25.2.css"
#define JS_FILE "swad22.49.js"
/*
// TODO: Donde aparezca Txt_X_already_exists cambiar por la función nueva Nam_...
Version 23.33.2: Oct 10, 2023 Code refactoring in short and full names. Not finished. (335661 lines)
Version 23.33.1: Oct 10, 2023 Code refactoring in short and full names. Not finished. (335930 lines)
Version 23.33: Oct 10, 2023 Code refactoring in short and full names. (335919 lines)
Version 23.32: Oct 10, 2023 Code refactoring in short and full names. (336110 lines)

View File

@ -1248,13 +1248,9 @@ void Crs_ReceiveFormNewCrs (void)
static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
{
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_course_X_already_exists;
extern const char *Txt_Created_new_course_X;
extern const char *Txt_The_year_X_is_not_allowed;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
Nam_ShrtOrFullName_t ShrtOrFullName;
bool Exists;
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
{
[Nam_SHRT_NAME] = Crs_EditingCrs->ShrtName,
@ -1275,21 +1271,10 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
if (Crs_EditingCrs->ShrtName[0] &&
Crs_EditingCrs->FullName[0]) // If there's a course name
{
/***** If name of course was in database... *****/
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
ShrtOrFullName++)
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Nam_FldShrtOrFullName[ShrtOrFullName],
Names[ShrtOrFullName],
-1L,Crs_EditingCrs->PrtCod,
Crs_EditingCrs->Specific.Year))
{
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_course_X_already_exists,
Names[ShrtOrFullName]);
Exists = true;
}
if (!Exists) // Add new requested course to database
/***** If name of course was not in database... *****/
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,Names,
-1L,Crs_EditingCrs->PrtCod,
Crs_EditingCrs->Specific.Year))
{
Crs_DB_CreateCourse (Crs_EditingCrs,Status);
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_course_X,
@ -1612,15 +1597,11 @@ void Crs_ChangeInsCrsCod (void)
void Crs_ChangeCrsYear (void)
{
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_course_X_already_exists_in_year_Y;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_The_year_of_the_course_X_has_changed;
extern const char *Txt_The_year_X_is_not_allowed;
char YearStr[2 + 1];
unsigned NewYear;
Nam_ShrtOrFullName_t ShrtOrFullName;
bool Exists;
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
{
[Nam_SHRT_NAME] = Crs_EditingCrs->ShrtName,
@ -1645,20 +1626,9 @@ void Crs_ChangeCrsYear (void)
if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
{
/***** If name of course was in database in the new year... *****/
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
ShrtOrFullName++)
{
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Nam_FldShrtOrFullName[ShrtOrFullName],
Names[ShrtOrFullName],
-1L,Crs_EditingCrs->PrtCod,NewYear))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_course_X_already_exists_in_year_Y,
Names[ShrtOrFullName],Txt_YEAR_OF_DEGREE[NewYear]);
Exists = true;
}
if (!Exists) // Update year in database
/***** If name of course was not in database in the new year... *****/
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,Names,
-1L,Crs_EditingCrs->PrtCod,NewYear))
{
/***** Update year in table of courses *****/
Crs_UpdateCrsYear (Crs_EditingCrs,NewYear);
@ -1735,7 +1705,7 @@ void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFullName)
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_course_X_already_exists;
extern const char *Txt_X_already_exists;
extern const char *Txt_The_course_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed;
char *CurrentName[Nam_NUM_SHRT_FULL_NAMES] =
@ -1765,9 +1735,7 @@ void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFullName)
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Nam_ParShrtOrFullName[ShrtOrFullName],
NewName,Crs->HieCod,
Crs->PrtCod,Crs->Specific.Year))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_course_X_already_exists,
NewName);
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
else
{
/* Update the table changing old name by new name */

View File

@ -458,13 +458,9 @@ static void CrsCfg_Indicators (void)
void CrsCfg_ChangeCrsDeg (void)
{
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_The_course_X_has_been_moved_to_the_degree_Y;
struct Hie_Node NewDeg;
Nam_ShrtOrFullName_t ShrtOrFullName;
bool Exists;
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
{
[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CRS].ShrtName,
@ -480,21 +476,10 @@ void CrsCfg_ChangeCrsDeg (void)
/***** Get data of new degree *****/
Deg_GetDegreeDataByCod (&NewDeg);
/***** If name of course was in database in the new degree... *****/
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
ShrtOrFullName++)
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Nam_FldShrtOrFullName[ShrtOrFullName],
Names[ShrtOrFullName],-1L,
NewDeg.HieCod,Gbl.Hierarchy.Node[Hie_CRS].Specific.Year))
{
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Node[Hie_CRS].Specific.Year],
NewDeg.FullName,Names[ShrtOrFullName]);
Exists = true;
}
if (!Exists) // Update degree in database
/***** If name of course was not in database in the new degree... *****/
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,Names,
-1L,NewDeg.HieCod,
Gbl.Hierarchy.Node[Hie_CRS].Specific.Year))
{
/***** Update degree in table of courses *****/
Crs_DB_UpdateCrsDeg (Gbl.Hierarchy.Node[Hie_CRS].HieCod,NewDeg.HieCod);
@ -533,15 +518,11 @@ void CrsCfg_RenameCourseFull (void)
void CrsCfg_ChangeCrsYear (void)
{
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_course_X_already_exists_in_year_Y;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_The_year_of_the_course_X_has_changed;
extern const char *Txt_The_year_X_is_not_allowed;
char YearStr[2 + 1];
unsigned NewYear;
Nam_ShrtOrFullName_t ShrtOrFullName;
bool Exists;
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
{
[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CRS].ShrtName,
@ -554,20 +535,9 @@ void CrsCfg_ChangeCrsYear (void)
if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
{
/***** If name of course was in database in the new year... *****/
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
ShrtOrFullName++)
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Nam_FldShrtOrFullName[ShrtOrFullName],
Names[ShrtOrFullName],-1L,
Gbl.Hierarchy.Node[Hie_CRS].PrtCod,NewYear))
{
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_course_X_already_exists_in_year_Y,
Names[ShrtOrFullName],Txt_YEAR_OF_DEGREE[NewYear]);
Exists = true;
}
if (!Exists) // Update year in database
/***** If name of course was not in database in the new year... *****/
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,Names,
-1L,Gbl.Hierarchy.Node[Hie_CRS].PrtCod,NewYear))
{
/***** Update year in table of courses *****/
Crs_UpdateCrsYear (&Gbl.Hierarchy.Node[Hie_CRS],NewYear);

View File

@ -213,7 +213,7 @@ bool Crs_DB_CheckIfCrsCodExists (long CrsCod)
/*****************************************************************************/
bool Crs_DB_CheckIfCrsNameExistsInYearOfDeg (const char *FldName,const char *Name,
long CrsCod,long DegCod,unsigned Year)
long Cod,long PrtCod,unsigned Year)
{
return
DB_QueryEXISTS ("can not check if the name of a course already existed",
@ -224,11 +224,10 @@ bool Crs_DB_CheckIfCrsNameExistsInYearOfDeg (const char *FldName,const char *Nam
" AND Year=%u"
" AND %s='%s'"
" AND CrsCod<>%ld)",
DegCod,
PrtCod,
Year,
FldName,
Name,
CrsCod);
FldName,Name,
Cod);
}
/*****************************************************************************/

View File

@ -47,7 +47,7 @@ void Crs_DB_GetShortNamesByCod (long CrsCod,
char DegShortName[Nam_MAX_BYTES_SHRT_NAME + 1]);
bool Crs_DB_CheckIfCrsCodExists (long CrsCod);
bool Crs_DB_CheckIfCrsNameExistsInYearOfDeg (const char *FldName,const char *Name,
long CrsCod,long DegCod,unsigned Year);
long Cod,long PrtCod,unsigned Year);
unsigned Crs_DB_GetCrssOfAUsr (MYSQL_RES **mysql_res,long UsrCod,Rol_Role_t Role);
unsigned Crs_DB_GetOldCrss (MYSQL_RES **mysql_res,unsigned long SecondsWithoutAccess);

View File

@ -1045,11 +1045,7 @@ void Deg_ReceiveFormNewDeg (void)
static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
{
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_degree_X_already_exists;
extern const char *Txt_Created_new_degree_X;
Nam_ShrtOrFullName_t ShrtOrFullName;
bool Exists;
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
{
[Nam_SHRT_NAME] = Deg_EditingDeg->ShrtName,
@ -1074,20 +1070,10 @@ static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
{
if (Deg_EditingDeg->WWW[0])
{
/***** If name of degree was in database... *****/
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
ShrtOrFullName++)
if (Deg_DB_CheckIfDegNameExistsInCtr (Nam_FldShrtOrFullName[ShrtOrFullName],
Names[ShrtOrFullName],
-1L,Deg_EditingDeg->PrtCod))
{
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_degree_X_already_exists,
Names[ShrtOrFullName]);
Exists = true;
}
if (!Exists) // Add new degree to database
/***** If name of degree was not in database... *****/
if (!Nam_CheckIfNameExists (Deg_DB_CheckIfDegNameExistsInCtr,Names,
-1L,Deg_EditingDeg->PrtCod,
0)) // Unused
{
Deg_DB_CreateDegree (Deg_EditingDeg,Status);
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_degree_X,
@ -1302,7 +1288,7 @@ void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFullName)
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_degree_X_already_exists;
extern const char *Txt_X_already_exists;
extern const char *Txt_The_degree_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed;
char *CurrentName[Nam_NUM_SHRT_FULL_NAMES] =
@ -1328,9 +1314,9 @@ void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFullName)
{
/***** If degree was in database... *****/
if (Deg_DB_CheckIfDegNameExistsInCtr (Nam_ParShrtOrFullName[ShrtOrFullName],
NewName,Deg->HieCod,Deg->PrtCod))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_degree_X_already_exists,NewName);
NewName,Deg->HieCod,Deg->PrtCod,
0)) // Unused
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
else
{
/* Update the table changing old name by new name */

View File

@ -348,12 +348,8 @@ static void DegCfg_NumCrss (void)
void DegCfg_ChangeDegCtr (void)
{
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_degree_X_already_exists;
extern const char *Txt_The_degree_X_has_been_moved_to_the_center_Y;
struct Hie_Node NewCtr;
Nam_ShrtOrFullName_t ShrtOrFullName;
bool Exists;
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
{
[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_DEG].ShrtName,
@ -369,20 +365,10 @@ void DegCfg_ChangeDegCtr (void)
/***** Get data of new center *****/
Ctr_GetCenterDataByCod (&NewCtr);
/***** Check if it already exists a degree with the same name in the new center *****/
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
ShrtOrFullName++)
if (Deg_DB_CheckIfDegNameExistsInCtr (Nam_FldShrtOrFullName[ShrtOrFullName],
Names[ShrtOrFullName],
Gbl.Hierarchy.Node[Hie_DEG].HieCod,
NewCtr.HieCod))
{
Ale_CreateAlert (Ale_WARNING,Txt_The_degree_X_already_exists,
Names[ShrtOrFullName]);
Exists = true;
}
if (Exists)
/***** Check if it already existed a degree with the same name in the new center *****/
if (!Nam_CheckIfNameExists (Deg_DB_CheckIfDegNameExistsInCtr,Names,
Gbl.Hierarchy.Node[Hie_DEG].HieCod,NewCtr.HieCod,
0)) // Unused
{
/***** Update center in table of degrees *****/
Deg_DB_UpdateDegCtr (Gbl.Hierarchy.Node[Hie_DEG].HieCod,NewCtr.HieCod);

View File

@ -517,7 +517,8 @@ unsigned Deg_DB_GetDegsWithStds (MYSQL_RES **mysql_res)
/*****************************************************************************/
bool Deg_DB_CheckIfDegNameExistsInCtr (const char *FldName,const char *Name,
long DegCod,long CtrCod)
long Cod,long PrtCod,
__attribute__((unused)) unsigned Year)
{
return
DB_QueryEXISTS ("can not check if the name of a degree already existed",
@ -527,9 +528,9 @@ bool Deg_DB_CheckIfDegNameExistsInCtr (const char *FldName,const char *Name,
" WHERE CtrCod=%ld"
" AND %s='%s'"
" AND DegCod<>%ld)",
CtrCod,
PrtCod,
FldName,Name,
DegCod);
Cod);
}
/*****************************************************************************/

View File

@ -56,7 +56,8 @@ unsigned Deg_DB_GetDegsOfCurrentCtrFull (MYSQL_RES **mysql_res);
unsigned Deg_DB_GetDegsWithPendingCrss (MYSQL_RES **mysql_res);
unsigned Deg_DB_GetDegsWithStds (MYSQL_RES **mysql_res);
bool Deg_DB_CheckIfDegNameExistsInCtr (const char *FldName,const char *Name,
long DegCod,long CtrCod);
long Cod,long PrtCod,
__attribute__((unused)) unsigned Year);
unsigned Deg_DB_SearchDegs (MYSQL_RES **mysql_res,
const char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY + 1],

View File

@ -673,7 +673,7 @@ static void Dpt_RenameDepartment (Nam_ShrtOrFullName_t ShrtOrFullName)
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_department_X_already_exists;
extern const char *Txt_X_already_exists;
extern const char *Txt_The_department_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed;
char *CurrentName[Nam_NUM_SHRT_FULL_NAMES] =
@ -700,12 +700,12 @@ static void Dpt_RenameDepartment (Nam_ShrtOrFullName_t ShrtOrFullName)
(this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
{
/***** If degree was in database... *****/
/***** If name department was not in database... *****/
if (Dpt_DB_CheckIfDepartmentNameExists (Nam_ParShrtOrFullName[ShrtOrFullName],
NewName,Dpt_EditingDpt->DptCod))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_department_X_already_exists,
NewName);
NewName,Dpt_EditingDpt->DptCod,
-1L, // Unused
0)) // Unused
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
else
{
/* Update the table changing old name by new name */
@ -895,11 +895,7 @@ static void Dpt_PutHeadDepartments (void)
void Dpt_ReceiveFormNewDpt (void)
{
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_The_department_X_already_exists;
extern const char *Txt_Created_new_department_X;
Nam_ShrtOrFullName_t ShrtOrFullName;
bool Exists;
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
{
[Nam_SHRT_NAME] = Dpt_EditingDpt->ShrtName,
@ -924,19 +920,11 @@ void Dpt_ReceiveFormNewDpt (void)
{
if (Dpt_EditingDpt->WWW[0])
{
/***** If name of department was in database... *****/
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
ShrtOrFullName++)
if (Dpt_DB_CheckIfDepartmentNameExists (Nam_FldShrtOrFullName[ShrtOrFullName],
Names[ShrtOrFullName],-1L))
{
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_department_X_already_exists,
Names[ShrtOrFullName]);
Exists = true;
}
if (!Exists) // Add new department to database
/***** If name of department was not in database... *****/
if (!Nam_CheckIfNameExists (Dpt_DB_CheckIfDepartmentNameExists,Names,
-1L,
-1L, // Unused
0)) // Unused
{
Dpt_DB_CreateDepartment (Dpt_EditingDpt);
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_department_X,

View File

@ -151,7 +151,9 @@ unsigned Dpt_DB_GetDepartmentDataByCod (MYSQL_RES **mysql_res,long DptCod)
/******************* Check if the name of department exists ******************/
/*****************************************************************************/
bool Dpt_DB_CheckIfDepartmentNameExists (const char *FldName,const char *Name,long DptCod)
bool Dpt_DB_CheckIfDepartmentNameExists (const char *FldName,const char *Name,long Cod,
__attribute__((unused)) long PrtCod,
__attribute__((unused)) unsigned Year)
{
return
DB_QueryEXISTS ("can not check if the department name already existed",
@ -161,7 +163,7 @@ bool Dpt_DB_CheckIfDepartmentNameExists (const char *FldName,const char *Name,lo
" WHERE %s='%s'"
" AND DptCod<>%ld)",
FldName,Name,
DptCod);
Cod);
}
/*****************************************************************************/

View File

@ -41,7 +41,9 @@ void Dpt_DB_CreateDepartment (const struct Dpt_Department *Dpt);
unsigned Dpt_DB_GetListDepartments (MYSQL_RES **mysql_res,
long InsCod,Dpt_Order_t SelectedOrder);
unsigned Dpt_DB_GetDepartmentDataByCod (MYSQL_RES **mysql_res,long DptCod);
bool Dpt_DB_CheckIfDepartmentNameExists (const char *FldName,const char *Name,long DptCod);
bool Dpt_DB_CheckIfDepartmentNameExists (const char *FldName,const char *Name,long Cod,
__attribute__((unused)) long PrtCod,
__attribute__((unused)) unsigned Year);
unsigned Dpt_DB_GetNumDepartmentsInInstitution (long InsCod);
unsigned Dpt_DB_GetNumTchsCurrentInsInDepartment (long DptCod);

View File

@ -46840,29 +46840,6 @@ const char *Txt_The_banner_X_has_been_renamed_as_Y = // Warning: it is very impo
"The banner <strong>%s</strong> has been renamed as <strong>%s</strong>."; // Çeviri lazim!
#endif
const char *Txt_The_building_X_already_exists = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"L'edifici <strong>%s</strong> ja existeix.";
#elif L==2 // de
"Das Geb&auml;ude <strong>%s</strong> wurde bereits eingegeben.";
#elif L==3 // en
"The building <strong>%s</strong> already exists.";
#elif L==4 // es
"El edificio <strong>%s</strong> ya existe.";
#elif L==5 // fr
"Le b&acirc;timent <strong>%s</strong> existe d&eacute;j&agrave;.";
#elif L==6 // gn
"El edificio <strong>%s</strong> ya existe."; // Okoteve traducción
#elif L==7 // it
"L'edificio <strong>%s</strong> gi&agrave; esiste.";
#elif L==8 // pl
"Budynek <strong>%s</strong> ju&zdot; istnieje.";
#elif L==9 // pt
"O edif&iacute;cio <strong>%s</strong> j&aacute; existe.";
#elif L==10 // tr
"The building <strong>%s</strong> already exists."; // Çeviri lazim!
#endif
const char *Txt_The_building_X_has_been_renamed_as_Y = // Warning: it is very important to include two %s in the following sentences
#if L==1 // ca
"L'edifici <strong>%s</strong> ha passat a anomenar-se <strong>%s</strong>.";
@ -47001,29 +46978,6 @@ const char *Txt_The_capacity_of_room_X_is_now_Y = // Warning: it is very importa
"The capacity of room <strong>%s</strong> is now <strong>%u</strong>."; // Çeviri lazim!
#endif
const char *Txt_The_center_X_already_exists = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"El centre <strong>%s</strong> ja existeix.";
#elif L==2 // de
"Das Zentrum <strong>%s</strong> existiert bereits.";
#elif L==3 // en
"The center <strong>%s</strong> already exists.";
#elif L==4 // es
"El centro <strong>%s</strong> ya existe.";
#elif L==5 // fr
"Le centre <strong>%s</strong> existe d&eacute;j&agrave;.";
#elif L==6 // gn
"El centro <strong>%s</strong> ya existe."; // Okoteve traducción
#elif L==7 // it
"Il centro <strong>%s</strong> gi&agrave; esiste.";
#elif L==8 // pl
"Centrum <strong>%s</strong> ju&zdot; istnieje.";
#elif L==9 // pt
"O centro <strong>%s</strong> j&aacute; existe.";
#elif L==10 // tr
"The center <strong>%s</strong> already exists."; // Çeviri lazim!
#endif
const char *Txt_The_center_X_has_been_moved_to_the_institution_Y = // Warning: it is very important to include two %s in the following sentences
#if L==1 // ca
"El centre <strong>%s</strong> s'ha traslladat"
@ -47360,52 +47314,6 @@ const char *Txt_The_country_of_the_institution_X_has_changed_to_Y = // Warning:
" has changed to <strong>%s</strong>."; // Çeviri lazim!
#endif
const char *Txt_The_course_X_already_exists = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"L´assignatura <strong>%s</strong> ja existeix.";
#elif L==2 // de
"Die Kurs <strong>%s</strong> wurde bereits eingegeben.";
#elif L==3 // en
"The course <strong>%s</strong> already exists.";
#elif L==4 // es
"La asignatura <strong>%s</strong> ya existe.";
#elif L==5 // fr
"La mati&egrave;re <strong>%s</strong> existe d&eacute;j&agrave;.";
#elif L==6 // gn
"La asignatura <strong>%s</strong> ya existe."; // Okoteve traducción
#elif L==7 // it
"Il corso <strong>%s</strong> gi&agrave; esiste.";
#elif L==8 // pl
"Kurs <strong>%s</strong> ju&zdot; istnieje.";
#elif L==9 // pt
"A disciplina <strong>%s</strong> j&aacute; existe.";
#elif L==10 // tr
"The course <strong>%s</strong> already exists."; // Çeviri lazim!
#endif
const char *Txt_The_course_X_already_exists_in_year_Y = // Warning: it is very important to include two %s in the following sentences
#if L==1 // ca
"L'assignatura <strong>%s</strong> ja existeix a l'any/semestre %s.";
#elif L==2 // de
"Die Kurs <strong>%s</strong> wurde bereits in Studienjahr/Semester %s eingegeben.";
#elif L==3 // en
"The course <strong>%s</strong> already exists in year/semester %s.";
#elif L==4 // es
"La asignatura <strong>%s</strong> ya existe en el a&ntilde;o/semestre %s.";
#elif L==5 // fr
"La mati&egrave;re <strong>%s</strong> existe d&eacute;j&agrave; en ann&eacute;e/semestre %s.";
#elif L==6 // gn
"La asignatura <strong>%s</strong> ya existe en el a&ntilde;o/semestre %s."; // Okoteve traducción
#elif L==7 // it
"Il corso <strong>%s</strong> esiste gi&agrave; nell'anno/semester %s.";
#elif L==8 // pl
"Kurs <strong>%s</strong> istnieje ju&zdot; na roku/semestrze %s.";
#elif L==9 // pt
"A disciplina <strong>%s</strong> j&aacute; existe no ano/semestre %s.";
#elif L==10 // tr
"The course <strong>%s</strong> already exists in year/semester %s."; // Çeviri lazim!
#endif
const char *Txt_The_course_X_has_been_moved_to_the_degree_Y = // Warning: it is very important to include two %s in the following sentences
#if L==1 // ca
"L'assignatura <strong>%s</strong>"
@ -47541,29 +47449,6 @@ const char *Txt_The_date_time_of_opening_of_groups_has_changed =
"The date/time of opening of groups has changed."; // Çeviri lazim!
#endif
const char *Txt_The_degree_X_already_exists = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"La titulaci&oacute; <strong>%s</strong> ja existeix.";
#elif L==2 // de
"Der Studiengang <strong>%s</strong> wurde bereits eingegeben.";
#elif L==3 // en
"The degree <strong>%s</strong> already exists.";
#elif L==4 // es
"La titulaci&oacute;n <strong>%s</strong> ya existe.";
#elif L==5 // fr
"L'&eacute;tude <strong>%s</strong> existe d&eacute;j&agrave;.";
#elif L==6 // gn
"La titulaci&oacute;n <strong>%s</strong> ya existe."; // Okoteve traducción
#elif L==7 // it
"La laurea <strong>%s</strong> gi&agrave; esiste.";
#elif L==8 // pl
"Stopie&nacute; <strong>%s</strong> ju&zdot; istnieje.";
#elif L==9 // pt
"O grau <strong>%s</strong> j&aacute; existe.";
#elif L==10 // tr
"The degree <strong>%s</strong> already exists."; // Çeviri lazim!
#endif
const char *Txt_The_degree_X_has_been_moved_to_the_center_Y = // Warning: it is very important to include two %s in the following sentences
#if L==1 // ca
"La titulaci&oacute; <strong>%s</strong> s'ha traslladat"
@ -47630,29 +47515,6 @@ const char *Txt_The_degree_X_has_been_renamed_as_Y = // Warning: it is very impo
" has been renamed as <strong>%s</strong>."; // Çeviri lazim!
#endif
const char *Txt_The_department_X_already_exists = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"El departament <strong>%s</strong> ja existeix.";
#elif L==2 // de
"Die Abteilung <strong>%s</strong> wurde bereits eingegeben.";
#elif L==3 // en
"The department <strong>%s</strong> already exists.";
#elif L==4 // es
"El departamento <strong>%s</strong> ya existe.";
#elif L==5 // fr
"The department <strong>%s</strong> already exists."; // Besoin de traduction
#elif L==6 // gn
"El departamento <strong>%s</strong> ya existe."; // Okoteve traducción
#elif L==7 // it
"IL dipartimento <strong>%s</strong> esiste gi&agrave;.";
#elif L==8 // pl
"The department <strong>%s</strong> already exists."; // Potrzebujesz tlumaczenie
#elif L==9 // pt
"O departamento <strong>%s</strong> j&aacute; existe.";
#elif L==10 // tr
"The department <strong>%s</strong> already exists."; // Çeviri lazim!
#endif
const char *Txt_The_department_X_has_been_renamed_as_Y = // Warning: it is very important to include two %s in the following sentences
#if L==1 // ca
"El departament <strong>%s</strong>"