Version 23.6.1: Sep 18, 2023 Code refactoring in hierarchy.

This commit is contained in:
acanas 2023-09-18 13:10:53 +02:00
parent 5ee487e595
commit 9f5d3e4688
20 changed files with 117 additions and 89 deletions

View File

@ -217,7 +217,7 @@ void Cal_DrawCurrentMonth (void)
HTM_TxtF ("\tDrawCurrentMonth ('CurrentMonth',%u,%ld,%ld,'%s','%s/%s',",
Gbl.Prefs.FirstDayOfWeek,
(long) Dat_GetStartExecutionTimeUTC (),
Gbl.Hierarchy.Ctr.PlcCod,
Gbl.Hierarchy.Ctr.Specific.PlcCod,
The_GetSuffix (),
Cfg_URL_SWAD_CGI,Lan_STR_LANG_ID[Gbl.Prefs.Language]);
Frm_SetParsForm (ParsStr,ActSeeCal,true);
@ -286,7 +286,7 @@ static void Cal_DrawCalendar (Act_Action_t ActionSeeCalendar,
HTM_TxtF ("\tCal_DrawCalendar('calendar',%u,%ld,%ld,%s,'%s','%s/%s',",
Gbl.Prefs.FirstDayOfWeek,
(long) Dat_GetStartExecutionTimeUTC (),
Gbl.Hierarchy.Ctr.PlcCod,
Gbl.Hierarchy.Ctr.Specific.PlcCod,
PrintView ? "true" :
"false",
The_GetSuffix (),

View File

@ -183,7 +183,7 @@ static long Cfe_GetParsCallsForExams (struct Cfe_CallsForExams *CallsForExams)
Par_GetParUnsignedLong ("Year",
0, // N.A.
Deg_MAX_YEARS_PER_DEGREE,
(unsigned long) Gbl.Hierarchy.Crs.Year);
(unsigned long) Gbl.Hierarchy.Crs.Specific.Year);
/***** Get the type of call for exam *****/
Par_GetParText ("ExamSession",CallsForExams->CallForExam.Session,Cfe_MAX_BYTES_SESSION);

View File

@ -357,7 +357,7 @@ static void Ctr_ListOneCenterForSeeing (struct Ctr_Center *Ctr,unsigned NumCtr)
/***** Place *****/
HTM_TD_Begin ("class=\"LM %s_%s %s\"",
TxtClassNormal,The_GetSuffix (),BgColor);
Plc.PlcCod = Ctr->PlcCod;
Plc.PlcCod = Ctr->Specific.PlcCod;
Plc_GetPlaceDataByCod (&Plc);
HTM_Txt (Plc.ShrtName);
HTM_TD_End ();
@ -554,7 +554,7 @@ bool Ctr_GetCenterDataByCod (struct Ctr_Center *Ctr)
/***** Clear data *****/
Ctr->PrtCod = -1L;
Ctr->PlcCod = -1L;
Ctr->Specific.PlcCod = -1L;
Ctr->Status = (Hie_Status_t) 0;
Ctr->RequesterUsrCod = -1L;
Ctr->ShrtName[0] = '\0';
@ -622,7 +622,7 @@ static void Ctr_GetCenterDataFromRow (MYSQL_RES *mysql_res,
Ctr->PrtCod = Str_ConvertStrCodToLongCod (row[1]);
/***** Get place code (row[2]) *****/
Ctr->PlcCod = Str_ConvertStrCodToLongCod (row[2]);
Ctr->Specific.PlcCod = Str_ConvertStrCodToLongCod (row[2]);
/***** Get center status (row[3]) *****/
if (sscanf (row[3],"%u",&(Ctr->Status)) != 1)
@ -822,8 +822,8 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
" class=\"PLC_SEL INPUT_%s\"",
The_GetSuffix ());
HTM_OPTION (HTM_Type_STRING,"0",
Ctr->PlcCod == 0 ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
Ctr->Specific.PlcCod == 0 ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Txt_Another_place);
for (NumPlc = 0;
@ -832,8 +832,8 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
{
PlcInLst = &Places->Lst[NumPlc];
HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod,
PlcInLst->PlcCod == Ctr->PlcCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
PlcInLst->PlcCod == Ctr->Specific.PlcCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",PlcInLst->ShrtName);
}
@ -844,7 +844,7 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
for (NumPlc = 0;
NumPlc < Places->Num;
NumPlc++)
if (Places->Lst[NumPlc].PlcCod == Ctr->PlcCod)
if (Places->Lst[NumPlc].PlcCod == Ctr->Specific.PlcCod)
HTM_Txt (Places->Lst[NumPlc].ShrtName);
HTM_TD_End ();
@ -1054,7 +1054,7 @@ void Ctr_ChangeCtrPlc (void)
/***** Update place in table of centers *****/
Ctr_DB_UpdateCtrPlc (Ctr_EditingCtr->Cod,NewPlcCod);
Ctr_EditingCtr->PlcCod = NewPlcCod;
Ctr_EditingCtr->Specific.PlcCod = NewPlcCod;
/***** Create alert to show the change made
and put button to go to center changed *****/
@ -1314,8 +1314,8 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
"name=\"PlcCod\" class=\"PLC_SEL INPUT_%s\"",
The_GetSuffix ());
HTM_OPTION (HTM_Type_STRING,"0",
Ctr_EditingCtr->PlcCod == 0 ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
Ctr_EditingCtr->Specific.PlcCod == 0 ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Txt_Another_place);
for (NumPlc = 0;
@ -1324,8 +1324,8 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
{
PlcInLst = &Places->Lst[NumPlc];
HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod,
PlcInLst->PlcCod == Ctr_EditingCtr->PlcCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
PlcInLst->PlcCod == Ctr_EditingCtr->Specific.PlcCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",PlcInLst->ShrtName);
}
@ -1528,7 +1528,7 @@ static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
Ctr_EditingCtr->PrtCod = Gbl.Hierarchy.Ins.Cod;
/* Get place */
Ctr_EditingCtr->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 */
Par_GetParText ("ShortName",Ctr_EditingCtr->ShrtName,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);
@ -1874,7 +1874,7 @@ static void Ctr_EditingCenterConstructor (void)
/***** Reset center *****/
Ctr_EditingCtr->Cod = -1L;
Ctr_EditingCtr->PrtCod = -1L;
Ctr_EditingCtr->PlcCod = -1L;
Ctr_EditingCtr->Specific.PlcCod = -1L;
Ctr_EditingCtr->Status = (Hie_Status_t) 0;
Ctr_EditingCtr->RequesterUsrCod = -1L;
Ctr_EditingCtr->ShrtName[0] = '\0';

View File

@ -45,7 +45,12 @@ struct Ctr_Center
{
long Cod; // Center code
long PrtCod; // Parent (institution) code
long PlcCod; // Place code
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
Hie_Status_t Status; // Center status
long RequesterUsrCod; // User code of the person who requested the creation of this center
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1];

View File

@ -679,8 +679,8 @@ static void CtrCfg_Place (bool PutForm)
" class=\"INPUT_SHORT_NAME INPUT_%s\"",
The_GetSuffix ());
HTM_OPTION (HTM_Type_STRING,"0",
Gbl.Hierarchy.Ctr.PlcCod == 0 ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
Gbl.Hierarchy.Ctr.Specific.PlcCod == 0 ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Txt_Another_place);
for (NumPlc = 0;
@ -689,8 +689,8 @@ static void CtrCfg_Place (bool PutForm)
{
PlcInLst = &Places.Lst[NumPlc];
HTM_OPTION (HTM_Type_LONG,&PlcInLst->PlcCod,
PlcInLst->PlcCod == Gbl.Hierarchy.Ctr.PlcCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
PlcInLst->PlcCod == Gbl.Hierarchy.Ctr.Specific.PlcCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",PlcInLst->ShrtName);
}
@ -703,7 +703,7 @@ static void CtrCfg_Place (bool PutForm)
else // I can not change center place
{
/* Text with the place name */
Plc.PlcCod = Gbl.Hierarchy.Ctr.PlcCod;
Plc.PlcCod = Gbl.Hierarchy.Ctr.Specific.PlcCod;
Plc_GetPlaceDataByCod (&Plc);
HTM_Txt (Plc.FullName);
}
@ -1089,7 +1089,7 @@ void CtrCfg_ChangeCtrPlc (void)
/***** Update place in table of centers *****/
Ctr_DB_UpdateCtrPlc (Gbl.Hierarchy.Ctr.Cod,NewPlcCod);
Gbl.Hierarchy.Ctr.PlcCod = NewPlcCod;
Gbl.Hierarchy.Ctr.Specific.PlcCod = NewPlcCod;
/***** Write message to show the change made *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_place_of_the_center_has_changed);

View File

@ -60,7 +60,7 @@ long Ctr_DB_CreateCenter (const struct Ctr_Center *Ctr,Hie_Status_t Status)
" (%ld,%ld,%u,%ld,"
"'%s','%s','%s','')",
Ctr->PrtCod,
Ctr->PlcCod,
Ctr->Specific.PlcCod,
(unsigned) Status,
Gbl.Usrs.Me.UsrDat.UsrCod,
Ctr->ShrtName,

View File

@ -632,10 +632,11 @@ TODO: Francisco Javier Fern
Me sale este error, no si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/
#define Log_PLATFORM_VERSION "SWAD 23.6 (2023-09-18)"
#define Log_PLATFORM_VERSION "SWAD 23.6.1 (2023-09-18)"
#define CSS_FILE "swad22.120.4.css"
#define JS_FILE "swad22.49.js"
/*
Version 23.6.1: Sep 18, 2023 Code refactoring in hierarchy. (337727 lines)
Version 23.6: Sep 18, 2023 Code refactoring in centers and coordinates. (337699 lines)
Version 23.5.1: Sep 18, 2023 Code refactoring in edition of countries. (337657 lines)
Version 23.5: Sep 15, 2023 Code refactoring in edition of countries. (337658 lines)

View File

@ -48,6 +48,12 @@
struct Cty_Countr
{
long Cod; // Country code
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]; // Alpha2
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
char WWW[Cns_MAX_BYTES_WWW + 1];

View File

@ -926,7 +926,7 @@ static bool Crs_ListCoursesOfAYearForSeeing (unsigned Year)
NumCrs++)
{
Crs = &(Gbl.Hierarchy.Crss.Lst[NumCrs]);
if (Crs->Year == Year) // The year of the course is this?
if (Crs->Specific.Year == Year) // The year of the course is this?
{
ThisYearHasCourses = true;
if (Crs->Status & Hie_STATUS_BIT_PENDING)
@ -966,7 +966,7 @@ static bool Crs_ListCoursesOfAYearForSeeing (unsigned Year)
/* Course year */
HTM_TD_Begin ("class=\"CM %s_%s %s\"",
TxtClassNormal,The_GetSuffix (),BgColor);
HTM_Txt (Txt_YEAR_OF_DEGREE[Crs->Year]);
HTM_Txt (Txt_YEAR_OF_DEGREE[Crs->Specific.Year]);
HTM_TD_End ();
/* Institutional code of the course */
@ -1129,7 +1129,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
NumCrs++)
{
Crs = &(Gbl.Hierarchy.Crss.Lst[NumCrs]);
if (Crs->Year == Year)
if (Crs->Specific.Year == Year)
{
ICanEdit = Crs_CheckIfICanEdit (Crs);
@ -1174,15 +1174,15 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
// because it's possible to move this course
// to another degree (with other active years)
HTM_OPTION (HTM_Type_UNSIGNED,&YearAux,
YearAux == Crs->Year ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
YearAux == Crs->Specific.Year ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Txt_YEAR_OF_DEGREE[YearAux]);
HTM_SELECT_End ();
Frm_EndForm ();
}
else
HTM_Txt (Txt_YEAR_OF_DEGREE[Crs->Year]);
HTM_Txt (Txt_YEAR_OF_DEGREE[Crs->Specific.Year]);
HTM_TD_End ();
/* Institutional code of the course */
@ -1324,8 +1324,8 @@ static void Crs_PutFormToCreateCourse (void)
Year <= Deg_MAX_YEARS_PER_DEGREE;
Year++)
HTM_OPTION (HTM_Type_UNSIGNED,&Year,
Year == Crs_EditingCrs->Year ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
Year == Crs_EditingCrs->Specific.Year ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Txt_YEAR_OF_DEGREE[Year]);
HTM_SELECT_End ();
@ -1486,19 +1486,19 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
Crs_GetParsNewCourse (Crs_EditingCrs);
/***** Check if year is correct *****/
if (Crs_EditingCrs->Year <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
if (Crs_EditingCrs->Specific.Year <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
{
if (Crs_EditingCrs->ShrtName[0] &&
Crs_EditingCrs->FullName[0]) // If there's a course name
{
/***** If name of course was in database... *****/
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Crs_EditingCrs->ShrtName,
-1L,Crs_EditingCrs->PrtCod,Crs_EditingCrs->Year))
-1L,Crs_EditingCrs->PrtCod,Crs_EditingCrs->Specific.Year))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_course_X_already_exists,
Crs_EditingCrs->ShrtName);
else if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("FullName",Crs_EditingCrs->FullName,
-1L,Crs_EditingCrs->PrtCod,Crs_EditingCrs->Year))
-1L,Crs_EditingCrs->PrtCod,Crs_EditingCrs->Specific.Year))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_course_X_already_exists,
Crs_EditingCrs->FullName);
@ -1516,7 +1516,7 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
else // Year not valid
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_year_X_is_not_allowed,
Crs_EditingCrs->Year);
Crs_EditingCrs->Specific.Year);
}
/*****************************************************************************/
@ -1530,7 +1530,7 @@ static void Crs_GetParsNewCourse (struct Crs_Course *Crs)
/***** Get parameters of the course from form *****/
/* Get year */
Par_GetParText ("OthCrsYear",YearStr,2);
Crs->Year = Deg_ConvStrToYear (YearStr);
Crs->Specific.Year = Deg_ConvStrToYear (YearStr);
/* Get institutional code */
Par_GetParText ("InsCrsCod",Crs->InstitutionalCod,Crs_MAX_BYTES_INSTITUTIONAL_COD);
@ -1592,12 +1592,12 @@ bool Crs_GetCourseDataByCod (struct Crs_Course *Crs)
bool CrsFound = false;
/***** Clear data *****/
Crs->PrtCod = -1L;
Crs->Year = 0;
Crs->Status = (Hie_Status_t) 0;
Crs->PrtCod = -1L;
Crs->Specific.Year = 0;
Crs->Status = (Hie_Status_t) 0;
Crs->RequesterUsrCod = -1L;
Crs->ShrtName[0] = '\0';
Crs->FullName[0] = '\0';
Crs->ShrtName[0] = '\0';
Crs->FullName[0] = '\0';
/***** Check if course code is correct *****/
if (Crs->Cod > 0)
@ -1639,7 +1639,7 @@ static void Crs_GetCourseDataFromRow (MYSQL_RES *mysql_res,
Crs->PrtCod = Str_ConvertStrCodToLongCod (row[1]);
/***** Get year (row[2]) *****/
Crs->Year = Deg_ConvStrToYear (row[2]);
Crs->Specific.Year = Deg_ConvStrToYear (row[2]);
/***** Get course status (row[4]) *****/
if (sscanf (row[4],"%u",&(Crs->Status)) != 1)
@ -1904,7 +1904,7 @@ void Crs_UpdateCrsYear (struct Crs_Course *Crs,unsigned NewYear)
Crs_DB_UpdateCrsYear (Crs->Cod,NewYear);
/***** Copy course year/semester *****/
Crs->Year = NewYear;
Crs->Specific.Year = NewYear;
}
/*****************************************************************************/
@ -1980,7 +1980,7 @@ void Crs_RenameCourse (struct Crs_Course *Crs,Cns_ShrtOrFullName_t ShrtOrFullNam
{
/***** If course was in database... *****/
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (ParName,NewCrsName,Crs->Cod,
Crs->PrtCod,Crs->Year))
Crs->PrtCod,Crs->Specific.Year))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_course_X_already_exists,
NewCrsName);
@ -2611,13 +2611,13 @@ static void Crs_EditingCourseConstructor (void)
Err_NotEnoughMemoryExit ();
/***** Reset course *****/
Crs_EditingCrs->Cod = -1L;
Crs_EditingCrs->PrtCod = -1L;
Crs_EditingCrs->Year = 0;
Crs_EditingCrs->Status = 0;
Crs_EditingCrs->Cod = -1L;
Crs_EditingCrs->PrtCod = -1L;
Crs_EditingCrs->Specific.Year = 0;
Crs_EditingCrs->Status = 0;
Crs_EditingCrs->InstitutionalCod[0] = '\0';
Crs_EditingCrs->ShrtName[0] = '\0';
Crs_EditingCrs->FullName[0] = '\0';
Crs_EditingCrs->ShrtName[0] = '\0';
Crs_EditingCrs->FullName[0] = '\0';
}
static void Crs_EditingCourseDestructor (void)

View File

@ -56,7 +56,12 @@ struct Crs_Course
{
long Cod; // Course code
long PrtCod; // Parent (degree) code
unsigned Year; // Year: 0 (optatives), 1, 2, 3...
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
Hie_Status_t Status; // Course status
long RequesterUsrCod; // User code of the person who requested the creation of this course
char InstitutionalCod[Crs_MAX_BYTES_INSTITUTIONAL_COD + 1]; // Institutional code of the course

View File

@ -332,16 +332,16 @@ static void CrsCfg_Year (bool PutForm)
Year <= Deg_MAX_YEARS_PER_DEGREE;
Year++)
HTM_OPTION (HTM_Type_UNSIGNED,&Year,
Year == Gbl.Hierarchy.Crs.Year ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
Year == Gbl.Hierarchy.Crs.Specific.Year ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Txt_YEAR_OF_DEGREE[Year]);
HTM_SELECT_End ();
Frm_EndForm ();
}
else
HTM_Txt (Gbl.Hierarchy.Crs.Year ? Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Year] :
Txt_Not_applicable);
HTM_Txt (Gbl.Hierarchy.Crs.Specific.Year ? Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Specific.Year] :
Txt_Not_applicable);
HTM_TD_End ();
HTM_TR_End ();
@ -491,17 +491,17 @@ void CrsCfg_ChangeCrsDeg (void)
/***** If name of course was in database in the new degree... *****/
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Hierarchy.Crs.ShrtName,-1L,
NewDeg.Cod,Gbl.Hierarchy.Crs.Year))
NewDeg.Cod,Gbl.Hierarchy.Crs.Specific.Year))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Year],
Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Specific.Year],
NewDeg.FullName,
Gbl.Hierarchy.Crs.ShrtName);
else if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Hierarchy.Crs.FullName,-1L,
NewDeg.Cod,Gbl.Hierarchy.Crs.Year))
NewDeg.Cod,Gbl.Hierarchy.Crs.Specific.Year))
Ale_CreateAlert (Ale_WARNING,NULL,
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Year],
Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Specific.Year],
NewDeg.FullName,
Gbl.Hierarchy.Crs.FullName);
else // Update degree in database

View File

@ -59,7 +59,7 @@ void Crs_DB_CreateCourse (struct Crs_Course *Crs,Hie_Status_t Status)
" (%ld,%u,'%s',%u,%ld,"
"'%s','%s')",
Crs->PrtCod,
Crs->Year,
Crs->Specific.Year,
Crs->InstitutionalCod,
(unsigned) Status,
Gbl.Usrs.Me.UsrDat.UsrCod,

View File

@ -418,8 +418,8 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
{
DegTypInLst = &DegTypes->Lst[NumDegTyp];
HTM_OPTION (HTM_Type_LONG,&DegTypInLst->DegTypCod,
DegTypInLst->DegTypCod == DegInLst->TypCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
DegTypInLst->DegTypCod == DegInLst->Specific.TypCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",DegTypInLst->DegTypName);
}
@ -432,7 +432,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
NumDegTyp++)
{
DegTypInLst = &DegTypes->Lst[NumDegTyp];
if (DegTypInLst->DegTypCod == DegInLst->TypCod)
if (DegTypInLst->DegTypCod == DegInLst->Specific.TypCod)
HTM_Txt (DegTypInLst->DegTypName);
}
HTM_TD_End ();
@ -579,8 +579,8 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
{
DegTypInLst = &DegTypes->Lst[NumDegTyp];
HTM_OPTION (HTM_Type_LONG,&DegTypInLst->DegTypCod,
DegTypInLst->DegTypCod == Deg_EditingDeg->TypCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
DegTypInLst->DegTypCod == Deg_EditingDeg->Specific.TypCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",DegTypInLst->DegTypName);
}
@ -788,7 +788,7 @@ static void Deg_ListOneDegreeForSeeing (struct Deg_Degree *Deg,unsigned NumDeg)
unsigned NumCrss = Crs_GetCachedNumCrssInDeg (Deg->Cod);
/***** Get data of type of degree of this degree *****/
DegTyp.DegTypCod = Deg->TypCod;
DegTyp.DegTypCod = Deg->Specific.TypCod;
if (!DegTyp_GetDegreeTypeDataByCod (&DegTyp))
Err_WrongDegTypExit ();
@ -1069,7 +1069,7 @@ static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
Par_GetParText ("FullName" ,Deg_EditingDeg->FullName,Cns_HIERARCHY_MAX_BYTES_FULL_NAME);
/* Get degree type */
Deg_EditingDeg->TypCod = ParCod_GetAndCheckPar (ParCod_OthDegTyp);
Deg_EditingDeg->Specific.TypCod = ParCod_GetAndCheckPar (ParCod_OthDegTyp);
/* Get degree WWW */
Par_GetParText ("WWW",Deg_EditingDeg->WWW,Cns_MAX_BYTES_WWW);
@ -1153,7 +1153,7 @@ bool Deg_GetDegreeDataByCod (struct Deg_Degree *Deg)
/***** Clear data *****/
Deg->PrtCod = -1L;
Deg->TypCod = -1L;
Deg->Specific.TypCod = -1L;
Deg->Status = (Hie_Status_t) 0;
Deg->RequesterUsrCod = -1L;
Deg->ShrtName[0] = '\0';
@ -1197,8 +1197,8 @@ static void Deg_GetDegreeDataFromRow (MYSQL_RES *mysql_res,
Err_WrongDegreeExit ();
/***** Get center code (row[1]) and code of the degree type (row[2]) *****/
Deg->PrtCod = Str_ConvertStrCodToLongCod (row[1]);
Deg->TypCod = Str_ConvertStrCodToLongCod (row[2]);
Deg->PrtCod = Str_ConvertStrCodToLongCod (row[1]);
Deg->Specific.TypCod = Str_ConvertStrCodToLongCod (row[2]);
/* Get course status (row[3]) */
if (sscanf (row[3],"%u",&(Deg->Status)) != 1)
@ -1391,7 +1391,7 @@ void Deg_ChangeDegreeType (void)
/***** Update the table of degrees changing old type by new type *****/
Deg_DB_UpdateDegTyp (Deg_EditingDeg->Cod,NewDegTypCod);
Deg_EditingDeg->TypCod = NewDegTypCod;
Deg_EditingDeg->Specific.TypCod = NewDegTypCod;
/***** Create alert to show the change made
and put button to go to degree changed *****/
@ -1772,7 +1772,7 @@ static void Deg_EditingDegreeConstructor (void)
/***** Reset degree *****/
Deg_EditingDeg->Cod = -1L;
Deg_EditingDeg->PrtCod = -1L;
Deg_EditingDeg->TypCod = -1L;
Deg_EditingDeg->Specific.TypCod = -1L;
Deg_EditingDeg->Status = (Hie_Status_t) 0;
Deg_EditingDeg->RequesterUsrCod = -1L;
Deg_EditingDeg->ShrtName[0] = '\0';

View File

@ -51,7 +51,12 @@ struct Deg_Degree
{
long Cod; // Degree code
long PrtCod; // Parent (center) code
long TypCod; // Degree type code
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
Hie_Status_t Status; // Degree status
long RequesterUsrCod; // User code of the person who requested the creation of this degree
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]; // Short name of degree

View File

@ -65,7 +65,7 @@ void Deg_DB_CreateDegree (struct Deg_Degree *Deg,Hie_Status_t Status)
" (%ld,%ld,%u,"
"%ld,'%s','%s','%s')",
Deg->PrtCod,
Deg->TypCod,
Deg->Specific.TypCod,
(unsigned) Status,
Gbl.Usrs.Me.UsrDat.UsrCod,
Deg->ShrtName,

View File

@ -324,8 +324,8 @@ static void DegTyp_ListDegreeTypesForSeeing (const struct DegTyp_DegTypes *DegTy
NumDegTyp++, The_ChangeRowColor ())
{
BgColor = (DegTypes->Lst[NumDegTyp].DegTypCod ==
Gbl.Hierarchy.Deg.TypCod) ? "BG_HIGHLIGHT" :
The_GetColorRows ();
Gbl.Hierarchy.Deg.Specific.TypCod) ? "BG_HIGHLIGHT" :
The_GetColorRows ();
/* Begin table row */
HTM_TR_Begin (NULL);

View File

@ -664,18 +664,18 @@ void Hie_ResetHierarchy (void)
Gbl.Hierarchy.Cty.Cod = -1L;
/***** Institution *****/
Gbl.Hierarchy.Ins.Cod = -1L;
Gbl.Hierarchy.Ins.Cod = -1L;
/***** Center *****/
Gbl.Hierarchy.Ctr.Cod = -1L;
Gbl.Hierarchy.Ctr.PrtCod = -1L;
Gbl.Hierarchy.Ctr.PlcCod = -1L;
Gbl.Hierarchy.Ctr.Cod = -1L;
Gbl.Hierarchy.Ctr.PrtCod = -1L;
Gbl.Hierarchy.Ctr.Specific.PlcCod = -1L;
/***** Degree *****/
Gbl.Hierarchy.Deg.Cod = -1L;
Gbl.Hierarchy.Deg.Cod = -1L;
/***** Course *****/
Gbl.Hierarchy.Crs.Cod = -1L;
Gbl.Hierarchy.Crs.Cod = -1L;
/***** Hierarchy level and code *****/
Gbl.Hierarchy.Level = HieLvl_UNK;

View File

@ -41,6 +41,12 @@ struct Ins_Instit
{
long Cod; // Institution code
long PrtCod; // Parent (country) code
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
Hie_Status_t Status; // Institution status
long RequesterUsrCod; // User code of the person who requested the creation of this institution
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1];

View File

@ -1058,8 +1058,8 @@ static void Rep_WriteRowCrsData (long CrsCod,Rol_Role_t Role,
fprintf (Rep_File,"<strong>%s</strong> -",Crs.FullName);
/***** Write year *****/
if (Crs.Year)
fprintf (Rep_File," %s",Txt_YEAR_OF_DEGREE[Crs.Year]);
if (Crs.Specific.Year)
fprintf (Rep_File," %s",Txt_YEAR_OF_DEGREE[Crs.Specific.Year]);
/***** Write degree full name *****/
fprintf (Rep_File," %s",Deg.FullName);

View File

@ -3319,7 +3319,7 @@ static void Sta_ShowNumHitsPerCourse (Sta_CountType_t CountType,
/* Write degree year */
HTM_TD_Begin ("class=\"CT LOG_%s\"",The_GetSuffix ());
if (CrsOK)
HTM_Txt (Txt_YEAR_OF_DEGREE[Crs.Year]);
HTM_Txt (Txt_YEAR_OF_DEGREE[Crs.Specific.Year]);
else
HTM_Hyphen ();
HTM_NBSP ();