mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-08 01:35:32 +02:00
Version 23.32: Oct 10, 2023 Code refactoring in short and full names.
This commit is contained in:
parent
8e0f439181
commit
19e5daff04
|
@ -623,8 +623,7 @@ static void Ban_RenameBanner (struct Ban_Banner *Ban,
|
|||
Ban->BanCod = ParCod_GetAndCheckPar (ParCod_Ban);
|
||||
|
||||
/* Get the new name for the banner */
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,NewName);
|
||||
|
||||
/***** Get banner data from the database *****/
|
||||
Ban_GetBannerDataByCod (Ban);
|
||||
|
@ -879,9 +878,7 @@ static void Ban_PutHeadBanners (void)
|
|||
|
||||
void Ban_ReceiveFormNewBanner (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_banner_X_already_exists;
|
||||
extern const char *Txt_You_must_specify_the_image_of_the_new_banner;
|
||||
extern const char *Txt_You_must_specify_the_web_address;
|
||||
|
@ -889,7 +886,7 @@ void Ban_ReceiveFormNewBanner (void)
|
|||
struct Ban_Banner *Ban = Ban_GetEditingBanner ();
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
char *Names[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Ban->ShrtName,
|
||||
[Cns_FULL_NAME] = Ban->FullName,
|
||||
|
@ -899,12 +896,7 @@ void Ban_ReceiveFormNewBanner (void)
|
|||
Ban_ResetBanner (Ban);
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParsShrtAndFullName (Names);
|
||||
Par_GetParText ("Img",Ban->Img,Ban_MAX_BYTES_IMAGE);
|
||||
Par_GetParText ("WWW",Ban->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
|
@ -916,11 +908,11 @@ void Ban_ReceiveFormNewBanner (void)
|
|||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Ban_DB_CheckIfBannerNameExists (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L))
|
||||
Names[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_banner_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists)
|
||||
|
|
|
@ -563,8 +563,7 @@ static void Bld_RenameBuilding (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
Bld_EditingBuilding->BldCod = ParCod_GetAndCheckPar (ParCod_Bld);
|
||||
|
||||
/* Get the new name for the building */
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,NewName);
|
||||
|
||||
/***** Get from the database the old names of the building *****/
|
||||
Bld_GetBuildingDataByCod (Bld_EditingBuilding);
|
||||
|
@ -758,14 +757,12 @@ static void Bld_PutHeadBuildings (void)
|
|||
|
||||
void Bld_ReceiveFormNewBuilding (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_building_X_already_exists;
|
||||
extern const char *Txt_Created_new_building_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
char *Names[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Bld_EditingBuilding->ShrtName,
|
||||
[Cns_FULL_NAME] = Bld_EditingBuilding->FullName,
|
||||
|
@ -776,12 +773,7 @@ void Bld_ReceiveFormNewBuilding (void)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get building short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParsShrtAndFullName (Names);
|
||||
|
||||
/* Get building location */
|
||||
Par_GetParText ("Location",Bld_EditingBuilding->Location,Bld_MAX_BYTES_LOCATION);
|
||||
|
@ -794,11 +786,11 @@ void Bld_ReceiveFormNewBuilding (void)
|
|||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Bld_DB_CheckIfBuildingNameExists (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L))
|
||||
Names[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_building_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new building to database
|
||||
|
|
|
@ -1076,8 +1076,7 @@ void Ctr_RenameCenter (struct Hie_Node *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the new name for the center */
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,NewName);
|
||||
|
||||
/***** Get from the database the old names of the center *****/
|
||||
Ctr_GetCenterDataByCod (Ctr);
|
||||
|
@ -1494,13 +1493,11 @@ void Ctr_ReceiveFormNewCtr (void)
|
|||
|
||||
static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_center_X_already_exists;
|
||||
extern const char *Txt_Created_new_center_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
char *Names[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Ctr_EditingCtr->ShrtName,
|
||||
[Cns_FULL_NAME] = Ctr_EditingCtr->FullName,
|
||||
|
@ -1515,12 +1512,7 @@ static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
|
|||
Ctr_EditingCtr->Specific.PlcCod = ParCod_GetAndCheckParMin (ParCod_Plc,0); // 0 (another place) is allowed here
|
||||
|
||||
/* Get center short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParsShrtAndFullName (Names);
|
||||
|
||||
/* Get center WWW */
|
||||
Par_GetParText ("WWW",Ctr_EditingCtr->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
@ -1535,12 +1527,12 @@ static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
|
|||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Ctr_DB_CheckIfCtrNameExistsInIns (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L,
|
||||
Names[ShrtOrFullName],-1L,
|
||||
Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_center_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new center to database
|
||||
|
|
|
@ -632,10 +632,11 @@ TODO: Francisco Javier Fern
|
|||
Me sale este error, no sé si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
|
||||
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.31 (2023-10-10)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.32 (2023-10-10)"
|
||||
#define CSS_FILE "swad23.25.2.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 23.32: Oct 10, 2023 Code refactoring in short and full names. (336110 lines)
|
||||
Version 23.31: Oct 10, 2023 Code refactoring in short and full names. (336169 lines)
|
||||
Version 23.30: Oct 09, 2023 Code refactoring in short and full names. (336293 lines)
|
||||
Version 23.29: Oct 07, 2023 Code refactoring in short and full names. (336131 lines)
|
||||
|
|
|
@ -1332,11 +1332,8 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
|
|||
|
||||
static void Crs_GetParsNewCourse (struct Hie_Node *Crs)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
char YearStr[2 + 1];
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
char *Names[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Crs->ShrtName,
|
||||
[Cns_FULL_NAME] = Crs->FullName,
|
||||
|
@ -1351,12 +1348,7 @@ static void Crs_GetParsNewCourse (struct Hie_Node *Crs)
|
|||
Par_GetParText ("InsCrsCod",Crs->InstitutionalCod,Hie_MAX_BYTES_INSTITUTIONAL_COD);
|
||||
|
||||
/* Get course short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParsShrtAndFullName (Names);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1777,8 +1769,7 @@ void Crs_RenameCourse (struct Hie_Node *Crs,Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the new name for the course */
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,NewName);
|
||||
|
||||
/***** Get from the database the data of the degree *****/
|
||||
Crs_GetCourseDataByCod (Crs);
|
||||
|
|
|
@ -1063,14 +1063,12 @@ void Deg_ReceiveFormNewDeg (void)
|
|||
|
||||
static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_degree_X_already_exists;
|
||||
extern const char *Txt_Created_new_degree_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
char *Names[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Deg_EditingDeg->ShrtName,
|
||||
[Cns_FULL_NAME] = Deg_EditingDeg->FullName,
|
||||
|
@ -1081,12 +1079,7 @@ static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
|
|||
Deg_EditingDeg->PrtCod = Gbl.Hierarchy.Node[Hie_CTR].HieCod;
|
||||
|
||||
/* Get degree short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParsShrtAndFullName (Names);
|
||||
|
||||
/* Get degree type */
|
||||
Deg_EditingDeg->Specific.TypCod = ParCod_GetAndCheckPar (ParCod_OthDegTyp);
|
||||
|
@ -1104,12 +1097,12 @@ static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
|
|||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Deg_DB_CheckIfDegNameExistsInCtr (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],
|
||||
-1L,Deg_EditingDeg->PrtCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_degree_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new degree to database
|
||||
|
@ -1340,8 +1333,7 @@ void Deg_RenameDegree (struct Hie_Node *Deg,Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the new name for the degree */
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,NewName);
|
||||
|
||||
/***** Get data of degree *****/
|
||||
Deg_GetDegreeDataByCod (Deg);
|
||||
|
|
|
@ -688,8 +688,7 @@ static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
Dpt_EditingDpt->DptCod = ParCod_GetAndCheckPar (ParCod_Dpt);
|
||||
|
||||
/* Get the new name for the department */
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,NewName);
|
||||
|
||||
/***** Get from the database the old names of the department *****/
|
||||
Dpt_GetDepartmentDataByCod (Dpt_EditingDpt);
|
||||
|
@ -914,14 +913,12 @@ static void Dpt_PutHeadDepartments (void)
|
|||
|
||||
void Dpt_ReceiveFormNewDpt (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_department_X_already_exists;
|
||||
extern const char *Txt_Created_new_department_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
char *Names[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Dpt_EditingDpt->ShrtName,
|
||||
[Cns_FULL_NAME] = Dpt_EditingDpt->FullName,
|
||||
|
@ -935,12 +932,7 @@ void Dpt_ReceiveFormNewDpt (void)
|
|||
Dpt_EditingDpt->InsCod = ParCod_GetAndCheckPar (ParCod_OthIns);
|
||||
|
||||
/* Get department short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParsShrtAndFullName (Names);
|
||||
|
||||
/* Get department WWW */
|
||||
Par_GetParText ("WWW",Dpt_EditingDpt->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
@ -955,11 +947,11 @@ void Dpt_ReceiveFormNewDpt (void)
|
|||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Dpt_DB_CheckIfDepartmentNameExists (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L))
|
||||
Names[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_department_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new department to database
|
||||
|
|
|
@ -1156,8 +1156,7 @@ void Ins_RenameInstitution (struct Hie_Node *Ins,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get the new name for the institution from form *****/
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,NewName);
|
||||
|
||||
/***** Get from the database the old names of the institution *****/
|
||||
Ins_GetInstitDataByCod (Ins);
|
||||
|
@ -1505,7 +1504,7 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
|
|||
extern const char *Txt_Created_new_institution_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
char *Names[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Ins_EditingIns->ShrtName,
|
||||
[Cns_FULL_NAME] = Ins_EditingIns->FullName,
|
||||
|
@ -1516,12 +1515,7 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
|
|||
Ins_EditingIns->PrtCod = Gbl.Hierarchy.Node[Hie_CTY].HieCod;
|
||||
|
||||
/* Get institution short name, full name and WWW */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParsShrtAndFullName (Names);
|
||||
|
||||
/* Get institution URL */
|
||||
Par_GetParText ("WWW",Ins_EditingIns->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
@ -1536,12 +1530,12 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
|
|||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],
|
||||
-1L,Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new institution to database
|
||||
|
|
16
swad_link.c
16
swad_link.c
|
@ -544,8 +544,7 @@ static void Lnk_RenameLink (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
Lnk_EditingLnk->LnkCod = ParCod_GetAndCheckPar (ParCod_Lnk);
|
||||
|
||||
/* Get the new name for the link */
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,NewName);
|
||||
|
||||
/***** Get link data from the database *****/
|
||||
Lnk_GetLinkDataByCod (Lnk_EditingLnk);
|
||||
|
@ -741,7 +740,7 @@ void Lnk_ReceiveFormNewLink (void)
|
|||
extern const char *Txt_Created_new_link_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
char *Names[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Lnk_EditingLnk->ShrtName,
|
||||
[Cns_FULL_NAME] = Lnk_EditingLnk->FullName,
|
||||
|
@ -752,12 +751,7 @@ void Lnk_ReceiveFormNewLink (void)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get link short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParsShrtAndFullName (Names);
|
||||
|
||||
/* Get link URL */
|
||||
Par_GetParText ("WWW",Lnk_EditingLnk->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
@ -770,11 +764,11 @@ void Lnk_ReceiveFormNewLink (void)
|
|||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Lnk_DB_CheckIfLinkNameExists (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L))
|
||||
Names[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_link_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists)
|
||||
|
|
|
@ -908,6 +908,29 @@ unsigned Par_GetParText (const char *ParName,char *ParValue,size_t MaxBytes)
|
|||
Str_REMOVE_SPACES);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Get short name and full name ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Par_GetParsShrtAndFullName (char *Names[Cns_NUM_SHRT_FULL_NAMES])
|
||||
{
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,Names[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
void Par_GetParShrtOrFullName (Cns_ShrtOrFullName_t ShrtOrFullName,char *Name)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],Name,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get the unsigned value of a parameter ********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -82,6 +82,8 @@ void Par_GetMainPars (void);
|
|||
|
||||
//------------------------------ Get parameters -------------------------------
|
||||
unsigned Par_GetParText (const char *ParName,char *ParValue,size_t MaxBytes);
|
||||
void Par_GetParsShrtAndFullName (char *Names[Cns_NUM_SHRT_FULL_NAMES]);
|
||||
void Par_GetParShrtOrFullName (Cns_ShrtOrFullName_t ShrtOrFullName,char *Name);
|
||||
unsigned long Par_GetParUnsignedLong (const char *ParName,
|
||||
unsigned long Min,
|
||||
unsigned long Max,
|
||||
|
|
25
swad_place.c
25
swad_place.c
|
@ -597,8 +597,7 @@ static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
Plc_EditingPlc->PlcCod = ParCod_GetAndCheckPar (ParCod_Plc);
|
||||
|
||||
/* Get the new name for the place */
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,NewName);
|
||||
|
||||
/***** Get place old names from database *****/
|
||||
Plc_GetPlaceDataByCod (Plc_EditingPlc);
|
||||
|
@ -611,9 +610,8 @@ static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If place was in database... *****/
|
||||
if (Plc_DB_CheckIfPlaceNameExists (Plc_EditingPlc->PlcCod,
|
||||
Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName))
|
||||
if (Plc_DB_CheckIfPlaceNameExists (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Plc_EditingPlc->PlcCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_place_X_already_exists,
|
||||
NewName);
|
||||
|
@ -744,14 +742,12 @@ static void Plc_PutHeadPlaces (void)
|
|||
|
||||
void Plc_ReceiveFormNewPlace (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_place_X_already_exists;
|
||||
extern const char *Txt_Created_new_place_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
char *Names[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Plc_EditingPlc->ShrtName,
|
||||
[Cns_FULL_NAME] = Plc_EditingPlc->FullName,
|
||||
|
@ -762,12 +758,7 @@ void Plc_ReceiveFormNewPlace (void)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get place short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParsShrtAndFullName (Names);
|
||||
|
||||
if (Plc_EditingPlc->ShrtName[0] &&
|
||||
Plc_EditingPlc->FullName[0]) // If there's a place name
|
||||
|
@ -776,12 +767,12 @@ void Plc_ReceiveFormNewPlace (void)
|
|||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Plc_DB_CheckIfPlaceNameExists (-1L,Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName]))
|
||||
if (Plc_DB_CheckIfPlaceNameExists (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_place_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new place to database
|
||||
|
|
|
@ -149,8 +149,7 @@ unsigned Plc_DB_GetPlaceDataByCod (MYSQL_RES **mysql_res,long PlcCod)
|
|||
/********************** Check if the name of place exists ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Plc_DB_CheckIfPlaceNameExists (long PlcCod,
|
||||
const char *FldName,const char *Name)
|
||||
bool Plc_DB_CheckIfPlaceNameExists (const char *FldName,const char *Name,long PlcCod)
|
||||
{
|
||||
return
|
||||
DB_QueryEXISTS ("can not check if the name of a place already existed",
|
||||
|
|
|
@ -38,8 +38,7 @@ void Plc_DB_UpdatePlcName (long PlcCod,const char *FldName,const char *NewPlcNam
|
|||
|
||||
unsigned Plc_DB_GetListPlaces (MYSQL_RES **mysql_res,Plc_Order_t SelectedOrder);
|
||||
unsigned Plc_DB_GetPlaceDataByCod (MYSQL_RES **mysql_res,long PlcCod);
|
||||
bool Plc_DB_CheckIfPlaceNameExists (long PlcCod,
|
||||
const char *FldName,const char *Name);
|
||||
bool Plc_DB_CheckIfPlaceNameExists (const char *FldName,const char *Name,long PlcCod);
|
||||
|
||||
void Plc_DB_RemovePlace (long PlcCod);
|
||||
|
||||
|
|
18
swad_room.c
18
swad_room.c
|
@ -1082,8 +1082,7 @@ static void Roo_RenameRoom (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
Roo_EditingRoom->RooCod = ParCod_GetAndCheckPar (ParCod_Roo);
|
||||
|
||||
/* Get the new name for the room */
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParShrtOrFullName (ShrtOrFullName,NewName);
|
||||
|
||||
/***** Get from the database the old names of the room *****/
|
||||
Roo_GetRoomDataByCod (Roo_EditingRoom);
|
||||
|
@ -1338,14 +1337,12 @@ static void Roo_PutHeadRooms (void)
|
|||
|
||||
void Roo_ReceiveFormNewRoom (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_room_X_already_exists;
|
||||
extern const char *Txt_Created_new_room_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
char *Names[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Roo_EditingRoom->ShrtName,
|
||||
[Cns_FULL_NAME] = Roo_EditingRoom->FullName,
|
||||
|
@ -1361,12 +1358,7 @@ void Roo_ReceiveFormNewRoom (void)
|
|||
Roo_EditingRoom->Type = Roo_GetParType ();
|
||||
|
||||
/* Get room short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParsShrtAndFullName (Names);
|
||||
|
||||
/* Get seating capacity */
|
||||
Roo_EditingRoom->Capacity = (unsigned)
|
||||
|
@ -1387,10 +1379,10 @@ void Roo_ReceiveFormNewRoom (void)
|
|||
ShrtOrFullName++)
|
||||
if (Roo_DB_CheckIfRoomNameExists (Gbl.Hierarchy.Node[Hie_CTR].HieCod,-1L,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName]))
|
||||
Names[ShrtOrFullName]))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_room_X_already_exists,Name[ShrtOrFullName]);
|
||||
Txt_The_room_X_already_exists,Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new room to database
|
||||
|
|
Loading…
Reference in New Issue
Block a user