Version 16.26

This commit is contained in:
Antonio Cañas Vargas 2016-10-20 19:46:06 +02:00
parent 0e80322853
commit 5fd505b315
8 changed files with 352 additions and 183 deletions

View File

@ -182,6 +182,7 @@ Institution:
84. ActInsSch Search for courses, teachers, documents...
85. ActPrnInsInf Print information on the current institution
NEW. ActChgInsCtyCfg Change country of institution in institution configuration
86. ActReqInsLog Show form to send the logo of the current institution
87. ActRecInsLog Receive and store the logo of the current institution
88. ActRemInsLog Remove the logo of the current institution
@ -1509,7 +1510,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActReqIns */{1210,-1,TabCty,ActSeeIns ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Ins_RecFormReqIns ,NULL},
/* ActNewIns */{ 698,-1,TabCty,ActSeeIns ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Ins_RecFormNewIns ,NULL},
/* ActRemIns */{ 759,-1,TabCty,ActSeeIns ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Ins_RemoveInstitution ,NULL},
/* ActChgInsCty */{ 865,-1,TabCty,ActSeeIns ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Ins_ChangeInsCountry ,NULL},
/* ActChgInsCty */{ 865,-1,TabCty,ActSeeIns ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Ins_ChangeInsCty ,NULL},
/* ActRenInsSho */{ 702,-1,TabCty,ActSeeIns ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Ins_RenameInsShort ,Ins_ContEditAfterChgIns ,NULL},
/* ActRenInsFul */{ 701,-1,TabCty,ActSeeIns ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Ins_RenameInsFull ,Ins_ContEditAfterChgIns ,NULL},
/* ActChgInsWWW */{ 700,-1,TabCty,ActSeeIns ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Ins_ChangeInsWWW ,NULL},
@ -1531,6 +1532,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActInsSch */{1182,-1,TabIns,ActInsReqSch ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,Sch_GetParamsSearch ,Sch_InsSearch ,NULL},
/* ActPrnInsInf */{1154,-1,TabIns,ActSeeInsInf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_NEW_WINDOW ,NULL ,Ins_PrintConfiguration ,NULL},
/* ActChgInsCtyCfg */{1590,-1,TabIns,ActSeeIns ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,Ins_ChangeInsCtyInConfig,Ins_ContEditAfterChgInsInConfig,NULL},
/* ActReqInsLog */{1245,-1,TabIns,ActSeeInsInf ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Ins_RequestLogo ,NULL},
/* ActRecInsLog */{ 699,-1,TabIns,ActSeeInsInf ,0x100,0x100,0x100,Act_CONTENT_DATA,Act_MAIN_WINDOW,Ins_ReceiveLogo ,Ins_ShowConfiguration ,NULL},
/* ActRemInsLog */{1341,-1,TabIns,ActSeeInsInf ,0x100,0x100,0x100,Act_CONTENT_DATA,Act_MAIN_WINDOW,Ins_RemoveLogo ,Ins_ShowConfiguration ,NULL},
@ -4447,6 +4449,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActChgCrsDegCfg, // #1587
ActChgDegCtrCfg, // #1588
ActChgCtrInsCfg, // #1589
ActChgInsCtyCfg, // #1590
};
/*****************************************************************************/

View File

@ -55,9 +55,9 @@ typedef enum
typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (1+9+51+15+90+71+68+247+186+155+172+36+30+86)
#define Act_NUM_ACTIONS (1+9+51+15+91+71+68+247+186+155+172+36+30+86)
#define Act_MAX_ACTION_COD 1589
#define Act_MAX_ACTION_COD 1590
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20
@ -182,92 +182,93 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
// Secondary actions
#define ActInsSch (ActChgInsSta+ 9)
#define ActPrnInsInf (ActChgInsSta+ 10)
#define ActReqInsLog (ActChgInsSta+ 11)
#define ActRecInsLog (ActChgInsSta+ 12)
#define ActRemInsLog (ActChgInsSta+ 13)
#define ActChgInsCtyCfg (ActChgInsSta+ 11)
#define ActReqInsLog (ActChgInsSta+ 12)
#define ActRecInsLog (ActChgInsSta+ 13)
#define ActRemInsLog (ActChgInsSta+ 14)
#define ActEdiCtr (ActChgInsSta+ 14)
#define ActReqCtr (ActChgInsSta+ 15)
#define ActNewCtr (ActChgInsSta+ 16)
#define ActRemCtr (ActChgInsSta+ 17)
#define ActChgCtrIns (ActChgInsSta+ 18)
#define ActChgCtrPlc (ActChgInsSta+ 19)
#define ActRenCtrSho (ActChgInsSta+ 20)
#define ActRenCtrFul (ActChgInsSta+ 21)
#define ActChgCtrWWW (ActChgInsSta+ 22)
#define ActChgCtrSta (ActChgInsSta+ 23)
#define ActEdiCtr (ActChgInsSta+ 15)
#define ActReqCtr (ActChgInsSta+ 16)
#define ActNewCtr (ActChgInsSta+ 17)
#define ActRemCtr (ActChgInsSta+ 18)
#define ActChgCtrIns (ActChgInsSta+ 19)
#define ActChgCtrPlc (ActChgInsSta+ 20)
#define ActRenCtrSho (ActChgInsSta+ 21)
#define ActRenCtrFul (ActChgInsSta+ 22)
#define ActChgCtrWWW (ActChgInsSta+ 23)
#define ActChgCtrSta (ActChgInsSta+ 24)
#define ActEdiDpt (ActChgInsSta+ 24)
#define ActNewDpt (ActChgInsSta+ 25)
#define ActRemDpt (ActChgInsSta+ 26)
#define ActChgDptIns (ActChgInsSta+ 27)
#define ActRenDptSho (ActChgInsSta+ 28)
#define ActRenDptFul (ActChgInsSta+ 29)
#define ActChgDptWWW (ActChgInsSta+ 30)
#define ActEdiDpt (ActChgInsSta+ 25)
#define ActNewDpt (ActChgInsSta+ 26)
#define ActRemDpt (ActChgInsSta+ 27)
#define ActChgDptIns (ActChgInsSta+ 28)
#define ActRenDptSho (ActChgInsSta+ 29)
#define ActRenDptFul (ActChgInsSta+ 30)
#define ActChgDptWWW (ActChgInsSta+ 31)
#define ActEdiPlc (ActChgInsSta+ 31)
#define ActNewPlc (ActChgInsSta+ 32)
#define ActRemPlc (ActChgInsSta+ 33)
#define ActRenPlcSho (ActChgInsSta+ 34)
#define ActRenPlcFul (ActChgInsSta+ 35)
#define ActEdiPlc (ActChgInsSta+ 32)
#define ActNewPlc (ActChgInsSta+ 33)
#define ActRemPlc (ActChgInsSta+ 34)
#define ActRenPlcSho (ActChgInsSta+ 35)
#define ActRenPlcFul (ActChgInsSta+ 36)
#define ActEdiHld (ActChgInsSta+ 36)
#define ActNewHld (ActChgInsSta+ 37)
#define ActRemHld (ActChgInsSta+ 38)
#define ActChgHldPlc (ActChgInsSta+ 39)
#define ActChgHldTyp (ActChgInsSta+ 40)
#define ActChgHldStrDat (ActChgInsSta+ 41)
#define ActChgHldEndDat (ActChgInsSta+ 42)
#define ActRenHld (ActChgInsSta+ 43)
#define ActEdiHld (ActChgInsSta+ 37)
#define ActNewHld (ActChgInsSta+ 38)
#define ActRemHld (ActChgInsSta+ 39)
#define ActChgHldPlc (ActChgInsSta+ 40)
#define ActChgHldTyp (ActChgInsSta+ 41)
#define ActChgHldStrDat (ActChgInsSta+ 42)
#define ActChgHldEndDat (ActChgInsSta+ 43)
#define ActRenHld (ActChgInsSta+ 44)
#define ActChgToSeeDocIns (ActChgInsSta+ 44)
#define ActSeeDocIns (ActChgInsSta+ 45)
#define ActExpSeeDocIns (ActChgInsSta+ 46)
#define ActConSeeDocIns (ActChgInsSta+ 47)
#define ActZIPSeeDocIns (ActChgInsSta+ 48)
#define ActReqDatSeeDocIns (ActChgInsSta+ 49)
#define ActDowSeeDocIns (ActChgInsSta+ 50)
#define ActChgToAdmDocIns (ActChgInsSta+ 51)
#define ActAdmDocIns (ActChgInsSta+ 52)
#define ActReqRemFilDocIns (ActChgInsSta+ 53)
#define ActRemFilDocIns (ActChgInsSta+ 54)
#define ActRemFolDocIns (ActChgInsSta+ 55)
#define ActCopDocIns (ActChgInsSta+ 56)
#define ActPasDocIns (ActChgInsSta+ 57)
#define ActRemTreDocIns (ActChgInsSta+ 58)
#define ActFrmCreDocIns (ActChgInsSta+ 59)
#define ActCreFolDocIns (ActChgInsSta+ 60)
#define ActCreLnkDocIns (ActChgInsSta+ 61)
#define ActRenFolDocIns (ActChgInsSta+ 62)
#define ActRcvFilDocInsDZ (ActChgInsSta+ 63)
#define ActRcvFilDocInsCla (ActChgInsSta+ 64)
#define ActExpAdmDocIns (ActChgInsSta+ 65)
#define ActConAdmDocIns (ActChgInsSta+ 66)
#define ActZIPAdmDocIns (ActChgInsSta+ 67)
#define ActShoDocIns (ActChgInsSta+ 68)
#define ActHidDocIns (ActChgInsSta+ 69)
#define ActReqDatAdmDocIns (ActChgInsSta+ 70)
#define ActChgDatAdmDocIns (ActChgInsSta+ 71)
#define ActDowAdmDocIns (ActChgInsSta+ 72)
#define ActChgToSeeDocIns (ActChgInsSta+ 45)
#define ActSeeDocIns (ActChgInsSta+ 46)
#define ActExpSeeDocIns (ActChgInsSta+ 47)
#define ActConSeeDocIns (ActChgInsSta+ 48)
#define ActZIPSeeDocIns (ActChgInsSta+ 49)
#define ActReqDatSeeDocIns (ActChgInsSta+ 50)
#define ActDowSeeDocIns (ActChgInsSta+ 51)
#define ActChgToAdmDocIns (ActChgInsSta+ 52)
#define ActAdmDocIns (ActChgInsSta+ 53)
#define ActReqRemFilDocIns (ActChgInsSta+ 54)
#define ActRemFilDocIns (ActChgInsSta+ 55)
#define ActRemFolDocIns (ActChgInsSta+ 56)
#define ActCopDocIns (ActChgInsSta+ 57)
#define ActPasDocIns (ActChgInsSta+ 58)
#define ActRemTreDocIns (ActChgInsSta+ 59)
#define ActFrmCreDocIns (ActChgInsSta+ 60)
#define ActCreFolDocIns (ActChgInsSta+ 61)
#define ActCreLnkDocIns (ActChgInsSta+ 62)
#define ActRenFolDocIns (ActChgInsSta+ 63)
#define ActRcvFilDocInsDZ (ActChgInsSta+ 64)
#define ActRcvFilDocInsCla (ActChgInsSta+ 65)
#define ActExpAdmDocIns (ActChgInsSta+ 66)
#define ActConAdmDocIns (ActChgInsSta+ 67)
#define ActZIPAdmDocIns (ActChgInsSta+ 68)
#define ActShoDocIns (ActChgInsSta+ 69)
#define ActHidDocIns (ActChgInsSta+ 70)
#define ActReqDatAdmDocIns (ActChgInsSta+ 71)
#define ActChgDatAdmDocIns (ActChgInsSta+ 72)
#define ActDowAdmDocIns (ActChgInsSta+ 73)
#define ActReqRemFilShaIns (ActChgInsSta+ 73)
#define ActRemFilShaIns (ActChgInsSta+ 74)
#define ActRemFolShaIns (ActChgInsSta+ 75)
#define ActCopShaIns (ActChgInsSta+ 76)
#define ActPasShaIns (ActChgInsSta+ 77)
#define ActRemTreShaIns (ActChgInsSta+ 78)
#define ActFrmCreShaIns (ActChgInsSta+ 79)
#define ActCreFolShaIns (ActChgInsSta+ 80)
#define ActCreLnkShaIns (ActChgInsSta+ 81)
#define ActRenFolShaIns (ActChgInsSta+ 82)
#define ActRcvFilShaInsDZ (ActChgInsSta+ 83)
#define ActRcvFilShaInsCla (ActChgInsSta+ 84)
#define ActExpShaIns (ActChgInsSta+ 85)
#define ActConShaIns (ActChgInsSta+ 86)
#define ActZIPShaIns (ActChgInsSta+ 87)
#define ActReqDatShaIns (ActChgInsSta+ 88)
#define ActChgDatShaIns (ActChgInsSta+ 89)
#define ActDowShaIns (ActChgInsSta+ 90)
#define ActReqRemFilShaIns (ActChgInsSta+ 74)
#define ActRemFilShaIns (ActChgInsSta+ 75)
#define ActRemFolShaIns (ActChgInsSta+ 76)
#define ActCopShaIns (ActChgInsSta+ 77)
#define ActPasShaIns (ActChgInsSta+ 78)
#define ActRemTreShaIns (ActChgInsSta+ 79)
#define ActFrmCreShaIns (ActChgInsSta+ 80)
#define ActCreFolShaIns (ActChgInsSta+ 81)
#define ActCreLnkShaIns (ActChgInsSta+ 82)
#define ActRenFolShaIns (ActChgInsSta+ 83)
#define ActRcvFilShaInsDZ (ActChgInsSta+ 84)
#define ActRcvFilShaInsCla (ActChgInsSta+ 85)
#define ActExpShaIns (ActChgInsSta+ 86)
#define ActConShaIns (ActChgInsSta+ 87)
#define ActZIPShaIns (ActChgInsSta+ 88)
#define ActReqDatShaIns (ActChgInsSta+ 89)
#define ActChgDatShaIns (ActChgInsSta+ 90)
#define ActDowShaIns (ActChgInsSta+ 91)
/*****************************************************************************/
/********************************* Centre tab ********************************/

View File

@ -92,7 +92,7 @@ static Ctr_Status_t Ctr_GetStatusBitsFromStatusTxt (Ctr_StatusTxt_t StatusTxt);
static void Ctr_PutParamOtherCtrCod (long CtrCod);
static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod);
static bool Ctr_RenameCentre (struct Centre *Ctr,Cns_ShortOrFullName_t ShortOrFullName);
static bool Ctr_CheckIfCentreNameExistsInCurrentIns (const char *FieldName,const char *Name,long CtrCod);
static bool Ctr_CheckIfCtrNameExistsInIns (const char *FieldName,const char *Name,long CtrCod,long InsCod);
static void Ctr_PutButtonToGoToCtr (struct Centre *Ctr);
static void Ctr_PutFormToCreateCentre (void);
@ -1677,6 +1677,7 @@ void Ctr_RemoveCentre (void)
void Ctr_ChangeCtrInsInConfig (void)
{
extern const char *Txt_The_centre_X_already_exists;
extern const char *Txt_The_centre_X_has_been_moved_to_the_institution_Y;
struct Institution NewIns;
@ -1684,20 +1685,40 @@ void Ctr_ChangeCtrInsInConfig (void)
/* Get parameter with institution code */
NewIns.InsCod = Ins_GetParamOtherInsCod ();
/***** Get data of new institution *****/
Ins_GetDataOfInstitutionByCod (&NewIns,Ins_GET_BASIC_DATA);
/***** Check if institution has changed *****/
if (NewIns.InsCod != Gbl.CurrentCtr.Ctr.InsCod)
{
/***** Get data of new institution *****/
Ins_GetDataOfInstitutionByCod (&NewIns,Ins_GET_BASIC_DATA);
/***** Update institution in table of centres *****/
Ctr_UpdateCtrInsDB (Gbl.CurrentCtr.Ctr.CtrCod,NewIns.InsCod);
Gbl.CurrentCtr.Ctr.InsCod =
Gbl.CurrentIns.Ins.InsCod = NewIns.InsCod;
/***** Check if it already exists a centre with the same name in the new institution *****/
if (Ctr_CheckIfCtrNameExistsInIns ("ShortName",Gbl.CurrentCtr.Ctr.ShortName,Gbl.CurrentCtr.Ctr.CtrCod,NewIns.InsCod))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_centre_X_already_exists,
Gbl.CurrentCtr.Ctr.ShortName);
}
else if (Ctr_CheckIfCtrNameExistsInIns ("FullName",Gbl.CurrentCtr.Ctr.FullName,Gbl.CurrentCtr.Ctr.CtrCod,NewIns.InsCod))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_centre_X_already_exists,
Gbl.CurrentCtr.Ctr.FullName);
}
else
{
/***** Update institution in table of centres *****/
Ctr_UpdateCtrInsDB (Gbl.CurrentCtr.Ctr.CtrCod,NewIns.InsCod);
Gbl.CurrentCtr.Ctr.InsCod =
Gbl.CurrentIns.Ins.InsCod = NewIns.InsCod;
/***** Initialize again current course, degree, centre... *****/
Deg_InitCurrentCourse ();
/***** Initialize again current course, degree, centre... *****/
Deg_InitCurrentCourse ();
/***** Write message to show the change made *****/
sprintf (Gbl.Message,Txt_The_centre_X_has_been_moved_to_the_institution_Y,
Gbl.CurrentCtr.Ctr.FullName,NewIns.FullName);
/***** Write message to show the change made *****/
sprintf (Gbl.Message,Txt_The_centre_X_has_been_moved_to_the_institution_Y,
Gbl.CurrentCtr.Ctr.FullName,NewIns.FullName);
}
}
}
/*****************************************************************************/
@ -1889,9 +1910,9 @@ static bool Ctr_RenameCentre (struct Centre *Ctr,Cns_ShortOrFullName_t ShortOrFu
/***** Check if new name is empty *****/
if (!NewCtrName[0])
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_You_can_not_leave_the_name_of_the_centre_X_empty,
CurrentCtrName);
Gbl.Error = true;
}
else
{
@ -1899,11 +1920,11 @@ static bool Ctr_RenameCentre (struct Centre *Ctr,Cns_ShortOrFullName_t ShortOrFu
if (strcmp (CurrentCtrName,NewCtrName)) // Different names
{
/***** If degree was in database... *****/
if (Ctr_CheckIfCentreNameExistsInCurrentIns (ParamName,NewCtrName,Ctr->CtrCod))
if (Ctr_CheckIfCtrNameExistsInIns (ParamName,NewCtrName,Ctr->CtrCod,Gbl.CurrentIns.Ins.InsCod))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_centre_X_already_exists,
NewCtrName);
Gbl.Error = true;
}
else
{
@ -1935,14 +1956,14 @@ static bool Ctr_RenameCentre (struct Centre *Ctr,Cns_ShortOrFullName_t ShortOrFu
/********************* Check if the name of centre exists ********************/
/*****************************************************************************/
static bool Ctr_CheckIfCentreNameExistsInCurrentIns (const char *FieldName,const char *Name,long CtrCod)
static bool Ctr_CheckIfCtrNameExistsInIns (const char *FieldName,const char *Name,long CtrCod,long InsCod)
{
char Query[512];
/***** Get number of centres with a name from database *****/
sprintf (Query,"SELECT COUNT(*) FROM centres"
" WHERE InsCod='%ld' AND %s='%s' AND CtrCod<>'%ld'",
Gbl.CurrentIns.Ins.InsCod,FieldName,Name,CtrCod);
InsCod,FieldName,Name,CtrCod);
return (DB_QueryCOUNT (Query,"can not check if the name of a centre already existed") != 0);
}
@ -2633,13 +2654,13 @@ static void Ctr_RecFormRequestOrCreateCtr (unsigned Status)
if (Ctr->WWW[0])
{
/***** If name of centre was in database... *****/
if (Ctr_CheckIfCentreNameExistsInCurrentIns ("ShortName",Ctr->ShortName,-1L))
if (Ctr_CheckIfCtrNameExistsInIns ("ShortName",Ctr->ShortName,-1L,Gbl.CurrentIns.Ins.InsCod))
{
sprintf (Gbl.Message,Txt_The_centre_X_already_exists,
Ctr->ShortName);
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
}
else if (Ctr_CheckIfCentreNameExistsInCurrentIns ("FullName",Ctr->FullName,-1L))
else if (Ctr_CheckIfCtrNameExistsInIns ("FullName",Ctr->FullName,-1L,Gbl.CurrentIns.Ins.InsCod))
{
sprintf (Gbl.Message,Txt_The_centre_X_already_exists,
Ctr->FullName);

View File

@ -150,14 +150,19 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.25 (2016-10-20)"
#define Log_PLATFORM_VERSION "SWAD 16.26 (2016-10-20)"
#define CSS_FILE "swad16.25.css"
#define JS_FILE "swad15.238.1.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/*
Version 16.25: Oct 19, 2016 New form in centre configuration to move centre to another institution. (205416 lines)
Version 16.26: Oct 20, 2016 New form in institution configuration to move institution to another country. (205566 lines)
2 changes necessary in database:
UPDATE actions SET Txt='Mover instituci&oacute;n a otro pa&iacute;s' WHERE ActCod='???' AND Language='es';
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1590','es','N','Mover instituci&oacute;n a otro pa&iacute;s');
Version 16.25: Oct 20, 2016 New form in centre configuration to move centre to another institution. (205416 lines)
4 changes necessary in database:
UPDATE actions SET Txt='Mover titulaci&oacute;n a otro centro' WHERE ActCod='1049' AND Language='es';
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1588','es','N','Mover titulaci&oacute;n a otro centro');

View File

@ -93,8 +93,8 @@ static void Crs_PutHeadCoursesForSeeing (void);
static void Crs_PutHeadCoursesForEdition (void);
static void Crs_RecFormRequestOrCreateCrs (unsigned Status);
static void Crs_GetParamsNewCourse (struct Course *Crs);
static bool Crs_CheckIfCourseNameExistsInCourses (long DegCod,unsigned Year,
const char *FieldName,const char *Name,long CrsCod);
static bool Crs_CheckIfCrsNameExistsInYearOfDeg (const char *FieldName,const char *Name,long CrsCod,
long DegCod,unsigned Year);
static void Crs_CreateCourse (struct Course *Crs,unsigned Status);
static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row);
@ -1882,33 +1882,33 @@ static void Crs_RecFormRequestOrCreateCrs (unsigned Status)
Crs->FullName[0]) // If there's a course name
{
/***** If name of course was in database... *****/
if (Crs_CheckIfCourseNameExistsInCourses (Crs->DegCod,Crs->Year,
"ShortName",Crs->ShortName,-1L))
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Crs->ShortName,-1L,
Crs->DegCod,Crs->Year))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_course_X_already_exists,
Crs->ShortName);
Gbl.Error = true;
}
else if (Crs_CheckIfCourseNameExistsInCourses (Crs->DegCod,Crs->Year,
"FullName",Crs->FullName,-1L))
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Crs->FullName,-1L,
Crs->DegCod,Crs->Year))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_course_X_already_exists,
Crs->FullName);
Gbl.Error = true;
}
else // Add new requested course to database
Crs_CreateCourse (Crs,Status);
}
else // If there is not a course name
{
sprintf (Gbl.Message,"%s",Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course);
Gbl.Error = true;
sprintf (Gbl.Message,"%s",Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course);
}
}
else // Year not valid
{
sprintf (Gbl.Message,Txt_The_year_X_is_not_allowed,Crs->Year);
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_year_X_is_not_allowed,Crs->Year);
}
}
@ -1939,8 +1939,8 @@ static void Crs_GetParamsNewCourse (struct Course *Crs)
/********** Check if the name of course exists in existing courses ***********/
/*****************************************************************************/
static bool Crs_CheckIfCourseNameExistsInCourses (long DegCod,unsigned Year,
const char *FieldName,const char *Name,long CrsCod)
static bool Crs_CheckIfCrsNameExistsInYearOfDeg (const char *FieldName,const char *Name,long CrsCod,
long DegCod,unsigned Year)
{
char Query[512];
@ -2406,8 +2406,8 @@ void Crs_ChangeInsCrsCod (void)
}
else
{
strcpy (Gbl.Message,Txt_You_dont_have_permission_to_edit_this_course);
Gbl.Error = true;
strcpy (Gbl.Message,Txt_You_dont_have_permission_to_edit_this_course);
}
}
@ -2435,19 +2435,19 @@ void Crs_ChangeCrsDegInConfig (void)
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
{
/***** If name of course was in database in the new degree... *****/
if (Crs_CheckIfCourseNameExistsInCourses (NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year,
"ShortName",Gbl.CurrentCrs.Crs.ShortName,-1L))
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.CurrentCrs.Crs.ShortName,-1L,
NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],NewDeg.FullName,Gbl.CurrentCrs.Crs.ShortName);
Gbl.Error = true;
}
else if (Crs_CheckIfCourseNameExistsInCourses (NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year,
"FullName",Gbl.CurrentCrs.Crs.FullName,-1L))
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.CurrentCrs.Crs.FullName,-1L,
NewDeg.DegCod,Gbl.CurrentCrs.Crs.Year))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
Txt_YEAR_OF_DEGREE[Gbl.CurrentCrs.Crs.Year],NewDeg.FullName,Gbl.CurrentCrs.Crs.FullName);
Gbl.Error = true;
}
else // Update degree in database
{
@ -2467,9 +2467,9 @@ void Crs_ChangeCrsDegInConfig (void)
}
else // I have no permission to change course to this new degree
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_You_dont_have_permission_to_move_courses_to_the_degree_X,
NewDeg.FullName);
Gbl.Error = true;
}
}
@ -2520,19 +2520,19 @@ void Crs_ChangeCrsDegree (void)
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
{
/***** If name of course was in database in the new degree... *****/
if (Crs_CheckIfCourseNameExistsInCourses (NewDeg.DegCod,Crs->Year,
"ShortName",Crs->ShortName,-1L))
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Crs->ShortName,-1L,
NewDeg.DegCod,Crs->Year))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
Txt_YEAR_OF_DEGREE[Crs->Year],NewDeg.FullName,Crs->ShortName);
Gbl.Error = true;
}
else if (Crs_CheckIfCourseNameExistsInCourses (NewDeg.DegCod,Crs->Year,
"FullName",Crs->FullName,-1L))
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Crs->FullName,-1L,
NewDeg.DegCod,Crs->Year))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
Txt_YEAR_OF_DEGREE[Crs->Year],NewDeg.FullName,Crs->FullName);
Gbl.Error = true;
}
else // Update degree in database
{
@ -2547,9 +2547,9 @@ void Crs_ChangeCrsDegree (void)
}
else // I have no permission to change course to this new degree
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_You_dont_have_permission_to_move_courses_to_the_degree_X,
NewDeg.FullName);
Gbl.Error = true;
}
}
@ -2587,21 +2587,19 @@ void Crs_ChangeCrsYearInConfig (void)
if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
{
/***** If name of course was in database in the new year... *****/
if (Crs_CheckIfCourseNameExistsInCourses (Gbl.CurrentCrs.Crs.DegCod,
NewYear,"ShortName",
Gbl.CurrentCrs.Crs.ShortName,-1L))
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.CurrentCrs.Crs.ShortName,-1L,
Gbl.CurrentCrs.Crs.DegCod,NewYear))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_course_X_already_exists_in_year_Y,
Gbl.CurrentCrs.Crs.ShortName,Txt_YEAR_OF_DEGREE[NewYear]);
Gbl.Error = true;
}
else if (Crs_CheckIfCourseNameExistsInCourses (Gbl.CurrentCrs.Crs.DegCod,
NewYear,"FullName",
Gbl.CurrentCrs.Crs.FullName,-1L))
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.CurrentCrs.Crs.FullName,-1L,
Gbl.CurrentCrs.Crs.DegCod,NewYear))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_course_X_already_exists_in_year_Y,
Gbl.CurrentCrs.Crs.FullName,Txt_YEAR_OF_DEGREE[NewYear]);
Gbl.Error = true;
}
else // Update year in database
{
@ -2615,8 +2613,8 @@ void Crs_ChangeCrsYearInConfig (void)
}
else // Year not valid
{
sprintf (Gbl.Message,Txt_The_year_X_is_not_allowed,NewYear);
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_year_X_is_not_allowed,NewYear);
}
}
@ -2657,21 +2655,19 @@ void Crs_ChangeCrsYear (void)
if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
{
/***** If name of course was in database in the new year... *****/
if (Crs_CheckIfCourseNameExistsInCourses (Crs->DegCod,
NewYear,"ShortName",
Crs->ShortName,-1L))
if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Crs->ShortName,-1L,
Crs->DegCod,NewYear))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_course_X_already_exists_in_year_Y,
Crs->ShortName,Txt_YEAR_OF_DEGREE[NewYear]);
Gbl.Error = true;
}
else if (Crs_CheckIfCourseNameExistsInCourses (Crs->DegCod,
NewYear,"FullName",
Crs->FullName,-1L))
else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Crs->FullName,-1L,
Crs->DegCod,NewYear))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_course_X_already_exists_in_year_Y,
Crs->FullName,Txt_YEAR_OF_DEGREE[NewYear]);
Gbl.Error = true;
}
else // Update year in database
{
@ -2685,14 +2681,14 @@ void Crs_ChangeCrsYear (void)
}
else // Year not valid
{
sprintf (Gbl.Message,Txt_The_year_X_is_not_allowed,NewYear);
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_year_X_is_not_allowed,NewYear);
}
}
else
{
strcpy (Gbl.Message,Txt_You_dont_have_permission_to_edit_this_course);
Gbl.Error = true;
strcpy (Gbl.Message,Txt_You_dont_have_permission_to_edit_this_course);
}
}
@ -2814,9 +2810,9 @@ static bool Crs_RenameCourse (struct Course *Crs,Cns_ShortOrFullName_t ShortOrFu
/***** Check if new name is empty *****/
if (!NewCrsName[0])
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_You_can_not_leave_the_name_of_the_course_X_empty,
CurrentCrsName);
Gbl.Error = true;
}
else
{
@ -2824,12 +2820,12 @@ static bool Crs_RenameCourse (struct Course *Crs,Cns_ShortOrFullName_t ShortOrFu
if (strcmp (CurrentCrsName,NewCrsName)) // Different names
{
/***** If course was in database... *****/
if (Crs_CheckIfCourseNameExistsInCourses (Crs->DegCod,Crs->Year,
ParamName,NewCrsName,Crs->CrsCod))
if (Crs_CheckIfCrsNameExistsInYearOfDeg (ParamName,NewCrsName,Crs->CrsCod,
Crs->DegCod,Crs->Year))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_course_X_already_exists,
NewCrsName);
Gbl.Error = true;
}
else
{
@ -2856,8 +2852,8 @@ static bool Crs_RenameCourse (struct Course *Crs,Cns_ShortOrFullName_t ShortOrFu
}
else
{
strcpy (Gbl.Message,Txt_You_dont_have_permission_to_edit_this_course);
Gbl.Error = true;
strcpy (Gbl.Message,Txt_You_dont_have_permission_to_edit_this_course);
}
return CourseHasBeenRenamed;

View File

@ -107,7 +107,7 @@ static void Deg_PutParamOtherDegCod (long DegCod);
static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row);
static bool Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFullName);
static bool Deg_CheckIfDegreeNameExists (long CtrCod,const char *FieldName,const char *Name,long DegCod);
static bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Name,long DegCod,long CtrCod);
static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod);
@ -1966,13 +1966,13 @@ static void Deg_RecFormRequestOrCreateDeg (unsigned Status)
if (Deg->WWW[0])
{
/***** If name of degree was in database... *****/
if (Deg_CheckIfDegreeNameExists (Deg->CtrCod,"ShortName",Deg->ShortName,-1L))
if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Deg->ShortName,-1L,Deg->CtrCod))
{
sprintf (Gbl.Message,Txt_The_degree_X_already_exists,
Deg->ShortName);
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
}
else if (Deg_CheckIfDegreeNameExists (Deg->CtrCod,"FullName",Deg->FullName,-1L))
else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Deg->FullName,-1L,Deg->CtrCod))
{
sprintf (Gbl.Message,Txt_The_degree_X_already_exists,
Deg->FullName);
@ -2426,9 +2426,9 @@ static bool Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFu
/***** Check if new name is empty *****/
if (!NewDegName[0])
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_You_can_not_leave_the_name_of_the_degree_X_empty,
CurrentDegName);
Gbl.Error = true;
}
else
{
@ -2436,11 +2436,11 @@ static bool Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFu
if (strcmp (CurrentDegName,NewDegName)) // Different names
{
/***** If degree was in database... *****/
if (Deg_CheckIfDegreeNameExists (Deg->CtrCod,ParamName,NewDegName,Deg->DegCod))
if (Deg_CheckIfDegNameExistsInCtr (ParamName,NewDegName,Deg->DegCod,Deg->CtrCod))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_degree_X_already_exists,
NewDegName);
Gbl.Error = true;
}
else
{
@ -2472,7 +2472,7 @@ static bool Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFu
/********************* Check if the name of degree exists ********************/
/*****************************************************************************/
static bool Deg_CheckIfDegreeNameExists (long CtrCod,const char *FieldName,const char *Name,long DegCod)
static bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Name,long DegCod,long CtrCod)
{
char Query[512];
@ -2489,6 +2489,7 @@ static bool Deg_CheckIfDegreeNameExists (long CtrCod,const char *FieldName,const
void Deg_ChangeDegCtrInConfig (void)
{
extern const char *Txt_The_degree_X_already_exists;
extern const char *Txt_The_degree_X_has_been_moved_to_the_centre_Y;
struct Centre NewCtr;
@ -2496,21 +2497,41 @@ void Deg_ChangeDegCtrInConfig (void)
/* Get parameter with centre code */
NewCtr.CtrCod = Ctr_GetParamOtherCtrCod ();
/***** Get data of new centre *****/
Ctr_GetDataOfCentreByCod (&NewCtr);
/***** Check if institution has changed *****/
if (NewCtr.CtrCod != Gbl.CurrentDeg.Deg.CtrCod)
{
/***** Get data of new centre *****/
Ctr_GetDataOfCentreByCod (&NewCtr);
/***** Update centre in table of degrees *****/
Deg_UpdateDegCtrDB (Gbl.CurrentDeg.Deg.DegCod,NewCtr.CtrCod);
Gbl.CurrentDeg.Deg.CtrCod =
Gbl.CurrentCtr.Ctr.CtrCod = NewCtr.CtrCod;
/***** Check if it already exists a degree with the same name in the new centre *****/
if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Gbl.CurrentDeg.Deg.ShortName,Gbl.CurrentDeg.Deg.DegCod,NewCtr.CtrCod))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_degree_X_already_exists,
Gbl.CurrentDeg.Deg.ShortName);
}
else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Gbl.CurrentDeg.Deg.FullName,Gbl.CurrentDeg.Deg.DegCod,NewCtr.CtrCod))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_degree_X_already_exists,
Gbl.CurrentDeg.Deg.FullName);
}
else
{
/***** Update centre in table of degrees *****/
Deg_UpdateDegCtrDB (Gbl.CurrentDeg.Deg.DegCod,NewCtr.CtrCod);
Gbl.CurrentDeg.Deg.CtrCod =
Gbl.CurrentCtr.Ctr.CtrCod = NewCtr.CtrCod;
/***** Initialize again current course, degree, centre... *****/
Deg_InitCurrentCourse ();
/***** Initialize again current course, degree, centre... *****/
Deg_InitCurrentCourse ();
/***** Create message to show the change made *****/
sprintf (Gbl.Message,Txt_The_degree_X_has_been_moved_to_the_centre_Y,
Gbl.CurrentDeg.Deg.FullName,
Gbl.CurrentCtr.Ctr.FullName);
/***** Create message to show the change made *****/
sprintf (Gbl.Message,Txt_The_degree_X_has_been_moved_to_the_centre_Y,
Gbl.CurrentDeg.Deg.FullName,
Gbl.CurrentCtr.Ctr.FullName);
}
}
}
/*****************************************************************************/

View File

@ -78,6 +78,7 @@ static Ins_Status_t Ins_GetStatusBitsFromStatusTxt (Ins_StatusTxt_t StatusTxt);
static void Ins_PutParamOtherInsCod (long InsCod);
static bool Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t ShortOrFullName);
static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Name,long InsCod,long CtyCod);
static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod);
static void Ins_PutButtonToGoToIns (struct Institution *Ins);
static void Ins_PutFormToCreateInstitution (void);
@ -264,6 +265,7 @@ void Ins_PrintConfiguration (void)
static void Ins_Configuration (bool PrintView)
{
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_Country;
extern const char *Txt_Institution;
extern const char *Txt_Short_name;
extern const char *Txt_Web;
@ -277,6 +279,7 @@ static void Ins_Configuration (bool PrintView)
extern const char *Txt_Departments;
extern const char *Txt_Users_of_the_institution;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
unsigned NumCty;
bool PutLink = !PrintView && Gbl.CurrentIns.Ins.WWW[0];
if (Gbl.CurrentIns.Ins.InsCod > 0)
@ -302,6 +305,47 @@ static void Ins_Configuration (bool PrintView)
/***** Start table *****/
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
/***** Country *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Country);
if (!PrintView &&
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) // Only system admins can move an institution to another country
{
/* Get list of countries */
Cty_GetListCountries (Cty_GET_BASIC_DATA);
/* Put form to select country */
Act_FormStart (ActChgInsCtyCfg);
fprintf (Gbl.F.Out,"<select name=\"OthCtyCod\""
" class=\"INPUT_SHORT_NAME\""
" onchange=\"document.getElementById('%s').submit();\">",
Gbl.Form.Id);
for (NumCty = 0;
NumCty < Gbl.Ctys.Num;
NumCty++)
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
Gbl.Ctys.Lst[NumCty].CtyCod,
Gbl.Ctys.Lst[NumCty].CtyCod == Gbl.CurrentCty.Cty.CtyCod ? " selected=\"selected\"" :
"",
Gbl.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
fprintf (Gbl.F.Out,"</select>");
Act_FormEnd ();
/* Free list of countries */
Cty_FreeListCountries ();
}
else // I can not move institution to another country
fprintf (Gbl.F.Out,"%s",Gbl.CurrentCty.Cty.Name[Gbl.Prefs.Language]);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
/***** Institution full name *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
@ -1594,9 +1638,9 @@ static bool Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t
/***** Check if new name is empty *****/
if (!NewInsName[0])
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_You_can_not_leave_the_name_of_the_institution_X_empty,
CurrentInsName);
Gbl.Error = true;
}
else
{
@ -1606,9 +1650,9 @@ static bool Ins_RenameInstitution (struct Institution *Ins,Cns_ShortOrFullName_t
/***** If institution was in database... *****/
if (Ins_CheckIfInsNameExistsInCty (ParamName,NewInsName,Ins->InsCod,Gbl.CurrentCty.Cty.CtyCod))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_institution_X_already_exists,
NewInsName);
Gbl.Error = true;
}
else
{
@ -1655,13 +1699,78 @@ static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Nam
/******************* Change the country of a institution *********************/
/*****************************************************************************/
void Ins_ChangeInsCountry (void)
void Ins_ChangeInsCtyInConfig (void)
{
extern const char *Txt_The_institution_X_already_exists;
extern const char *Txt_The_country_of_the_institution_X_has_changed_to_Y;
struct Country NewCty;
/***** Get parameters from form *****/
/* Get the new country code for the institution */
if ((NewCty.CtyCod = Cty_GetParamOtherCtyCod ()) < 0)
Lay_ShowErrorAndExit ("Code of country is missing.");
/***** Check if country has changed *****/
if (NewCty.CtyCod != Gbl.CurrentIns.Ins.CtyCod)
{
/***** Get data of the country from database *****/
Cty_GetDataOfCountryByCod (&NewCty,Cty_GET_BASIC_DATA);
/***** Check if it already exists an institution with the same name in the new country *****/
if (Ins_CheckIfInsNameExistsInCty ("ShortName",Gbl.CurrentIns.Ins.ShortName,-1L,NewCty.CtyCod))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_institution_X_already_exists,
Gbl.CurrentIns.Ins.ShortName);
}
else if (Ins_CheckIfInsNameExistsInCty ("FullName",Gbl.CurrentIns.Ins.FullName,-1L,NewCty.CtyCod))
{
Gbl.Error = true;
sprintf (Gbl.Message,Txt_The_institution_X_already_exists,
Gbl.CurrentIns.Ins.FullName);
}
else
{
/***** Update the table changing the country of the institution *****/
Ins_UpdateInsCtyDB (Gbl.CurrentIns.Ins.InsCod,NewCty.CtyCod);
Gbl.CurrentIns.Ins.CtyCod =
Gbl.CurrentCty.Cty.CtyCod = NewCty.CtyCod;
/***** Initialize again current course, degree, centre... *****/
Deg_InitCurrentCourse ();
/***** Write message to show the change made *****/
sprintf (Gbl.Message,Txt_The_country_of_the_institution_X_has_changed_to_Y,
Gbl.CurrentIns.Ins.FullName,NewCty.Name[Gbl.Prefs.Language]);
}
}
}
/*****************************************************************************/
/*** Show msg. of success after changing an institution in instit. config. ***/
/*****************************************************************************/
void Ins_ContEditAfterChgInsInConfig (void)
{
/***** Write error/success message *****/
Lay_ShowAlert (Gbl.Error ? Lay_WARNING :
Lay_SUCCESS,
Gbl.Message);
/***** Show the form again *****/
Ins_ShowConfiguration ();
}
/*****************************************************************************/
/******************* Change the country of a institution *********************/
/*****************************************************************************/
void Ins_ChangeInsCty (void)
{
extern const char *Txt_The_institution_X_already_exists;
extern const char *Txt_The_country_of_the_institution_X_has_changed_to_Y;
struct Institution *Ins;
struct Country NewCty;
char Query[256];
Ins = &Gbl.Inss.EditingIns;
@ -1699,10 +1808,7 @@ void Ins_ChangeInsCountry (void)
else
{
/***** Update the table changing the country of the institution *****/
sprintf (Query,"UPDATE institutions SET CtyCod='%ld'"
" WHERE InsCod='%ld'",
NewCty.CtyCod,Ins->InsCod);
DB_QueryUPDATE (Query,"can not update the country of an institution");
Ins_UpdateInsCtyDB (Ins->InsCod,NewCty.CtyCod);
Ins->CtyCod = NewCty.CtyCod;
/***** Write message to show the change made *****/
@ -1719,6 +1825,20 @@ void Ins_ChangeInsCountry (void)
Ins_EditInstitutions ();
}
/*****************************************************************************/
/****************** Update country in table of institutions ******************/
/*****************************************************************************/
static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod)
{
char Query[128];
/***** Update country in table of institutions *****/
sprintf (Query,"UPDATE institutions SET CtyCod='%ld' WHERE InsCod='%ld'",
CtyCod,InsCod);
DB_QueryUPDATE (Query,"can not update the country of an institution");
}
/*****************************************************************************/
/********************** Change the URL of a institution **********************/
/*****************************************************************************/

View File

@ -112,7 +112,9 @@ long Ins_GetParamOtherInsCod (void);
void Ins_RemoveInstitution (void);
void Ins_RenameInsShort (void);
void Ins_RenameInsFull (void);
void Ins_ChangeInsCountry (void);
void Ins_ChangeInsCtyInConfig (void);
void Ins_ContEditAfterChgInsInConfig (void);
void Ins_ChangeInsCty (void);
void Ins_ChangeInsWWW (void);
void Ins_ChangeInsStatus (void);
void Ins_ContEditAfterChgIns (void);