diff --git a/swad_centre.c b/swad_centre.c index db887e07b..b2005de35 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -81,7 +81,7 @@ static Ctr_StatusTxt_t Ctr_GetStatusTxtFromStatusBits (Ctr_Status_t Status); static Ctr_Status_t Ctr_GetStatusBitsFromStatusTxt (Ctr_StatusTxt_t StatusTxt); static void Ctr_PutParamOtherCtrCod (long CtrCod); static void Ctr_RenameCentre (Cns_ShortOrFullName_t ShortOrFullName); -static bool Ctr_CheckIfCentreNameExists (const char *FieldName,const char *Name,long CtrCod); +static bool Ctr_CheckIfCentreNameExistsInCurrentIns (const char *FieldName,const char *Name,long CtrCod); static void Ctr_PutFormToChangeCtrPhoto (bool PhotoExists); static void Ctr_PutFormToCreateCentre (void); static void Ctr_PutHeadCentresForSeeing (bool OrderSelectable); @@ -1601,7 +1601,7 @@ static void Ctr_RenameCentre (Cns_ShortOrFullName_t ShortOrFullName) if (strcmp (CurrentCtrName,NewCtrName)) // Different names { /***** If degree was in database... *****/ - if (Ctr_CheckIfCentreNameExists (ParamName,NewCtrName,Ctr->CtrCod)) + if (Ctr_CheckIfCentreNameExistsInCurrentIns (ParamName,NewCtrName,Ctr->CtrCod)) { sprintf (Gbl.Message,Txt_The_centre_X_already_exists, NewCtrName); @@ -1637,14 +1637,14 @@ static void Ctr_RenameCentre (Cns_ShortOrFullName_t ShortOrFullName) /********************* Check if the name of centre exists ********************/ /*****************************************************************************/ -static bool Ctr_CheckIfCentreNameExists (const char *FieldName,const char *Name,long CtrCod) +static bool Ctr_CheckIfCentreNameExistsInCurrentIns (const char *FieldName,const char *Name,long CtrCod) { char Query[512]; /***** Get number of centres with a name from database *****/ sprintf (Query,"SELECT COUNT(*) FROM centres" - " WHERE %s='%s' AND CtrCod<>'%ld'", - FieldName,Name,CtrCod); + " WHERE InsCod='%ld' AND %s='%s' AND CtrCod<>'%ld'", + Gbl.CurrentIns.Ins.InsCod,FieldName,Name,CtrCod); return (DB_QueryCOUNT (Query,"can not check if the name of a centre already existed") != 0); } @@ -2216,13 +2216,13 @@ static void Ctr_RecFormRequestOrCreateCtr (unsigned Status) if (Ctr->WWW[0]) { /***** If name of centre was in database... *****/ - if (Ctr_CheckIfCentreNameExists ("ShortName",Ctr->ShortName,-1L)) + if (Ctr_CheckIfCentreNameExistsInCurrentIns ("ShortName",Ctr->ShortName,-1L)) { sprintf (Gbl.Message,Txt_The_centre_X_already_exists, Ctr->ShortName); Lay_ShowAlert (Lay_WARNING,Gbl.Message); } - else if (Ctr_CheckIfCentreNameExists ("FullName",Ctr->FullName,-1L)) + else if (Ctr_CheckIfCentreNameExistsInCurrentIns ("FullName",Ctr->FullName,-1L)) { sprintf (Gbl.Message,Txt_The_centre_X_already_exists, Ctr->FullName); diff --git a/swad_changelog.h b/swad_changelog.h index fce4d8519..30e774d6e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -39,12 +39,13 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.54.6 (2015/01/13)" +#define Log_PLATFORM_VERSION "SWAD 14.54.7 (2015/01/13)" // 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 | tail -1 /* - Version 14.54.6: Jan 13, 2015 Tabd and menu icons always in 64x64 pixels. (173348 lines) + Version 14.54.7: Jan 13, 2015 Fixed bug in edition of centres. (173349 lines) + Version 14.54.6: Jan 13, 2015 Tab and menu icons always in 64x64 pixels. (173348 lines) Version 14.54.5: Jan 13, 2015 Icons for institutions, centres and degrees always in 64x64 pixels. (173346 lines) Version 14.54.4: Jan 13, 2015 Fized bug in photos. (173345 lines) Version 14.54.3: Jan 06, 2015 Changes in themes and colors. (173344 lines)