Version 23.35: Oct 10, 2023 Fixed bugs in short/full names.

This commit is contained in:
acanas 2023-10-11 00:02:14 +02:00
parent 522962c8a7
commit 48b0c06087
25 changed files with 339 additions and 405 deletions

View File

@ -98,7 +98,7 @@ static void Ban_ShowOrHideBanner (struct Ban_Banner *Ban,
HidVis_HiddenOrVisible_t HiddenOrVisible); HidVis_HiddenOrVisible_t HiddenOrVisible);
static void Ban_RenameBanner (struct Ban_Banner *Ban, static void Ban_RenameBanner (struct Ban_Banner *Ban,
Nam_ShrtOrFullName_t ShrtOrFullName); Nam_ShrtOrFullName_t ShrtOrFull);
static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban); static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban);
static void Ban_PutHeadBanners (void); static void Ban_PutHeadBanners (void);
@ -603,11 +603,11 @@ void Ban_RenameBannerFull (void)
/*****************************************************************************/ /*****************************************************************************/
static void Ban_RenameBanner (struct Ban_Banner *Ban, static void Ban_RenameBanner (struct Ban_Banner *Ban,
Nam_ShrtOrFullName_t ShrtOrFullName) Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_X_already_exists; extern const char *Txt_X_already_exists;
extern const char *Txt_The_banner_X_has_been_renamed_as_Y; extern const char *Txt_The_banner_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
@ -623,7 +623,7 @@ static void Ban_RenameBanner (struct Ban_Banner *Ban,
Ban->BanCod = ParCod_GetAndCheckPar (ParCod_Ban); Ban->BanCod = ParCod_GetAndCheckPar (ParCod_Ban);
/* Get the new name for the banner */ /* Get the new name for the banner */
Nam_GetParShrtOrFullName (ShrtOrFullName,NewName); Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get banner data from the database *****/ /***** Get banner data from the database *****/
Ban_GetBannerDataByCod (Ban); Ban_GetBannerDataByCod (Ban);
@ -635,33 +635,33 @@ static void Ban_RenameBanner (struct Ban_Banner *Ban,
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If banner was in database... *****/ /***** If banner was in database... *****/
if (Ban_DB_CheckIfBannerNameExists (Nam_ParShrtOrFullName[ShrtOrFullName], if (Ban_DB_CheckIfBannerNameExists (Nam_Params[ShrtOrFull],
NewName,Ban->BanCod, NewName,Ban->BanCod,
-1L,0)) // Unused -1L,0)) // Unused
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName); Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
else else
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Ban_DB_UpdateBanName (Ban->BanCod,Nam_FldShrtOrFullName[ShrtOrFullName],NewName); Ban_DB_UpdateBanName (Ban->BanCod,Nam_Fields[ShrtOrFull],NewName);
/* Write message to show the change made */ /* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, 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); CurrentName[ShrtOrFull],NewName);
} }
} }
else // The same name else // The same name
/* Write warning message */ /* 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]); CurrentName[ShrtOrFull]);
} }
/***** Update name *****/ /***** Update name *****/
Str_Copy (CurrentName[ShrtOrFullName],NewName, Str_Copy (CurrentName[ShrtOrFull],NewName,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]); Nam_MaxBytes[ShrtOrFull]);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -773,11 +773,7 @@ void Ban_ContEditAfterChgBan (void)
static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban) static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban)
{ {
const char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Ban->ShrtName,
[Nam_FULL_NAME] = Ban->FullName,
};
/***** Begin form to create *****/ /***** Begin form to create *****/
Frm_BeginFormTable (ActNewBan,NULL,NULL,NULL); Frm_BeginFormTable (ActNewBan,NULL,NULL,NULL);
@ -799,6 +795,8 @@ static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban)
HTM_TD_Empty (1); HTM_TD_Empty (1);
/* Banner short name and full name */ /* Banner short name and full name */
Names[Nam_SHRT_NAME] = Ban->ShrtName;
Names[Nam_FULL_NAME] = Ban->FullName;
Nam_NewShortAndFullNames (Names); Nam_NewShortAndFullNames (Names);
/* Banner image */ /* Banner image */
@ -859,21 +857,19 @@ static void Ban_PutHeadBanners (void)
void Ban_ReceiveFormNewBanner (void) void Ban_ReceiveFormNewBanner (void)
{ {
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_You_must_specify_the_image_of_the_new_banner; extern const char *Txt_You_must_specify_the_image_of_the_new_banner;
extern const char *Txt_You_must_specify_the_web_address; extern const char *Txt_You_must_specify_the_web_address;
extern const char *Txt_Created_new_banner_X; extern const char *Txt_Created_new_banner_X;
struct Ban_Banner *Ban = Ban_GetEditingBanner (); struct Ban_Banner *Ban = Ban_GetEditingBanner ();
char *Names[Nam_NUM_SHRT_FULL_NAMES] = char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Ban->ShrtName,
[Nam_FULL_NAME] = Ban->FullName,
};
/***** Reset banner *****/ /***** Reset banner *****/
Ban_ResetBanner (Ban); Ban_ResetBanner (Ban);
/***** Get parameters from form *****/ /***** Get parameters from form *****/
Names[Nam_SHRT_NAME] = Ban->ShrtName;
Names[Nam_FULL_NAME] = Ban->FullName;
Nam_GetParsShrtAndFullName (Names); Nam_GetParsShrtAndFullName (Names);
Par_GetParText ("Img",Ban->Img,Ban_MAX_BYTES_IMAGE); Par_GetParText ("Img",Ban->Img,Ban_MAX_BYTES_IMAGE);
Par_GetParText ("WWW",Ban->WWW,Cns_MAX_BYTES_WWW); Par_GetParText ("WWW",Ban->WWW,Cns_MAX_BYTES_WWW);
@ -882,7 +878,9 @@ void Ban_ReceiveFormNewBanner (void)
Ban->FullName[0]) // If there's a banner name Ban->FullName[0]) // If there's a banner name
{ {
/***** If name of banner was not in database... *****/ /***** If name of banner was not in database... *****/
if (!Nam_CheckIfNameExists (Ban_DB_CheckIfBannerNameExists,Names,-1L, if (!Nam_CheckIfNameExists (Ban_DB_CheckIfBannerNameExists,
(const char **) Names,
-1L,
-1L, // Unused -1L, // Unused
0)) // Unused 0)) // Unused
{ {

View File

@ -74,7 +74,7 @@ static void Bld_GetBuildingDataFromRow (MYSQL_RES *mysql_res,
static void Bld_ListBuildingsForEdition (const struct Bld_Buildings *Buildings); static void Bld_ListBuildingsForEdition (const struct Bld_Buildings *Buildings);
static void Bld_PutParBldCod (void *BldCod); static void Bld_PutParBldCod (void *BldCod);
static void Bld_RenameBuilding (Nam_ShrtOrFullName_t ShrtOrFullName); static void Bld_RenameBuilding (Nam_ShrtOrFullName_t ShrtOrFull);
static void Bld_PutFormToCreateBuilding (void); static void Bld_PutFormToCreateBuilding (void);
static void Bld_PutHeadBuildings (void); static void Bld_PutHeadBuildings (void);
@ -526,11 +526,11 @@ void Bld_RenameBuildingFull (void)
/*********************** Change the name of a building ***********************/ /*********************** Change the name of a building ***********************/
/*****************************************************************************/ /*****************************************************************************/
static void Bld_RenameBuilding (Nam_ShrtOrFullName_t ShrtOrFullName) static void Bld_RenameBuilding (Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_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_building_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
@ -546,7 +546,7 @@ static void Bld_RenameBuilding (Nam_ShrtOrFullName_t ShrtOrFullName)
Bld_EditingBuilding->BldCod = ParCod_GetAndCheckPar (ParCod_Bld); Bld_EditingBuilding->BldCod = ParCod_GetAndCheckPar (ParCod_Bld);
/* Get the new name for the building */ /* Get the new name for the building */
Nam_GetParShrtOrFullName (ShrtOrFullName,NewName); Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get from the database the old names of the building *****/ /***** Get from the database the old names of the building *****/
Bld_GetBuildingDataByCod (Bld_EditingBuilding); Bld_GetBuildingDataByCod (Bld_EditingBuilding);
@ -556,10 +556,10 @@ static void Bld_RenameBuilding (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If building was in database... *****/ /***** If building was in database... *****/
if (Bld_DB_CheckIfBuildingNameExists (Nam_ParShrtOrFullName[ShrtOrFullName], if (Bld_DB_CheckIfBuildingNameExists (Nam_Params[ShrtOrFull],
NewName,Bld_EditingBuilding->BldCod, NewName,Bld_EditingBuilding->BldCod,
-1L,0)) // Unused -1L,0)) // Unused
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName); Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
@ -567,26 +567,26 @@ static void Bld_RenameBuilding (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Bld_DB_UpdateBuildingName (Bld_EditingBuilding->BldCod, Bld_DB_UpdateBuildingName (Bld_EditingBuilding->BldCod,
Nam_FldShrtOrFullName[ShrtOrFullName], Nam_Fields[ShrtOrFull],
NewName); NewName);
/* Write message to show the change made */ /* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_building_X_has_been_renamed_as_Y, Txt_The_building_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName); CurrentName[ShrtOrFull],NewName);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,NULL, Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed, Txt_The_name_X_has_not_changed,
CurrentName[ShrtOrFullName]); CurrentName[ShrtOrFull]);
} }
else else
Ale_CreateAlertYouCanNotLeaveFieldEmpty (); Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
/***** Update building name *****/ /***** Update building name *****/
Str_Copy (CurrentName[ShrtOrFullName],NewName, Str_Copy (CurrentName[ShrtOrFull],NewName,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]); Nam_MaxBytes[ShrtOrFull]);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -654,11 +654,7 @@ void Bld_ContEditAfterChgBuilding (void)
static void Bld_PutFormToCreateBuilding (void) static void Bld_PutFormToCreateBuilding (void)
{ {
const char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Bld_EditingBuilding->ShrtName,
[Nam_FULL_NAME] = Bld_EditingBuilding->FullName,
};
/***** Begin form to create *****/ /***** Begin form to create *****/
Frm_BeginFormTable (ActNewBld,NULL,NULL,NULL); Frm_BeginFormTable (ActNewBld,NULL,NULL,NULL);
@ -677,6 +673,8 @@ static void Bld_PutFormToCreateBuilding (void)
HTM_TD_End (); HTM_TD_End ();
/***** Building short name and full name *****/ /***** Building short name and full name *****/
Names[Nam_SHRT_NAME] = Bld_EditingBuilding->ShrtName;
Names[Nam_FULL_NAME] = Bld_EditingBuilding->FullName;
Nam_NewShortAndFullNames (Names); Nam_NewShortAndFullNames (Names);
/***** Building location *****/ /***** Building location *****/
@ -722,17 +720,15 @@ static void Bld_PutHeadBuildings (void)
void Bld_ReceiveFormNewBuilding (void) void Bld_ReceiveFormNewBuilding (void)
{ {
extern const char *Txt_Created_new_building_X; extern const char *Txt_Created_new_building_X;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Bld_EditingBuilding->ShrtName,
[Nam_FULL_NAME] = Bld_EditingBuilding->FullName,
};
/***** Building constructor *****/ /***** Building constructor *****/
Bld_EditingBuildingConstructor (); Bld_EditingBuildingConstructor ();
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get building short name and full name */ /* Get building short name and full name */
Names[Nam_SHRT_NAME] = Bld_EditingBuilding->ShrtName;
Names[Nam_FULL_NAME] = Bld_EditingBuilding->FullName;
Nam_GetParsShrtAndFullName (Names); Nam_GetParsShrtAndFullName (Names);
/* Get building location */ /* Get building location */
@ -742,7 +738,9 @@ void Bld_ReceiveFormNewBuilding (void)
Bld_EditingBuilding->FullName[0]) // If there's a building name Bld_EditingBuilding->FullName[0]) // If there's a building name
{ {
/***** If name of building was not in database... *****/ /***** If name of building was not in database... *****/
if (!Nam_CheckIfNameExists (Bld_DB_CheckIfBuildingNameExists,Names,-1L, if (!Nam_CheckIfNameExists (Bld_DB_CheckIfBuildingNameExists,
(const char **) Names,
-1L,
-1L, // Unused -1L, // Unused
0)) // Unused 0)) // Unused
{ {

View File

@ -854,7 +854,7 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams,
Cfe_TypeViewCallForExam_t TypeViewCallForExam, Cfe_TypeViewCallForExam_t TypeViewCallForExam,
bool HighLight) bool HighLight)
{ {
extern unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxChars[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Hlp_ASSESSMENT_Calls_for_exams_new_call; extern const char *Hlp_ASSESSMENT_Calls_for_exams_new_call;
extern const char *Hlp_ASSESSMENT_Calls_for_exams_edit_call; extern const char *Hlp_ASSESSMENT_Calls_for_exams_edit_call;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
@ -1002,7 +1002,7 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams,
HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"", HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",
The_GetSuffix ()); The_GetSuffix ());
if (TypeViewCallForExam == Cfe_FORM_VIEW) if (TypeViewCallForExam == Cfe_FORM_VIEW)
HTM_INPUT_TEXT ("CrsName",Nam_MaxCharsShrtOrFullName[Nam_FULL_NAME], HTM_INPUT_TEXT ("CrsName",Nam_MaxChars[Nam_FULL_NAME],
CallsForExams->CallForExam.CrsFullName, CallsForExams->CallForExam.CrsFullName,
HTM_DONT_SUBMIT_ON_CHANGE, HTM_DONT_SUBMIT_ON_CHANGE,
"id=\"CrsName\" size=\"30\" class=\"INPUT_%s\"", "id=\"CrsName\" size=\"30\" class=\"INPUT_%s\"",

View File

@ -1059,11 +1059,11 @@ void Ctr_RenameCenterFull (void)
/************************ Change the name of a center ************************/ /************************ Change the name of a center ************************/
/*****************************************************************************/ /*****************************************************************************/
void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFullName) void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_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_center_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
@ -1076,7 +1076,7 @@ void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFullName)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the new name for the center */ /* Get the new name for the center */
Nam_GetParShrtOrFullName (ShrtOrFullName,NewName); Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get from the database the old names of the center *****/ /***** Get from the database the old names of the center *****/
Ctr_GetCenterDataByCod (Ctr); Ctr_GetCenterDataByCod (Ctr);
@ -1088,10 +1088,10 @@ void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If degree was in database... *****/ /***** If degree was in database... *****/
if (Ctr_DB_CheckIfCtrNameExistsInIns (Nam_ParShrtOrFullName[ShrtOrFullName], if (Ctr_DB_CheckIfCtrNameExistsInIns (Nam_Params[ShrtOrFull],
NewName,Ctr->HieCod, NewName,Ctr->HieCod,
Gbl.Hierarchy.Node[Hie_INS].HieCod, Gbl.Hierarchy.Node[Hie_INS].HieCod,
0)) // Unused 0)) // Unused
@ -1100,22 +1100,22 @@ void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Ctr_DB_UpdateCtrName (Ctr->HieCod, Ctr_DB_UpdateCtrName (Ctr->HieCod,
Nam_FldShrtOrFullName[ShrtOrFullName],NewName); Nam_Fields[ShrtOrFull],NewName);
/* Write message to show the change made */ /* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_center_X_has_been_renamed_as_Y, Txt_The_center_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName); CurrentName[ShrtOrFull],NewName);
/* Change current center name in order to display it properly */ /* Change current center name in order to display it properly */
Str_Copy (CurrentName[ShrtOrFullName],NewName, Str_Copy (CurrentName[ShrtOrFull],NewName,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]); Nam_MaxBytes[ShrtOrFull]);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,NULL, Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed, Txt_The_name_X_has_not_changed,
CurrentName[ShrtOrFullName]); CurrentName[ShrtOrFull]);
} }
} }
@ -1239,11 +1239,7 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
Act_Action_t NextAction = ActUnk; Act_Action_t NextAction = ActUnk;
unsigned NumPlc; unsigned NumPlc;
const struct Plc_Place *Plc; const struct Plc_Place *Plc;
const char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Ctr_EditingCtr->ShrtName,
[Nam_FULL_NAME] = Ctr_EditingCtr->FullName,
};
/***** Set action depending on role *****/ /***** Set action depending on role *****/
if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM)
@ -1302,6 +1298,8 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
HTM_TD_End (); HTM_TD_End ();
/***** Center short name and full name *****/ /***** Center short name and full name *****/
Names[Nam_SHRT_NAME] = Ctr_EditingCtr->ShrtName;
Names[Nam_FULL_NAME] = Ctr_EditingCtr->FullName;
Nam_NewShortAndFullNames (Names); Nam_NewShortAndFullNames (Names);
/***** Center WWW *****/ /***** Center WWW *****/
@ -1475,11 +1473,7 @@ void Ctr_ReceiveFormNewCtr (void)
static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status) static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
{ {
extern const char *Txt_Created_new_center_X; extern const char *Txt_Created_new_center_X;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Ctr_EditingCtr->ShrtName,
[Nam_FULL_NAME] = Ctr_EditingCtr->FullName,
};
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Set center institution */ /* Set center institution */
@ -1489,6 +1483,8 @@ static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
Ctr_EditingCtr->Specific.PlcCod = ParCod_GetAndCheckParMin (ParCod_Plc,0); // 0 (another place) is allowed here Ctr_EditingCtr->Specific.PlcCod = ParCod_GetAndCheckParMin (ParCod_Plc,0); // 0 (another place) is allowed here
/* Get center short name and full name */ /* Get center short name and full name */
Names[Nam_SHRT_NAME] = Ctr_EditingCtr->ShrtName;
Names[Nam_FULL_NAME] = Ctr_EditingCtr->FullName;
Nam_GetParsShrtAndFullName (Names); Nam_GetParsShrtAndFullName (Names);
/* Get center WWW */ /* Get center WWW */
@ -1500,8 +1496,10 @@ static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
if (Ctr_EditingCtr->WWW[0]) if (Ctr_EditingCtr->WWW[0])
{ {
/***** If name of center was in database... *****/ /***** If name of center was in database... *****/
if (!Nam_CheckIfNameExists (Ctr_DB_CheckIfCtrNameExistsInIns,Names, if (!Nam_CheckIfNameExists (Ctr_DB_CheckIfCtrNameExistsInIns,
-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod, (const char **) Names,
-1L,
Gbl.Hierarchy.Node[Hie_INS].HieCod,
0)) // Unused 0)) // Unused
{ {
Ctr_EditingCtr->HieCod = Ctr_DB_CreateCenter (Ctr_EditingCtr,Status); Ctr_EditingCtr->HieCod = Ctr_DB_CreateCenter (Ctr_EditingCtr,Status);

View File

@ -58,7 +58,7 @@ void Ctr_RemoveCenter (void);
void Ctr_ChangeCtrPlc (void); void Ctr_ChangeCtrPlc (void);
void Ctr_RenameCenterShort (void); void Ctr_RenameCenterShort (void);
void Ctr_RenameCenterFull (void); void Ctr_RenameCenterFull (void);
void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFullName); void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFull);
void Ctr_ChangeCtrWWW (void); void Ctr_ChangeCtrWWW (void);
void Ctr_ChangeCtrStatus (void); void Ctr_ChangeCtrStatus (void);
void Ctr_ContEditAfterChgCtr (void); void Ctr_ContEditAfterChgCtr (void);

View File

@ -1017,11 +1017,7 @@ void CtrCfg_ChangeCtrIns (void)
{ {
extern const char *Txt_The_center_X_has_been_moved_to_the_institution_Y; extern const char *Txt_The_center_X_has_been_moved_to_the_institution_Y;
struct Hie_Node NewIns; struct Hie_Node NewIns;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = const 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,
};
/***** Get parameter with institution code *****/ /***** Get parameter with institution code *****/
NewIns.HieCod = ParCod_GetAndCheckPar (ParCod_OthIns); NewIns.HieCod = ParCod_GetAndCheckPar (ParCod_OthIns);
@ -1033,8 +1029,12 @@ void CtrCfg_ChangeCtrIns (void)
Ins_GetInstitDataByCod (&NewIns); Ins_GetInstitDataByCod (&NewIns);
/***** Check if it already exists a center with the same name in the new institution *****/ /***** Check if it already exists a center with the same name in the new institution *****/
if (!Nam_CheckIfNameExists (Ctr_DB_CheckIfCtrNameExistsInIns,Names, Names[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CTR].ShrtName;
Gbl.Hierarchy.Node[Hie_CTR].HieCod,NewIns.HieCod, Names[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_CTR].FullName;
if (!Nam_CheckIfNameExists (Ctr_DB_CheckIfCtrNameExistsInIns,
Names,
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
NewIns.HieCod,
0)) // Unused 0)) // Unused
{ {
/***** Update institution in table of centers *****/ /***** Update institution in table of centers *****/

View File

@ -633,10 +633,11 @@ Me sale este error, no s
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/ */
#define Log_PLATFORM_VERSION "SWAD 23.34 (2023-10-10)" #define Log_PLATFORM_VERSION "SWAD 23.35 (2023-10-10)"
#define CSS_FILE "swad23.25.2.css" #define CSS_FILE "swad23.25.2.css"
#define JS_FILE "swad22.49.js" #define JS_FILE "swad22.49.js"
/* /*
Version 23.35: Oct 10, 2023 Fixed bugs in short/full names. (335549 lines)
Version 23.34: Oct 10, 2023 New module swad_name for short and full names. (335608 lines) Version 23.34: Oct 10, 2023 New module swad_name for short and full names. (335608 lines)
Version 23.33.3: Oct 10, 2023 Code refactoring in short and full names. (335515 lines) Version 23.33.3: Oct 10, 2023 Code refactoring in short and full names. (335515 lines)
Version 23.33.2: Oct 10, 2023 Code refactoring in short and full names. Not finished. (335661 lines) Version 23.33.2: Oct 10, 2023 Code refactoring in short and full names. Not finished. (335661 lines)

View File

@ -1075,11 +1075,7 @@ static void Crs_PutFormToCreateCourse (void)
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
Act_Action_t NextAction = ActUnk; Act_Action_t NextAction = ActUnk;
unsigned Year; unsigned Year;
const char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Crs_EditingCrs->ShrtName,
[Nam_FULL_NAME] = Crs_EditingCrs->FullName,
};
/***** Begin form *****/ /***** Begin form *****/
if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
@ -1132,6 +1128,8 @@ static void Crs_PutFormToCreateCourse (void)
HTM_TD_End (); HTM_TD_End ();
/***** Course short name and full name *****/ /***** Course short name and full name *****/
Names[Nam_SHRT_NAME] = Crs_EditingCrs->ShrtName;
Names[Nam_FULL_NAME] = Crs_EditingCrs->FullName;
Nam_NewShortAndFullNames (Names); Nam_NewShortAndFullNames (Names);
/***** Current number of teachers in this course *****/ /***** Current number of teachers in this course *****/
@ -1251,15 +1249,10 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
extern const char *Txt_Created_new_course_X; extern const char *Txt_Created_new_course_X;
extern const char *Txt_The_year_X_is_not_allowed; extern const char *Txt_The_year_X_is_not_allowed;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Crs_EditingCrs->ShrtName,
[Nam_FULL_NAME] = Crs_EditingCrs->FullName,
};
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Set course degree */ /* Set course degree */
// Deg.DegCod =
Crs_EditingCrs->PrtCod = Gbl.Hierarchy.Node[Hie_DEG].HieCod; Crs_EditingCrs->PrtCod = Gbl.Hierarchy.Node[Hie_DEG].HieCod;
/* Get parameters of the new course */ /* Get parameters of the new course */
@ -1272,8 +1265,12 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
Crs_EditingCrs->FullName[0]) // If there's a course name Crs_EditingCrs->FullName[0]) // If there's a course name
{ {
/***** If name of course was not in database... *****/ /***** If name of course was not in database... *****/
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,Names, Names[Nam_SHRT_NAME] = Crs_EditingCrs->ShrtName;
-1L,Crs_EditingCrs->PrtCod, Names[Nam_FULL_NAME] = Crs_EditingCrs->FullName;
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,
Names,
-1L,
Crs_EditingCrs->PrtCod,
Crs_EditingCrs->Specific.Year)) Crs_EditingCrs->Specific.Year))
{ {
Crs_DB_CreateCourse (Crs_EditingCrs,Status); Crs_DB_CreateCourse (Crs_EditingCrs,Status);
@ -1297,11 +1294,7 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
static void Crs_GetParsNewCourse (struct Hie_Node *Crs) static void Crs_GetParsNewCourse (struct Hie_Node *Crs)
{ {
char YearStr[2 + 1]; char YearStr[2 + 1];
char *Names[Nam_NUM_SHRT_FULL_NAMES] = char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Crs->ShrtName,
[Nam_FULL_NAME] = Crs->FullName,
};
/***** Get parameters of the course from form *****/ /***** Get parameters of the course from form *****/
/* Get year */ /* Get year */
@ -1312,6 +1305,8 @@ static void Crs_GetParsNewCourse (struct Hie_Node *Crs)
Par_GetParText ("InsCrsCod",Crs->InstitutionalCod,Hie_MAX_BYTES_INSTITUTIONAL_COD); Par_GetParText ("InsCrsCod",Crs->InstitutionalCod,Hie_MAX_BYTES_INSTITUTIONAL_COD);
/* Get course short name and full name */ /* Get course short name and full name */
Names[Nam_SHRT_NAME] = Crs->ShrtName;
Names[Nam_FULL_NAME] = Crs->FullName;
Nam_GetParsShrtAndFullName (Names); Nam_GetParsShrtAndFullName (Names);
} }
@ -1602,11 +1597,7 @@ void Crs_ChangeCrsYear (void)
extern const char *Txt_The_year_X_is_not_allowed; extern const char *Txt_The_year_X_is_not_allowed;
char YearStr[2 + 1]; char YearStr[2 + 1];
unsigned NewYear; unsigned NewYear;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Crs_EditingCrs->ShrtName,
[Nam_FULL_NAME] = Crs_EditingCrs->FullName,
};
/***** Course constructor *****/ /***** Course constructor *****/
Crs_EditingCourseConstructor (); Crs_EditingCourseConstructor ();
@ -1627,8 +1618,13 @@ void Crs_ChangeCrsYear (void)
if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
{ {
/***** If name of course was not in database in the new year... *****/ /***** If name of course was not in database in the new year... *****/
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,Names, Names[Nam_SHRT_NAME] = Crs_EditingCrs->ShrtName;
-1L,Crs_EditingCrs->PrtCod,NewYear)) Names[Nam_FULL_NAME] = Crs_EditingCrs->FullName;
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,
Names,
-1L,
Crs_EditingCrs->PrtCod,
NewYear))
{ {
/***** Update year in table of courses *****/ /***** Update year in table of courses *****/
Crs_UpdateCrsYear (Crs_EditingCrs,NewYear); Crs_UpdateCrsYear (Crs_EditingCrs,NewYear);
@ -1700,11 +1696,11 @@ void Crs_RenameCourseFull (void)
/************************ Change the name of a course ************************/ /************************ Change the name of a course ************************/
/*****************************************************************************/ /*****************************************************************************/
void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFullName) void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_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_course_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
@ -1717,7 +1713,7 @@ void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFullName)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the new name for the course */ /* Get the new name for the course */
Nam_GetParShrtOrFullName (ShrtOrFullName,NewName); Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get from the database the data of the degree *****/ /***** Get from the database the data of the degree *****/
Crs_GetCourseDataByCod (Crs); Crs_GetCourseDataByCod (Crs);
@ -1729,10 +1725,10 @@ void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If course was in database... *****/ /***** If course was in database... *****/
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Nam_ParShrtOrFullName[ShrtOrFullName], if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Nam_Params[ShrtOrFull],
NewName,Crs->HieCod, NewName,Crs->HieCod,
Crs->PrtCod,Crs->Specific.Year)) Crs->PrtCod,Crs->Specific.Year))
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName); Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
@ -1740,21 +1736,21 @@ void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Crs_DB_UpdateCrsName (Crs->HieCod, Crs_DB_UpdateCrsName (Crs->HieCod,
Nam_FldShrtOrFullName[ShrtOrFullName],NewName); Nam_Fields[ShrtOrFull],NewName);
/* Create alert to show the change made */ /* Create alert to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_course_X_has_been_renamed_as_Y, Txt_The_course_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName); CurrentName[ShrtOrFull],NewName);
/* Change current course name in order to display it properly */ /* Change current course name in order to display it properly */
Str_Copy (CurrentName[ShrtOrFullName],NewName, Str_Copy (CurrentName[ShrtOrFull],NewName,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]); Nam_MaxBytes[ShrtOrFull]);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,NULL, Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed,CurrentName[ShrtOrFullName]); Txt_The_name_X_has_not_changed,CurrentName[ShrtOrFull]);
} }
else else
Ale_CreateAlertYouCanNotLeaveFieldEmpty (); Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
@ -2370,7 +2366,7 @@ static void Crs_EditingCourseConstructor (void)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
/***** Reset course *****/ /***** Reset course *****/
Crs_EditingCrs->HieCod = -1L; Crs_EditingCrs->HieCod = -1L;
Crs_EditingCrs->PrtCod = -1L; Crs_EditingCrs->PrtCod = -1L;
Crs_EditingCrs->Specific.Year = 0; Crs_EditingCrs->Specific.Year = 0;
Crs_EditingCrs->Status = 0; Crs_EditingCrs->Status = 0;

View File

@ -74,7 +74,7 @@ void Crs_UpdateCrsYear (struct Hie_Node *Crs,unsigned NewYear);
void Crs_RenameCourseShort (void); void Crs_RenameCourseShort (void);
void Crs_RenameCourseFull (void); void Crs_RenameCourseFull (void);
void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFullName); void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFull);
void Crs_ChangeCrsStatus (void); void Crs_ChangeCrsStatus (void);
void Crs_ContEditAfterChgCrs (void); void Crs_ContEditAfterChgCrs (void);

View File

@ -461,11 +461,7 @@ void CrsCfg_ChangeCrsDeg (void)
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; 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; extern const char *Txt_The_course_X_has_been_moved_to_the_degree_Y;
struct Hie_Node NewDeg; struct Hie_Node NewDeg;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CRS].ShrtName,
[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_CRS].FullName,
};
/***** Get parameter with degree code *****/ /***** Get parameter with degree code *****/
NewDeg.HieCod = ParCod_GetAndCheckPar (ParCod_OthDeg); NewDeg.HieCod = ParCod_GetAndCheckPar (ParCod_OthDeg);
@ -477,8 +473,12 @@ void CrsCfg_ChangeCrsDeg (void)
Deg_GetDegreeDataByCod (&NewDeg); Deg_GetDegreeDataByCod (&NewDeg);
/***** If name of course was not in database in the new degree... *****/ /***** If name of course was not in database in the new degree... *****/
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,Names, Names[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CRS].ShrtName;
-1L,NewDeg.HieCod, Names[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_CRS].FullName;
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,
Names,
-1L,
NewDeg.HieCod,
Gbl.Hierarchy.Node[Hie_CRS].Specific.Year)) Gbl.Hierarchy.Node[Hie_CRS].Specific.Year))
{ {
/***** Update degree in table of courses *****/ /***** Update degree in table of courses *****/
@ -523,11 +523,7 @@ void CrsCfg_ChangeCrsYear (void)
extern const char *Txt_The_year_X_is_not_allowed; extern const char *Txt_The_year_X_is_not_allowed;
char YearStr[2 + 1]; char YearStr[2 + 1];
unsigned NewYear; unsigned NewYear;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CRS].ShrtName,
[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_CRS].FullName,
};
/***** Get parameter with year/semester *****/ /***** Get parameter with year/semester *****/
Par_GetParText ("OthCrsYear",YearStr,2); Par_GetParText ("OthCrsYear",YearStr,2);
@ -536,8 +532,12 @@ void CrsCfg_ChangeCrsYear (void)
if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
{ {
/***** If name of course was not in database in the new year... *****/ /***** If name of course was not in database in the new year... *****/
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,Names, Names[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CRS].ShrtName;
-1L,Gbl.Hierarchy.Node[Hie_CRS].PrtCod, Names[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_CRS].FullName;
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,
Names,
-1L,
Gbl.Hierarchy.Node[Hie_CRS].PrtCod,
NewYear)) NewYear))
{ {
/***** Update year in table of courses *****/ /***** Update year in table of courses *****/

View File

@ -509,11 +509,7 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
Act_Action_t NextAction = ActUnk; Act_Action_t NextAction = ActUnk;
unsigned NumDegTyp; unsigned NumDegTyp;
struct DegTyp_DegreeType *DegTyp; struct DegTyp_DegreeType *DegTyp;
const char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Deg_EditingDeg->ShrtName,
[Nam_FULL_NAME] = Deg_EditingDeg->FullName,
};
/***** Set action depending on role *****/ /***** Set action depending on role *****/
if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM)
@ -548,6 +544,8 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
HTM_TD_End (); HTM_TD_End ();
/***** Degree short name and full name *****/ /***** Degree short name and full name *****/
Names[Nam_SHRT_NAME] = Deg_EditingDeg->ShrtName;
Names[Nam_FULL_NAME] = Deg_EditingDeg->FullName;
Nam_NewShortAndFullNames (Names); Nam_NewShortAndFullNames (Names);
/***** Degree type *****/ /***** Degree type *****/
@ -1046,17 +1044,15 @@ void Deg_ReceiveFormNewDeg (void)
static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status) static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
{ {
extern const char *Txt_Created_new_degree_X; extern const char *Txt_Created_new_degree_X;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Deg_EditingDeg->ShrtName,
[Nam_FULL_NAME] = Deg_EditingDeg->FullName,
};
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Set degree center */ /* Set degree center */
Deg_EditingDeg->PrtCod = Gbl.Hierarchy.Node[Hie_CTR].HieCod; Deg_EditingDeg->PrtCod = Gbl.Hierarchy.Node[Hie_CTR].HieCod;
/* Get degree short name and full name */ /* Get degree short name and full name */
Names[Nam_SHRT_NAME] = Deg_EditingDeg->ShrtName;
Names[Nam_FULL_NAME] = Deg_EditingDeg->FullName;
Nam_GetParsShrtAndFullName (Names); Nam_GetParsShrtAndFullName (Names);
/* Get degree type */ /* Get degree type */
@ -1071,8 +1067,10 @@ static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
if (Deg_EditingDeg->WWW[0]) if (Deg_EditingDeg->WWW[0])
{ {
/***** If name of degree was not in database... *****/ /***** If name of degree was not in database... *****/
if (!Nam_CheckIfNameExists (Deg_DB_CheckIfDegNameExistsInCtr,Names, if (!Nam_CheckIfNameExists (Deg_DB_CheckIfDegNameExistsInCtr,
-1L,Deg_EditingDeg->PrtCod, (const char **) Names,
-1L,
Deg_EditingDeg->PrtCod,
0)) // Unused 0)) // Unused
{ {
Deg_DB_CreateDegree (Deg_EditingDeg,Status); Deg_DB_CreateDegree (Deg_EditingDeg,Status);
@ -1283,11 +1281,11 @@ void Deg_RenameDegreeFull (void)
/************************ Change the name of a degree ************************/ /************************ Change the name of a degree ************************/
/*****************************************************************************/ /*****************************************************************************/
void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFullName) void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_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_degree_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
@ -1300,7 +1298,7 @@ void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFullName)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the new name for the degree */ /* Get the new name for the degree */
Nam_GetParShrtOrFullName (ShrtOrFullName,NewName); Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get data of degree *****/ /***** Get data of degree *****/
Deg_GetDegreeDataByCod (Deg); Deg_GetDegreeDataByCod (Deg);
@ -1310,10 +1308,10 @@ void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If degree was in database... *****/ /***** If degree was in database... *****/
if (Deg_DB_CheckIfDegNameExistsInCtr (Nam_ParShrtOrFullName[ShrtOrFullName], if (Deg_DB_CheckIfDegNameExistsInCtr (Nam_Params[ShrtOrFull],
NewName,Deg->HieCod,Deg->PrtCod, NewName,Deg->HieCod,Deg->PrtCod,
0)) // Unused 0)) // Unused
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName); Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
@ -1321,22 +1319,22 @@ void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Deg_DB_UpdateDegNameDB (Deg->HieCod, Deg_DB_UpdateDegNameDB (Deg->HieCod,
Nam_FldShrtOrFullName[ShrtOrFullName],NewName); Nam_Fields[ShrtOrFull],NewName);
/* Write message to show the change made */ /* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_degree_X_has_been_renamed_as_Y, Txt_The_degree_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName); CurrentName[ShrtOrFull],NewName);
/* Change current degree name in order to display it properly */ /* Change current degree name in order to display it properly */
Str_Copy (CurrentName[ShrtOrFullName],NewName, Str_Copy (CurrentName[ShrtOrFull],NewName,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]); Nam_MaxBytes[ShrtOrFull]);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,NULL, Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed, Txt_The_name_X_has_not_changed,
CurrentName[ShrtOrFullName]); CurrentName[ShrtOrFull]);
} }
else else
Ale_CreateAlertYouCanNotLeaveFieldEmpty (); Ale_CreateAlertYouCanNotLeaveFieldEmpty ();

View File

@ -74,7 +74,7 @@ bool Deg_GetDegreeDataByCod (struct Hie_Node *Deg);
void Deg_RemoveDegreeCompletely (long DegCod); void Deg_RemoveDegreeCompletely (long DegCod);
void Deg_RenameDegreeShort (void); void Deg_RenameDegreeShort (void);
void Deg_RenameDegreeFull (void); void Deg_RenameDegreeFull (void);
void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFullName); void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFull);
void Deg_ChangeDegreeType (void); void Deg_ChangeDegreeType (void);
void Deg_ChangeDegWWW (void); void Deg_ChangeDegWWW (void);
void Deg_ChangeDegStatus (void); void Deg_ChangeDegStatus (void);

View File

@ -350,11 +350,7 @@ void DegCfg_ChangeDegCtr (void)
{ {
extern const char *Txt_The_degree_X_has_been_moved_to_the_center_Y; extern const char *Txt_The_degree_X_has_been_moved_to_the_center_Y;
struct Hie_Node NewCtr; struct Hie_Node NewCtr;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_DEG].ShrtName,
[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_DEG].FullName,
};
/***** Get parameter with center code *****/ /***** Get parameter with center code *****/
NewCtr.HieCod = ParCod_GetAndCheckPar (ParCod_OthCtr); NewCtr.HieCod = ParCod_GetAndCheckPar (ParCod_OthCtr);
@ -366,8 +362,12 @@ void DegCfg_ChangeDegCtr (void)
Ctr_GetCenterDataByCod (&NewCtr); Ctr_GetCenterDataByCod (&NewCtr);
/***** Check if it already existed a degree with the same name in the new center *****/ /***** Check if it already existed a degree with the same name in the new center *****/
if (!Nam_CheckIfNameExists (Deg_DB_CheckIfDegNameExistsInCtr,Names, Names[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_DEG].ShrtName;
Gbl.Hierarchy.Node[Hie_DEG].HieCod,NewCtr.HieCod, Names[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_DEG].FullName;
if (!Nam_CheckIfNameExists (Deg_DB_CheckIfDegNameExistsInCtr,
Names,
Gbl.Hierarchy.Node[Hie_DEG].HieCod,
NewCtr.HieCod,
0)) // Unused 0)) // Unused
{ {
/***** Update center in table of degrees *****/ /***** Update center in table of degrees *****/

View File

@ -91,7 +91,7 @@ static void Dpt_GetDepartmentDataFromRow (MYSQL_RES *mysql_res,
static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departments); static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departments);
static void Dpt_PutParDptCod (void *DptCod); static void Dpt_PutParDptCod (void *DptCod);
static void Dpt_RenameDepartment (Nam_ShrtOrFullName_t ShrtOrFullName); static void Dpt_RenameDepartment (Nam_ShrtOrFullName_t ShrtOrFull);
static void Dpt_PutFormToCreateDepartment (void); static void Dpt_PutFormToCreateDepartment (void);
static void Dpt_PutHeadDepartments (void); static void Dpt_PutHeadDepartments (void);
@ -668,11 +668,11 @@ void Dpt_RenameDepartFull (void)
/************************ Change the name of a degree ************************/ /************************ Change the name of a degree ************************/
/*****************************************************************************/ /*****************************************************************************/
static void Dpt_RenameDepartment (Nam_ShrtOrFullName_t ShrtOrFullName) static void Dpt_RenameDepartment (Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_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_department_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
@ -688,7 +688,7 @@ static void Dpt_RenameDepartment (Nam_ShrtOrFullName_t ShrtOrFullName)
Dpt_EditingDpt->DptCod = ParCod_GetAndCheckPar (ParCod_Dpt); Dpt_EditingDpt->DptCod = ParCod_GetAndCheckPar (ParCod_Dpt);
/* Get the new name for the department */ /* Get the new name for the department */
Nam_GetParShrtOrFullName (ShrtOrFullName,NewName); Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get from the database the old names of the department *****/ /***** Get from the database the old names of the department *****/
Dpt_GetDepartmentDataByCod (Dpt_EditingDpt); Dpt_GetDepartmentDataByCod (Dpt_EditingDpt);
@ -698,10 +698,10 @@ static void Dpt_RenameDepartment (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If name department was not in database... *****/ /***** If name department was not in database... *****/
if (Dpt_DB_CheckIfDepartmentNameExists (Nam_ParShrtOrFullName[ShrtOrFullName], if (Dpt_DB_CheckIfDepartmentNameExists (Nam_Params[ShrtOrFull],
NewName,Dpt_EditingDpt->DptCod, NewName,Dpt_EditingDpt->DptCod,
-1L, // Unused -1L, // Unused
0)) // Unused 0)) // Unused
@ -710,25 +710,25 @@ static void Dpt_RenameDepartment (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Dpt_DB_UpdateDptName (Dpt_EditingDpt->DptCod, Dpt_DB_UpdateDptName (Dpt_EditingDpt->DptCod,
Nam_FldShrtOrFullName[ShrtOrFullName],NewName); Nam_Fields[ShrtOrFull],NewName);
/* Write message to show the change made */ /* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_department_X_has_been_renamed_as_Y, Txt_The_department_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName); CurrentName[ShrtOrFull],NewName);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,NULL, Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed, Txt_The_name_X_has_not_changed,
CurrentName[ShrtOrFullName]); CurrentName[ShrtOrFull]);
} }
else else
Ale_CreateAlertYouCanNotLeaveFieldEmpty (); Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
/***** Update name *****/ /***** Update name *****/
Str_Copy (CurrentName[ShrtOrFullName],NewName, Str_Copy (CurrentName[ShrtOrFull],NewName,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]); Nam_MaxBytes[ShrtOrFull]);
} }
/******************************************************************************/ /******************************************************************************/
@ -796,11 +796,7 @@ static void Dpt_PutFormToCreateDepartment (void)
extern const char *Txt_Another_institution; extern const char *Txt_Another_institution;
unsigned NumIns; unsigned NumIns;
const struct Hie_Node *Ins; const struct Hie_Node *Ins;
const char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Dpt_EditingDpt->ShrtName,
[Nam_FULL_NAME] = Dpt_EditingDpt->FullName,
};
/***** Begin form to create *****/ /***** Begin form to create *****/
Frm_BeginFormTable (ActNewDpt,NULL,NULL,NULL); Frm_BeginFormTable (ActNewDpt,NULL,NULL,NULL);
@ -844,6 +840,8 @@ static void Dpt_PutFormToCreateDepartment (void)
HTM_TD_End (); HTM_TD_End ();
/***** Department short name and full name *****/ /***** Department short name and full name *****/
Names[Nam_SHRT_NAME] = Dpt_EditingDpt->ShrtName;
Names[Nam_FULL_NAME] = Dpt_EditingDpt->FullName;
Nam_NewShortAndFullNames (Names); Nam_NewShortAndFullNames (Names);
/***** Department WWW *****/ /***** Department WWW *****/
@ -896,11 +894,7 @@ static void Dpt_PutHeadDepartments (void)
void Dpt_ReceiveFormNewDpt (void) void Dpt_ReceiveFormNewDpt (void)
{ {
extern const char *Txt_Created_new_department_X; extern const char *Txt_Created_new_department_X;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Dpt_EditingDpt->ShrtName,
[Nam_FULL_NAME] = Dpt_EditingDpt->FullName,
};
/***** Department constructor *****/ /***** Department constructor *****/
Dpt_EditingDepartmentConstructor (); Dpt_EditingDepartmentConstructor ();
@ -910,6 +904,8 @@ void Dpt_ReceiveFormNewDpt (void)
Dpt_EditingDpt->InsCod = ParCod_GetAndCheckPar (ParCod_OthIns); Dpt_EditingDpt->InsCod = ParCod_GetAndCheckPar (ParCod_OthIns);
/* Get department short name and full name */ /* Get department short name and full name */
Names[Nam_SHRT_NAME] = Dpt_EditingDpt->ShrtName;
Names[Nam_FULL_NAME] = Dpt_EditingDpt->FullName;
Nam_GetParsShrtAndFullName (Names); Nam_GetParsShrtAndFullName (Names);
/* Get department WWW */ /* Get department WWW */
@ -921,7 +917,8 @@ void Dpt_ReceiveFormNewDpt (void)
if (Dpt_EditingDpt->WWW[0]) if (Dpt_EditingDpt->WWW[0])
{ {
/***** If name of department was not in database... *****/ /***** If name of department was not in database... *****/
if (!Nam_CheckIfNameExists (Dpt_DB_CheckIfDepartmentNameExists,Names, if (!Nam_CheckIfNameExists (Dpt_DB_CheckIfDepartmentNameExists,
(const char **) Names,
-1L, -1L,
-1L, // Unused -1L, // Unused
0)) // Unused 0)) // Unused

View File

@ -85,11 +85,11 @@ void HieCfg_Title (bool PutLink,Hie_Level_t Level)
/******************* Show short/full name in configuration *******************/ /******************* Show short/full name in configuration *******************/
/*****************************************************************************/ /*****************************************************************************/
void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFullName) void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxChars[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_ClassShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Classes[Nam_NUM_SHRT_FULL_NAMES];
extern const char **Hie_TxtLevel[Hie_NUM_LEVELS]; extern const char **Hie_TxtLevel[Hie_NUM_LEVELS];
extern const char *Txt_Short_name; extern const char *Txt_Short_name;
static Act_Action_t Action[Hie_NUM_LEVELS][Nam_NUM_SHRT_FULL_NAMES] = static Act_Action_t Action[Hie_NUM_LEVELS][Nam_NUM_SHRT_FULL_NAMES] =
@ -113,9 +113,9 @@ void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFull
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",PutForm ? Nam_ParShrtOrFullName[ShrtOrFullName] : Frm_LabelColumn ("RT",PutForm ? Nam_Params[ShrtOrFull] :
NULL, NULL,
ShrtOrFullName == Nam_SHRT_NAME ? Txt_Short_name : ShrtOrFull == Nam_SHRT_NAME ? Txt_Short_name :
*Hie_TxtLevel[Level]); *Hie_TxtLevel[Level]);
/* Data */ /* Data */
@ -123,21 +123,21 @@ void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFull
if (PutForm) if (PutForm)
{ {
/* Form to change full name */ /* Form to change full name */
Frm_BeginForm (Action[Level][ShrtOrFullName]); Frm_BeginForm (Action[Level][ShrtOrFull]);
HTM_INPUT_TEXT (Nam_ParShrtOrFullName[ShrtOrFullName], HTM_INPUT_TEXT (Nam_Params[ShrtOrFull],
Nam_MaxCharsShrtOrFullName[ShrtOrFullName], Nam_MaxChars[ShrtOrFull],
Name[ShrtOrFullName], Name[ShrtOrFull],
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"id=\"%s\"" "id=\"%s\""
" class=\"%s INPUT_%s\"" " class=\"%s INPUT_%s\""
" required=\"required\"", " required=\"required\"",
Nam_ParShrtOrFullName[ShrtOrFullName], Nam_Params[ShrtOrFull],
Nam_ClassShrtOrFullName[ShrtOrFullName], Nam_Classes[ShrtOrFull],
The_GetSuffix ()); The_GetSuffix ());
Frm_EndForm (); Frm_EndForm ();
} }
else // I can not edit full name else // I can not edit full name
HTM_Txt (Name[ShrtOrFullName]); HTM_Txt (Name[ShrtOrFull]);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();

View File

@ -34,7 +34,7 @@
/*****************************************************************************/ /*****************************************************************************/
void HieCfg_Title (bool PutLink,Hie_Level_t LogoScope); void HieCfg_Title (bool PutLink,Hie_Level_t LogoScope);
void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFullName); void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFull);
void HieCfg_WWW (bool PrintView,bool PutForm,Act_Action_t NextAction, void HieCfg_WWW (bool PrintView,bool PutForm,Act_Action_t NextAction,
const char WWW[Cns_MAX_BYTES_WWW + 1]); const char WWW[Cns_MAX_BYTES_WWW + 1]);
void HieCfg_Shortcut (bool PrintView,ParCod_Param_t ParCode,long HieCod); void HieCfg_Shortcut (bool PrintView,ParCod_Param_t ParCode,long HieCod);

View File

@ -1140,11 +1140,11 @@ void Ins_RenameInsFull (void)
/******************** Change the name of an institution **********************/ /******************** Change the name of an institution **********************/
/*****************************************************************************/ /*****************************************************************************/
void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFullName) void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_X_already_exists; extern const char *Txt_X_already_exists;
extern const char *Txt_The_institution_X_has_been_renamed_as_Y; extern const char *Txt_The_institution_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
@ -1156,7 +1156,7 @@ void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFull
char NewName[Nam_MAX_BYTES_FULL_NAME + 1]; char NewName[Nam_MAX_BYTES_FULL_NAME + 1];
/***** Get the new name for the institution from form *****/ /***** Get the new name for the institution from form *****/
Nam_GetParShrtOrFullName (ShrtOrFullName,NewName); Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get from the database the old names of the institution *****/ /***** Get from the database the old names of the institution *****/
Ins_GetInstitDataByCod (Ins); Ins_GetInstitDataByCod (Ins);
@ -1166,10 +1166,10 @@ void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFull
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If institution was not in database... *****/ /***** If institution was not in database... *****/
if (Ins_DB_CheckIfInsNameExistsInCty (Nam_ParShrtOrFullName[ShrtOrFullName], if (Ins_DB_CheckIfInsNameExistsInCty (Nam_Params[ShrtOrFull],
NewName,Ins->HieCod, NewName,Ins->HieCod,
Gbl.Hierarchy.Node[Hie_CTY].HieCod, Gbl.Hierarchy.Node[Hie_CTY].HieCod,
0)) // Unused 0)) // Unused
@ -1178,22 +1178,22 @@ void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFull
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Ins_UpdateInsNameDB (Ins->HieCod, Ins_UpdateInsNameDB (Ins->HieCod,
Nam_FldShrtOrFullName[ShrtOrFullName],NewName); Nam_Fields[ShrtOrFull],NewName);
/* Create message to show the change made */ /* Create message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_institution_X_has_been_renamed_as_Y, Txt_The_institution_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName); CurrentName[ShrtOrFull],NewName);
/* Change current institution name in order to display it properly */ /* Change current institution name in order to display it properly */
Str_Copy (CurrentName[ShrtOrFullName],NewName, Str_Copy (CurrentName[ShrtOrFull],NewName,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]); Nam_MaxBytes[ShrtOrFull]);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,NULL, Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed, Txt_The_name_X_has_not_changed,
CurrentName[ShrtOrFullName]); CurrentName[ShrtOrFull]);
} }
else else
Ale_CreateAlertYouCanNotLeaveFieldEmpty (); Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
@ -1330,11 +1330,7 @@ static void Ins_ShowAlertAndButtonToGoToIns (void)
static void Ins_PutFormToCreateInstitution (void) static void Ins_PutFormToCreateInstitution (void)
{ {
Act_Action_t NextAction = ActUnk; Act_Action_t NextAction = ActUnk;
const char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Ins_EditingIns->ShrtName,
[Nam_FULL_NAME] = Ins_EditingIns->FullName,
};
/***** Set action depending on role *****/ /***** Set action depending on role *****/
if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
@ -1369,6 +1365,8 @@ static void Ins_PutFormToCreateInstitution (void)
HTM_TD_End (); HTM_TD_End ();
/***** Institution short name and full name *****/ /***** Institution short name and full name *****/
Names[Nam_SHRT_NAME] = Ins_EditingIns->ShrtName;
Names[Nam_FULL_NAME] = Ins_EditingIns->FullName;
Nam_NewShortAndFullNames (Names); Nam_NewShortAndFullNames (Names);
/***** Institution WWW *****/ /***** Institution WWW *****/
@ -1479,17 +1477,15 @@ void Ins_ReceiveFormNewIns (void)
static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status) static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
{ {
extern const char *Txt_Created_new_institution_X; extern const char *Txt_Created_new_institution_X;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Ins_EditingIns->ShrtName,
[Nam_FULL_NAME] = Ins_EditingIns->FullName,
};
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Set institution country */ /* Set institution country */
Ins_EditingIns->PrtCod = Gbl.Hierarchy.Node[Hie_CTY].HieCod; Ins_EditingIns->PrtCod = Gbl.Hierarchy.Node[Hie_CTY].HieCod;
/* Get institution short name, full name and WWW */ /* Get institution short name and full name */
Names[Nam_SHRT_NAME] = Ins_EditingIns->ShrtName;
Names[Nam_FULL_NAME] = Ins_EditingIns->FullName;
Nam_GetParsShrtAndFullName (Names); Nam_GetParsShrtAndFullName (Names);
/* Get institution URL */ /* Get institution URL */
@ -1501,8 +1497,10 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
if (Ins_EditingIns->WWW[0]) if (Ins_EditingIns->WWW[0])
{ {
/***** If name of institution was not in database... *****/ /***** If name of institution was not in database... *****/
if (!Nam_CheckIfNameExists (Ins_DB_CheckIfInsNameExistsInCty,Names, if (!Nam_CheckIfNameExists (Ins_DB_CheckIfInsNameExistsInCty,
-1L,Gbl.Hierarchy.Node[Hie_CTY].HieCod, (const char **) Names,
-1L,
Gbl.Hierarchy.Node[Hie_CTY].HieCod,
0)) // Unused 0)) // Unused
{ {
Ins_EditingIns->HieCod = Ins_DB_CreateInstitution (Ins_EditingIns,Status); Ins_EditingIns->HieCod = Ins_DB_CreateInstitution (Ins_EditingIns,Status);

View File

@ -59,7 +59,7 @@ void Ins_WriteSelectorOfInstitution (void);
void Ins_RemoveInstitution (void); void Ins_RemoveInstitution (void);
void Ins_RenameInsShort (void); void Ins_RenameInsShort (void);
void Ins_RenameInsFull (void); void Ins_RenameInsFull (void);
void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFullName); void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFull);
void Ins_ChangeInsWWW (void); void Ins_ChangeInsWWW (void);
void Ins_ChangeInsStatus (void); void Ins_ChangeInsStatus (void);
void Ins_ContEditAfterChgIns (void); void Ins_ContEditAfterChgIns (void);

View File

@ -535,11 +535,7 @@ void InsCfg_ChangeInsCty (void)
{ {
extern const char *Txt_The_country_of_the_institution_X_has_changed_to_Y; extern const char *Txt_The_country_of_the_institution_X_has_changed_to_Y;
struct Hie_Node NewCty; struct Hie_Node NewCty;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_INS].ShrtName,
[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_INS].FullName,
};
/***** Get the new country code for the institution *****/ /***** Get the new country code for the institution *****/
NewCty.HieCod = ParCod_GetAndCheckPar (ParCod_OthCty); NewCty.HieCod = ParCod_GetAndCheckPar (ParCod_OthCty);
@ -551,8 +547,12 @@ void InsCfg_ChangeInsCty (void)
Cty_GetBasicCountryDataByCod (&NewCty); Cty_GetBasicCountryDataByCod (&NewCty);
/***** Check if it already exists an institution with the same name in the new country *****/ /***** Check if it already exists an institution with the same name in the new country *****/
if (!Nam_CheckIfNameExists (Ins_DB_CheckIfInsNameExistsInCty,Names, Names[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_INS].ShrtName;
-1L,NewCty.HieCod, Names[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_INS].FullName;
if (!Nam_CheckIfNameExists (Ins_DB_CheckIfInsNameExistsInCty,
Names,
-1L,
NewCty.HieCod,
0)) // Unused 0)) // Unused
{ {
/***** Update the table changing the country of the institution *****/ /***** Update the table changing the country of the institution *****/

View File

@ -96,7 +96,7 @@ static void Lnk_FreeListLinks (struct Lnk_Links *Links);
static void Lnk_ListLinksForEdition (const struct Lnk_Links *Links); static void Lnk_ListLinksForEdition (const struct Lnk_Links *Links);
static void Lnk_PutParLnkCod (void *LnkCod); static void Lnk_PutParLnkCod (void *LnkCod);
static void Lnk_RenameLink (Nam_ShrtOrFullName_t ShrtOrFullName); static void Lnk_RenameLink (Nam_ShrtOrFullName_t ShrtOrFull);
static void Lnk_PutFormToCreateLink (void); static void Lnk_PutFormToCreateLink (void);
static void Lnk_PutHeadLinks (void); static void Lnk_PutHeadLinks (void);
@ -524,11 +524,11 @@ void Lnk_RenameLinkFull (void)
/************************ Change the name of a link **************************/ /************************ Change the name of a link **************************/
/*****************************************************************************/ /*****************************************************************************/
static void Lnk_RenameLink (Nam_ShrtOrFullName_t ShrtOrFullName) static void Lnk_RenameLink (Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_X_already_exists; extern const char *Txt_X_already_exists;
extern const char *Txt_The_link_X_has_been_renamed_as_Y; extern const char *Txt_The_link_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
@ -544,7 +544,7 @@ static void Lnk_RenameLink (Nam_ShrtOrFullName_t ShrtOrFullName)
Lnk_EditingLnk->LnkCod = ParCod_GetAndCheckPar (ParCod_Lnk); Lnk_EditingLnk->LnkCod = ParCod_GetAndCheckPar (ParCod_Lnk);
/* Get the new name for the link */ /* Get the new name for the link */
Nam_GetParShrtOrFullName (ShrtOrFullName,NewName); Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get link data from the database *****/ /***** Get link data from the database *****/
Lnk_GetLinkDataByCod (Lnk_EditingLnk); Lnk_GetLinkDataByCod (Lnk_EditingLnk);
@ -554,10 +554,10 @@ static void Lnk_RenameLink (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If link was in database... *****/ /***** If link was in database... *****/
if (Lnk_DB_CheckIfLinkNameExists (Nam_ParShrtOrFullName[ShrtOrFullName], if (Lnk_DB_CheckIfLinkNameExists (Nam_Params[ShrtOrFull],
NewName,Lnk_EditingLnk->LnkCod, NewName,Lnk_EditingLnk->LnkCod,
-1L, // Unused -1L, // Unused
0)) // Unused 0)) // Unused
@ -566,25 +566,25 @@ static void Lnk_RenameLink (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Lnk_DB_UpdateLnkName (Lnk_EditingLnk->LnkCod, Lnk_DB_UpdateLnkName (Lnk_EditingLnk->LnkCod,
Nam_FldShrtOrFullName[ShrtOrFullName],NewName); Nam_Fields[ShrtOrFull],NewName);
/* Write message to show the change made */ /* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_link_X_has_been_renamed_as_Y, Txt_The_link_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName); CurrentName[ShrtOrFull],NewName);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,NULL, Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed, Txt_The_name_X_has_not_changed,
CurrentName[ShrtOrFullName]); CurrentName[ShrtOrFull]);
} }
else else
Ale_CreateAlertYouCanNotLeaveFieldEmpty (); Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
/***** Update name *****/ /***** Update name *****/
Str_Copy (CurrentName[ShrtOrFullName],NewName, Str_Copy (CurrentName[ShrtOrFull],NewName,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]); Nam_MaxBytes[ShrtOrFull]);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -649,11 +649,7 @@ void Lnk_ContEditAfterChgLnk (void)
static void Lnk_PutFormToCreateLink (void) static void Lnk_PutFormToCreateLink (void)
{ {
const char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Lnk_EditingLnk->ShrtName,
[Nam_FULL_NAME] = Lnk_EditingLnk->FullName,
};
/***** Begin form to create *****/ /***** Begin form to create *****/
Frm_BeginFormTable (ActNewLnk,NULL,NULL,NULL); Frm_BeginFormTable (ActNewLnk,NULL,NULL,NULL);
@ -672,6 +668,8 @@ static void Lnk_PutFormToCreateLink (void)
HTM_TD_End (); HTM_TD_End ();
/***** Link short name and full name *****/ /***** Link short name and full name *****/
Names[Nam_SHRT_NAME] = Lnk_EditingLnk->ShrtName;
Names[Nam_FULL_NAME] = Lnk_EditingLnk->FullName;
Nam_NewShortAndFullNames (Names); Nam_NewShortAndFullNames (Names);
/***** Link WWW *****/ /***** Link WWW *****/
@ -716,17 +714,15 @@ void Lnk_ReceiveFormNewLink (void)
{ {
extern const char *Txt_You_must_specify_the_web_address; extern const char *Txt_You_must_specify_the_web_address;
extern const char *Txt_Created_new_link_X; extern const char *Txt_Created_new_link_X;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Lnk_EditingLnk->ShrtName,
[Nam_FULL_NAME] = Lnk_EditingLnk->FullName,
};
/***** Link constructor *****/ /***** Link constructor *****/
Lnk_EditingLinkConstructor (); Lnk_EditingLinkConstructor ();
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get link short name and full name */ /* Get link short name and full name */
Names[Nam_SHRT_NAME] = Lnk_EditingLnk->ShrtName;
Names[Nam_FULL_NAME] = Lnk_EditingLnk->FullName;
Nam_GetParsShrtAndFullName (Names); Nam_GetParsShrtAndFullName (Names);
/* Get link URL */ /* Get link URL */
@ -736,7 +732,8 @@ void Lnk_ReceiveFormNewLink (void)
Lnk_EditingLnk->FullName[0]) // If there's a link name Lnk_EditingLnk->FullName[0]) // If there's a link name
{ {
/***** If name of link was in database... *****/ /***** If name of link was in database... *****/
if (!Nam_CheckIfNameExists (Lnk_DB_CheckIfLinkNameExists,Names, if (!Nam_CheckIfNameExists (Lnk_DB_CheckIfLinkNameExists,
(const char **) Names,
-1L, -1L,
-1L, // Unused -1L, // Unused
0)) // Unused 0)) // Unused

View File

@ -91,7 +91,7 @@ static void Mai_FreeListMailDomains (struct Mai_Mails *Mails);
static void Mai_ListMailDomainsForEdition (const struct Mai_Mails *Mails); static void Mai_ListMailDomainsForEdition (const struct Mai_Mails *Mails);
static void Mai_PutParMaiCod (void *MaiCod); static void Mai_PutParMaiCod (void *MaiCod);
static void Mai_RenameMailDomain (Nam_ShrtOrFullName_t ShrtOrFullName); static void Mai_RenameMailDomain (Nam_ShrtOrFullName_t ShrtOrFull);
static void Mai_PutFormToCreateMailDomain (void); static void Mai_PutFormToCreateMailDomain (void);
static void Mai_PutHeadMailDomains (void); static void Mai_PutHeadMailDomains (void);
@ -585,7 +585,7 @@ void Mai_RenameMailDomainFull (void)
/************************* Change the name of a mail *************************/ /************************* Change the name of a mail *************************/
/*****************************************************************************/ /*****************************************************************************/
static void Mai_RenameMailDomain (Nam_ShrtOrFullName_t ShrtOrFullName) static void Mai_RenameMailDomain (Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Txt_The_email_domain_X_already_exists; extern const char *Txt_The_email_domain_X_already_exists;
extern const char *Txt_The_email_domain_X_has_been_renamed_as_Y; extern const char *Txt_The_email_domain_X_has_been_renamed_as_Y;
@ -617,7 +617,7 @@ static void Mai_RenameMailDomain (Nam_ShrtOrFullName_t ShrtOrFullName)
Mai_EditingMai->MaiCod = ParCod_GetAndCheckPar (ParCod_Mai); Mai_EditingMai->MaiCod = ParCod_GetAndCheckPar (ParCod_Mai);
/* Get the new name for the mail */ /* Get the new name for the mail */
Par_GetParText (ParName[ShrtOrFullName],NewName,MaxBytes[ShrtOrFullName]); Par_GetParText (ParName[ShrtOrFull],NewName,MaxBytes[ShrtOrFull]);
/***** Get from the database the old names of the mail *****/ /***** Get from the database the old names of the mail *****/
Mai_GetMailDomainDataByCod (Mai_EditingMai); Mai_GetMailDomainDataByCod (Mai_EditingMai);
@ -627,34 +627,34 @@ static void Mai_RenameMailDomain (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If mail was in database... *****/ /***** If mail was in database... *****/
if (Mai_DB_CheckIfMailDomainNameExists (ParName[ShrtOrFullName],NewName,Mai_EditingMai->MaiCod)) if (Mai_DB_CheckIfMailDomainNameExists (ParName[ShrtOrFull],NewName,Mai_EditingMai->MaiCod))
Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID, Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
Txt_The_email_domain_X_already_exists, Txt_The_email_domain_X_already_exists,
NewName); NewName);
else else
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Mai_DB_UpdateMailDomainName (Mai_EditingMai->MaiCod,FldName[ShrtOrFullName],NewName); Mai_DB_UpdateMailDomainName (Mai_EditingMai->MaiCod,FldName[ShrtOrFull],NewName);
/* Write message to show the change made */ /* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID, Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID,
Txt_The_email_domain_X_has_been_renamed_as_Y, Txt_The_email_domain_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName); CurrentName[ShrtOrFull],NewName);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,Mai_EMAIL_SECTION_ID, Ale_CreateAlert (Ale_INFO,Mai_EMAIL_SECTION_ID,
Txt_The_email_domain_X_has_not_changed, Txt_The_email_domain_X_has_not_changed,
CurrentName[ShrtOrFullName]); CurrentName[ShrtOrFull]);
} }
else else
Ale_CreateAlertYouCanNotLeaveFieldEmpty (); Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
/***** Update name *****/ /***** Update name *****/
Str_Copy (CurrentName[ShrtOrFullName],NewName,MaxBytes[ShrtOrFullName]); Str_Copy (CurrentName[ShrtOrFull],NewName,MaxBytes[ShrtOrFull]);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -36,77 +36,49 @@
/***************************** Public constants ******************************/ /***************************** Public constants ******************************/
/*****************************************************************************/ /*****************************************************************************/
const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] = const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES] =
{ {
[Nam_SHRT_NAME] = "ShortName", [Nam_SHRT_NAME] = "ShortName",
[Nam_FULL_NAME] = "FullName", [Nam_FULL_NAME] = "FullName",
}; };
const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] = const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES] =
{ {
[Nam_SHRT_NAME] = "ShortName", [Nam_SHRT_NAME] = "ShortName",
[Nam_FULL_NAME] = "FullName", [Nam_FULL_NAME] = "FullName",
}; };
unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] = unsigned Nam_MaxChars[Nam_NUM_SHRT_FULL_NAMES] =
{ {
[Nam_SHRT_NAME] = Nam_MAX_CHARS_SHRT_NAME, [Nam_SHRT_NAME] = Nam_MAX_CHARS_SHRT_NAME,
[Nam_FULL_NAME] = Nam_MAX_CHARS_FULL_NAME, [Nam_FULL_NAME] = Nam_MAX_CHARS_FULL_NAME,
}; };
unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] = unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES] =
{ {
[Nam_SHRT_NAME] = Nam_MAX_BYTES_SHRT_NAME, [Nam_SHRT_NAME] = Nam_MAX_BYTES_SHRT_NAME,
[Nam_FULL_NAME] = Nam_MAX_BYTES_FULL_NAME, [Nam_FULL_NAME] = Nam_MAX_BYTES_FULL_NAME,
}; };
const char *Nam_ClassShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] = const char *Nam_Classes[Nam_NUM_SHRT_FULL_NAMES] =
{ {
[Nam_SHRT_NAME] = "INPUT_SHORT_NAME", [Nam_SHRT_NAME] = "INPUT_SHORT_NAME",
[Nam_FULL_NAME] = "INPUT_FULL_NAME", [Nam_FULL_NAME] = "INPUT_FULL_NAME",
}; };
/*****************************************************************************/
/**************************** Private constants ******************************/
/*****************************************************************************/
/*****************************************************************************/
/******************************* Private types *******************************/
/*****************************************************************************/
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
/*****************************************************************************/
/************************** Public global variables **************************/
/*****************************************************************************/
/*****************************************************************************/
/************************* Private global variables **************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private prototypes ****************************/
/*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/************************ Get short name and full name ***********************/ /************************ Get short name and full name ***********************/
/*****************************************************************************/ /*****************************************************************************/
void Nam_GetParsShrtAndFullName (char *Names[Nam_NUM_SHRT_FULL_NAMES]) void Nam_GetParsShrtAndFullName (char *Names[Nam_NUM_SHRT_FULL_NAMES])
{ {
Nam_ShrtOrFullName_t ShrtOrFullName; Nam_ShrtOrFullName_t ShrtOrFull;
for (ShrtOrFullName = Nam_SHRT_NAME; for (ShrtOrFull = Nam_SHRT_NAME;
ShrtOrFullName <= Nam_FULL_NAME; ShrtOrFull <= Nam_FULL_NAME;
ShrtOrFullName++) ShrtOrFull++)
Nam_GetParShrtOrFullName (ShrtOrFullName,Names[ShrtOrFullName]); Nam_GetParShrtOrFullName (ShrtOrFull,Names[ShrtOrFull]);
} }
void Nam_GetParShrtOrFullName (Nam_ShrtOrFullName_t ShrtOrFullName,char *Name) void Nam_GetParShrtOrFullName (Nam_ShrtOrFullName_t ShrtOrFull,char *Name)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; Par_GetParText (Nam_Params[ShrtOrFull],Name,Nam_MaxBytes[ShrtOrFull]);
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
Par_GetParText (Nam_ParShrtOrFullName[ShrtOrFullName],Name,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -115,24 +87,18 @@ void Nam_GetParShrtOrFullName (Nam_ShrtOrFullName_t ShrtOrFullName,char *Name)
void Nam_NewShortAndFullNames (const char *Names[Nam_NUM_SHRT_FULL_NAMES]) void Nam_NewShortAndFullNames (const char *Names[Nam_NUM_SHRT_FULL_NAMES])
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; Nam_ShrtOrFullName_t ShrtOrFull;
extern unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_ClassShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
Nam_ShrtOrFullName_t ShrtOrFullName;
for (ShrtOrFullName = Nam_SHRT_NAME; for (ShrtOrFull = Nam_SHRT_NAME;
ShrtOrFullName <= Nam_FULL_NAME; ShrtOrFull <= Nam_FULL_NAME;
ShrtOrFullName++) ShrtOrFull++)
{ {
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
HTM_INPUT_TEXT (Nam_ParShrtOrFullName[ShrtOrFullName], HTM_INPUT_TEXT (Nam_Params[ShrtOrFull],Nam_MaxChars[ShrtOrFull],
Nam_MaxCharsShrtOrFullName[ShrtOrFullName], Names[ShrtOrFull],
Names[ShrtOrFullName],
HTM_DONT_SUBMIT_ON_CHANGE, HTM_DONT_SUBMIT_ON_CHANGE,
"class=\"%s INPUT_%s\"" "class=\"%s INPUT_%s\" required=\"required\"",
" required=\"required\"", Nam_Classes[ShrtOrFull],The_GetSuffix ());
Nam_ClassShrtOrFullName[ShrtOrFullName],
The_GetSuffix ());
HTM_TD_End (); HTM_TD_End ();
} }
} }
@ -142,32 +108,26 @@ void Nam_ExistingShortAndFullNames (Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_
const char *Names[Nam_NUM_SHRT_FULL_NAMES], const char *Names[Nam_NUM_SHRT_FULL_NAMES],
bool PutForm) bool PutForm)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; Nam_ShrtOrFullName_t ShrtOrFull;
extern unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_ClassShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
Nam_ShrtOrFullName_t ShrtOrFullName;
for (ShrtOrFullName = Nam_SHRT_NAME; for (ShrtOrFull = Nam_SHRT_NAME;
ShrtOrFullName <= Nam_FULL_NAME; ShrtOrFull <= Nam_FULL_NAME;
ShrtOrFullName++) ShrtOrFull++)
{ {
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
if (PutForm) if (PutForm)
{ {
Frm_BeginForm (ActionRename[ShrtOrFullName]); Frm_BeginForm (ActionRename[ShrtOrFull]);
ParCod_PutPar (ParCod,Cod); ParCod_PutPar (ParCod,Cod);
HTM_INPUT_TEXT (Nam_ParShrtOrFullName[ShrtOrFullName], HTM_INPUT_TEXT (Nam_Params[ShrtOrFull],Nam_MaxChars[ShrtOrFull],
Nam_MaxCharsShrtOrFullName[ShrtOrFullName], Names[ShrtOrFull],
Names[ShrtOrFullName],
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"class=\"%s INPUT_%s\"" "class=\"%s INPUT_%s\" required=\"required\"",
" required=\"required\"", Nam_Classes[ShrtOrFull],The_GetSuffix ());
Nam_ClassShrtOrFullName[ShrtOrFullName],
The_GetSuffix ());
Frm_EndForm (); Frm_EndForm ();
} }
else else
HTM_Txt (Names[ShrtOrFullName]); HTM_Txt (Names[ShrtOrFull]);
HTM_TD_End (); HTM_TD_End ();
} }
} }
@ -178,21 +138,18 @@ void Nam_ExistingShortAndFullNames (Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_
bool Nam_CheckIfNameExists (bool (*FuncToCheck) (const char *FldName,const char *Name, bool Nam_CheckIfNameExists (bool (*FuncToCheck) (const char *FldName,const char *Name,
long Cod,long PrtCod,unsigned Year), long Cod,long PrtCod,unsigned Year),
char *Names[Nam_NUM_SHRT_FULL_NAMES], const char *Names[Nam_NUM_SHRT_FULL_NAMES],
long Cod,long PrtCod,unsigned Year) long Cod,long PrtCod,unsigned Year)
{ {
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_X_already_exists; extern const char *Txt_X_already_exists;
Nam_ShrtOrFullName_t ShrtOrFullName; Nam_ShrtOrFullName_t ShrtOrFull;
for (ShrtOrFullName = Nam_SHRT_NAME; for (ShrtOrFull = Nam_SHRT_NAME;
ShrtOrFullName <= Nam_FULL_NAME; ShrtOrFull <= Nam_FULL_NAME;
ShrtOrFullName++) ShrtOrFull++)
if (FuncToCheck (Nam_FldShrtOrFullName[ShrtOrFullName], if (FuncToCheck (Nam_Fields[ShrtOrFull],Names[ShrtOrFull],Cod,PrtCod,Year))
Names[ShrtOrFullName],Cod,PrtCod,Year))
{ {
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists, Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,Names[ShrtOrFull]);
Names[ShrtOrFullName]);
return true; // Exists return true; // Exists
} }

View File

@ -58,7 +58,7 @@ typedef enum
/*****************************************************************************/ /*****************************************************************************/
void Nam_GetParsShrtAndFullName (char *Names[Nam_NUM_SHRT_FULL_NAMES]); void Nam_GetParsShrtAndFullName (char *Names[Nam_NUM_SHRT_FULL_NAMES]);
void Nam_GetParShrtOrFullName (Nam_ShrtOrFullName_t ShrtOrFullName,char *Name); void Nam_GetParShrtOrFullName (Nam_ShrtOrFullName_t ShrtOrFull,char *Name);
void Nam_NewShortAndFullNames (const char *Names[Nam_NUM_SHRT_FULL_NAMES]); void Nam_NewShortAndFullNames (const char *Names[Nam_NUM_SHRT_FULL_NAMES]);
void Nam_ExistingShortAndFullNames (Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_NAMES], void Nam_ExistingShortAndFullNames (Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_NAMES],
@ -68,7 +68,7 @@ void Nam_ExistingShortAndFullNames (Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_
bool Nam_CheckIfNameExists (bool (*FuncToCheck) (const char *FldName,const char *Name, bool Nam_CheckIfNameExists (bool (*FuncToCheck) (const char *FldName,const char *Name,
long Cod,long PrtCod,unsigned Year), long Cod,long PrtCod,unsigned Year),
char *Names[Nam_NUM_SHRT_FULL_NAMES], const char *Names[Nam_NUM_SHRT_FULL_NAMES],
long Cod,long PrtCod,unsigned Year); long Cod,long PrtCod,unsigned Year);
#endif #endif

View File

@ -83,7 +83,7 @@ static void Plc_GetPlaceDataFromRow (MYSQL_RES *mysql_res,struct Plc_Place *Plc)
static void Plc_ListPlacesForEdition (const struct Plc_Places *Places); static void Plc_ListPlacesForEdition (const struct Plc_Places *Places);
static void Plc_PutParPlcCod (void *PlcCod); static void Plc_PutParPlcCod (void *PlcCod);
static void Plc_RenamePlace (Nam_ShrtOrFullName_t ShrtOrFullName); static void Plc_RenamePlace (Nam_ShrtOrFullName_t ShrtOrFull);
static void Plc_PutFormToCreatePlace (void); static void Plc_PutFormToCreatePlace (void);
static void Plc_PutHeadPlaces (void); static void Plc_PutHeadPlaces (void);
@ -577,11 +577,11 @@ void Plc_RenamePlaceFull (void)
/************************ Change the name of a place *************************/ /************************ Change the name of a place *************************/
/*****************************************************************************/ /*****************************************************************************/
static void Plc_RenamePlace (Nam_ShrtOrFullName_t ShrtOrFullName) static void Plc_RenamePlace (Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_X_already_exists; extern const char *Txt_X_already_exists;
extern const char *Txt_The_place_X_has_been_renamed_as_Y; extern const char *Txt_The_place_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
@ -597,7 +597,7 @@ static void Plc_RenamePlace (Nam_ShrtOrFullName_t ShrtOrFullName)
Plc_EditingPlc->PlcCod = ParCod_GetAndCheckPar (ParCod_Plc); Plc_EditingPlc->PlcCod = ParCod_GetAndCheckPar (ParCod_Plc);
/* Get the new name for the place */ /* Get the new name for the place */
Nam_GetParShrtOrFullName (ShrtOrFullName,NewName); Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get place old names from database *****/ /***** Get place old names from database *****/
Plc_GetPlaceDataByCod (Plc_EditingPlc); Plc_GetPlaceDataByCod (Plc_EditingPlc);
@ -607,10 +607,10 @@ static void Plc_RenamePlace (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If place was in database... *****/ /***** If place was in database... *****/
if (Plc_DB_CheckIfPlaceNameExists (Nam_ParShrtOrFullName[ShrtOrFullName], if (Plc_DB_CheckIfPlaceNameExists (Nam_Params[ShrtOrFull],
NewName,Plc_EditingPlc->PlcCod, NewName,Plc_EditingPlc->PlcCod,
Gbl.Hierarchy.Node[Hie_INS].HieCod, Gbl.Hierarchy.Node[Hie_INS].HieCod,
0)) // Unused 0)) // Unused
@ -619,25 +619,25 @@ static void Plc_RenamePlace (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Plc_DB_UpdatePlcName (Plc_EditingPlc->PlcCod, Plc_DB_UpdatePlcName (Plc_EditingPlc->PlcCod,
Nam_FldShrtOrFullName[ShrtOrFullName],NewName); Nam_Fields[ShrtOrFull],NewName);
/* Write message to show the change made */ /* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_place_X_has_been_renamed_as_Y, Txt_The_place_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName); CurrentName[ShrtOrFull],NewName);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,NULL, Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed, Txt_The_name_X_has_not_changed,
CurrentName[ShrtOrFullName]); CurrentName[ShrtOrFull]);
} }
else else
Ale_CreateAlertYouCanNotLeaveFieldEmpty (); Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
/***** Update place name *****/ /***** Update place name *****/
Str_Copy (CurrentName[ShrtOrFullName],NewName, Str_Copy (CurrentName[ShrtOrFull],NewName,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]); Nam_MaxBytes[ShrtOrFull]);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -662,11 +662,7 @@ void Plc_ContEditAfterChgPlc (void)
static void Plc_PutFormToCreatePlace (void) static void Plc_PutFormToCreatePlace (void)
{ {
const char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Plc_EditingPlc->ShrtName,
[Nam_FULL_NAME] = Plc_EditingPlc->FullName,
};
/***** Begin form to create *****/ /***** Begin form to create *****/
Frm_BeginFormTable (ActNewPlc,NULL,NULL,NULL); Frm_BeginFormTable (ActNewPlc,NULL,NULL,NULL);
@ -685,6 +681,8 @@ static void Plc_PutFormToCreatePlace (void)
HTM_TD_End (); HTM_TD_End ();
/***** Place short name and full name *****/ /***** Place short name and full name *****/
Names[Nam_SHRT_NAME] = Plc_EditingPlc->ShrtName;
Names[Nam_FULL_NAME] = Plc_EditingPlc->FullName;
Nam_NewShortAndFullNames (Names); Nam_NewShortAndFullNames (Names);
/***** Number of centers *****/ /***** Number of centers *****/
@ -725,25 +723,25 @@ static void Plc_PutHeadPlaces (void)
void Plc_ReceiveFormNewPlace (void) void Plc_ReceiveFormNewPlace (void)
{ {
extern const char *Txt_Created_new_place_X; extern const char *Txt_Created_new_place_X;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Plc_EditingPlc->ShrtName,
[Nam_FULL_NAME] = Plc_EditingPlc->FullName,
};
/***** Place constructor *****/ /***** Place constructor *****/
Plc_EditingPlaceConstructor (); Plc_EditingPlaceConstructor ();
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get place short name and full name */ /* Get place short name and full name */
Names[Nam_SHRT_NAME] = Plc_EditingPlc->ShrtName;
Names[Nam_FULL_NAME] = Plc_EditingPlc->FullName;
Nam_GetParsShrtAndFullName (Names); Nam_GetParsShrtAndFullName (Names);
if (Plc_EditingPlc->ShrtName[0] && if (Plc_EditingPlc->ShrtName[0] &&
Plc_EditingPlc->FullName[0]) // If there's a place name Plc_EditingPlc->FullName[0]) // If there's a place name
{ {
/***** If name of place was not in database... *****/ /***** If name of place was not in database... *****/
if (!Nam_CheckIfNameExists (Plc_DB_CheckIfPlaceNameExists,Names, if (!Nam_CheckIfNameExists (Plc_DB_CheckIfPlaceNameExists,
-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod, (const char **) Names,
-1L,
Gbl.Hierarchy.Node[Hie_INS].HieCod,
0)) // Unused 0)) // Unused
{ {
Plc_DB_CreatePlace (Plc_EditingPlc); Plc_DB_CreatePlace (Plc_EditingPlc);

View File

@ -122,7 +122,7 @@ static void Roo_PutSelectorType (Roo_RoomType_t RoomType,
static int Roo_GetParFloor (void); static int Roo_GetParFloor (void);
static Roo_RoomType_t Roo_GetParType (void); static Roo_RoomType_t Roo_GetParType (void);
static void Roo_RenameRoom (Nam_ShrtOrFullName_t ShrtOrFullName); static void Roo_RenameRoom (Nam_ShrtOrFullName_t ShrtOrFull);
static void Roo_WriteCapacity (char Str[Cns_MAX_DECIMAL_DIGITS_UINT + 1],unsigned Capacity); static void Roo_WriteCapacity (char Str[Cns_MAX_DECIMAL_DIGITS_UINT + 1],unsigned Capacity);
@ -1044,11 +1044,11 @@ void Roo_RenameRoomFull (void)
/************************* Change the name of a room *************************/ /************************* Change the name of a room *************************/
/*****************************************************************************/ /*****************************************************************************/
static void Roo_RenameRoom (Nam_ShrtOrFullName_t ShrtOrFullName) static void Roo_RenameRoom (Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_X_already_exists; extern const char *Txt_X_already_exists;
extern const char *Txt_The_room_X_has_been_renamed_as_Y; extern const char *Txt_The_room_X_has_been_renamed_as_Y;
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
@ -1064,7 +1064,7 @@ static void Roo_RenameRoom (Nam_ShrtOrFullName_t ShrtOrFullName)
Roo_EditingRoom->RooCod = ParCod_GetAndCheckPar (ParCod_Roo); Roo_EditingRoom->RooCod = ParCod_GetAndCheckPar (ParCod_Roo);
/* Get the new name for the room */ /* Get the new name for the room */
Nam_GetParShrtOrFullName (ShrtOrFullName,NewName); Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get from the database the old names of the room *****/ /***** Get from the database the old names of the room *****/
Roo_GetRoomDataByCod (Roo_EditingRoom); Roo_GetRoomDataByCod (Roo_EditingRoom);
@ -1074,10 +1074,10 @@ static void Roo_RenameRoom (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names if (strcmp (CurrentName[ShrtOrFull],NewName)) // Different names
{ {
/***** If room was in database... *****/ /***** If room was in database... *****/
if (Roo_DB_CheckIfRoomNameExists (Nam_ParShrtOrFullName[ShrtOrFullName], if (Roo_DB_CheckIfRoomNameExists (Nam_Params[ShrtOrFull],
NewName,Roo_EditingRoom->RooCod, NewName,Roo_EditingRoom->RooCod,
Gbl.Hierarchy.Node[Hie_CTR].HieCod, Gbl.Hierarchy.Node[Hie_CTR].HieCod,
0)) // Unused 0)) // Unused
@ -1087,25 +1087,25 @@ static void Roo_RenameRoom (Nam_ShrtOrFullName_t ShrtOrFullName)
{ {
/* Update the table changing old name by new name */ /* Update the table changing old name by new name */
Roo_DB_UpdateRoomName (Roo_EditingRoom->RooCod, Roo_DB_UpdateRoomName (Roo_EditingRoom->RooCod,
Nam_FldShrtOrFullName[ShrtOrFullName],NewName); Nam_Fields[ShrtOrFull],NewName);
/* Write message to show the change made */ /* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_room_X_has_been_renamed_as_Y, Txt_The_room_X_has_been_renamed_as_Y,
CurrentName[ShrtOrFullName],NewName); CurrentName[ShrtOrFull],NewName);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,NULL, Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed, Txt_The_name_X_has_not_changed,
CurrentName[ShrtOrFullName]); CurrentName[ShrtOrFull]);
} }
else else
Ale_CreateAlertYouCanNotLeaveFieldEmpty (); Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
/***** Update room name *****/ /***** Update room name *****/
Str_Copy (CurrentName[ShrtOrFullName],NewName, Str_Copy (CurrentName[ShrtOrFull],NewName,
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]); Nam_MaxBytes[ShrtOrFull]);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1197,11 +1197,7 @@ static void Roo_PutFormToCreateRoom (const struct Bld_Buildings *Buildings)
{ {
char StrCapacity[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char StrCapacity[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
char MACstr[MAC_LENGTH_MAC_ADDRESS + 1]; // MAC address in xx:xx:xx:xx:xx:xx format char MACstr[MAC_LENGTH_MAC_ADDRESS + 1]; // MAC address in xx:xx:xx:xx:xx:xx format
const char *Names[Nam_NUM_SHRT_FULL_NAMES] = const char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Roo_EditingRoom->ShrtName,
[Nam_FULL_NAME] = Roo_EditingRoom->FullName,
};
/***** Begin form to create *****/ /***** Begin form to create *****/
Frm_BeginFormTable (ActNewRoo,NULL,NULL,NULL); Frm_BeginFormTable (ActNewRoo,NULL,NULL,NULL);
@ -1240,6 +1236,8 @@ static void Roo_PutFormToCreateRoom (const struct Bld_Buildings *Buildings)
HTM_TD_End (); HTM_TD_End ();
/***** Room short name and full name *****/ /***** Room short name and full name *****/
Names[Nam_SHRT_NAME] = Roo_EditingRoom->ShrtName;
Names[Nam_FULL_NAME] = Roo_EditingRoom->FullName;
Nam_NewShortAndFullNames (Names); Nam_NewShortAndFullNames (Names);
/***** Seating capacity *****/ /***** Seating capacity *****/
@ -1301,11 +1299,7 @@ static void Roo_PutHeadRooms (void)
void Roo_ReceiveFormNewRoom (void) void Roo_ReceiveFormNewRoom (void)
{ {
extern const char *Txt_Created_new_room_X; extern const char *Txt_Created_new_room_X;
char *Names[Nam_NUM_SHRT_FULL_NAMES] = char *Names[Nam_NUM_SHRT_FULL_NAMES];
{
[Nam_SHRT_NAME] = Roo_EditingRoom->ShrtName,
[Nam_FULL_NAME] = Roo_EditingRoom->FullName,
};
/***** Room constructor *****/ /***** Room constructor *****/
Roo_EditingRoomConstructor (); Roo_EditingRoomConstructor ();
@ -1317,6 +1311,8 @@ void Roo_ReceiveFormNewRoom (void)
Roo_EditingRoom->Type = Roo_GetParType (); Roo_EditingRoom->Type = Roo_GetParType ();
/* Get room short name and full name */ /* Get room short name and full name */
Names[Nam_SHRT_NAME] = Roo_EditingRoom->ShrtName;
Names[Nam_FULL_NAME] = Roo_EditingRoom->FullName;
Nam_GetParsShrtAndFullName (Names); Nam_GetParsShrtAndFullName (Names);
/* Get seating capacity */ /* Get seating capacity */
@ -1333,8 +1329,10 @@ void Roo_ReceiveFormNewRoom (void)
Roo_EditingRoom->FullName[0]) // If there's a room name Roo_EditingRoom->FullName[0]) // If there's a room name
{ {
/***** If name of room was not in database... *****/ /***** If name of room was not in database... *****/
if (!Nam_CheckIfNameExists (Roo_DB_CheckIfRoomNameExists,Names, if (!Nam_CheckIfNameExists (Roo_DB_CheckIfRoomNameExists,
-1L,Gbl.Hierarchy.Node[Hie_CTR].HieCod, (const char **) Names,
-1L,
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
0)) // Unused 0)) // Unused
{ {
Roo_CreateRoom (Roo_EditingRoom); Roo_CreateRoom (Roo_EditingRoom);