diff --git a/swad_changelog.h b/swad_changelog.h index 7ac0b815f..4bd538b2e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -233,13 +233,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.232 (2017-05-31)" +#define Log_PLATFORM_VERSION "SWAD 16.232.1 (2017-05-31)" #define CSS_FILE "swad16.226.css" #define JS_FILE "swad16.206.3.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.232.1: May 31, 2017 Improvements in selection of user's institution, centre and department. (221085 lines) Version 16.232: May 31, 2017 Fix bug in selection of user's centre. (221042 lines) Version 16.231.4: May 31, 2017 Changes in layout of statistics about institutions. Fixed bug in search. (221039 lines) diff --git a/swad_department.c b/swad_department.c index d464d701e..8168049ef 100644 --- a/swad_department.c +++ b/swad_department.c @@ -1111,7 +1111,7 @@ unsigned Dpt_GetTotalNumberOfDepartments (void) /**************** Get number of departments in a institution *****************/ /*****************************************************************************/ -unsigned Dpt_GetNumberOfDepartmentsInInstitution (long InsCod) +unsigned Dpt_GetNumDptsInIns (long InsCod) { char Query[128]; diff --git a/swad_department.h b/swad_department.h index f315d8b13..323056cf0 100644 --- a/swad_department.h +++ b/swad_department.h @@ -69,7 +69,7 @@ void Dpt_RenameDepartFull (void); void Dpt_ChangeDptWWW (void); void Dpt_RecFormNewDpt (void); unsigned Dpt_GetTotalNumberOfDepartments (void); -unsigned Dpt_GetNumberOfDepartmentsInInstitution (long InsCod); +unsigned Dpt_GetNumDptsInIns (long InsCod); void Dpt_WriteSelectorDepartment (long InsCod); diff --git a/swad_institution.c b/swad_institution.c index 2e326bf40..23cadcd8e 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -1066,7 +1066,7 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData) Ins->NumCrss = Crs_GetNumCrssInIns (Ins->InsCod); /* Get number of departments in this institution */ - Ins->NumDpts = Dpt_GetNumberOfDepartmentsInInstitution (Ins->InsCod); + Ins->NumDpts = Dpt_GetNumDptsInIns (Ins->InsCod); /* Get number of users in courses */ Ins->NumUsrs = Usr_GetNumUsrsInCrssOfIns (Rol_UNK,Ins->InsCod); // Here Rol_UNK means "all users" @@ -1165,7 +1165,7 @@ bool Ins_GetDataOfInstitutionByCod (struct Instit *Ins, Ins->NumCtrs = Ctr_GetNumCtrsInIns (Ins->InsCod); /* Get number of departments in this institution */ - Ins->NumDpts = Dpt_GetNumberOfDepartmentsInInstitution (Ins->InsCod); + Ins->NumDpts = Dpt_GetNumDptsInIns (Ins->InsCod); /* Get number of degrees in this institution */ Ins->NumDegs = Deg_GetNumDegsInIns (Ins->InsCod); diff --git a/swad_record.c b/swad_record.c index 2dbe74389..b9ec233ff 100644 --- a/swad_record.c +++ b/swad_record.c @@ -3973,7 +3973,8 @@ void Rec_ShowFormMyInsCtrDpt (void) extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *Txt_Please_select_the_country_of_your_institution; extern const char *Txt_Please_fill_in_your_institution; - extern const char *Txt_Please_fill_in_your_centre_and_department; + extern const char *Txt_Please_fill_in_your_centre; + extern const char *Txt_Please_fill_in_your_department; extern const char *Txt_Institution_centre_and_department; extern const char *Txt_Institution; extern const char *Txt_Country_of_your_institution; @@ -4002,10 +4003,13 @@ void Rec_ShowFormMyInsCtrDpt (void) Ale_ShowAlert (Ale_WARNING,Txt_Please_select_the_country_of_your_institution); else if (Gbl.Usrs.Me.UsrDat.InsCod < 0) Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_institution); - else if ((Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TCH)) && - (Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0 || - Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0)) - Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_centre_and_department); + else if ((Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TCH))) + { + if (Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0) + Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_centre); + else if (Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0) + Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_department); + } /***** Start table *****/ Lay_StartRoundFrameTable ("800px", @@ -4248,14 +4252,27 @@ void Rec_ShowFormMyInsCtrDpt (void) void Rec_ChgCountryOfMyInstitution (void) { + unsigned NumInss; + /***** Get country code of my institution *****/ Gbl.Usrs.Me.UsrDat.InsCtyCod = Cty_GetAndCheckParamOtherCtyCod (0); + /***** When country changes, the institution, centre and department must be reset *****/ + NumInss = Ins_GetNumInssInCty (Gbl.Usrs.Me.UsrDat.InsCtyCod); + if (NumInss) + { + Gbl.Usrs.Me.UsrDat.InsCod = -1L; + Gbl.Usrs.Me.UsrDat.Tch.CtrCod = -1L; + Gbl.Usrs.Me.UsrDat.Tch.DptCod = -1L; + } + else // Country has no institutions + { + Gbl.Usrs.Me.UsrDat.InsCod = 0; // Another institution + Gbl.Usrs.Me.UsrDat.Tch.CtrCod = 0; // Another centre + Gbl.Usrs.Me.UsrDat.Tch.DptCod = 0; // Another department + } + /***** Update institution, centre and department *****/ - // When country changes, the institution, centre and department must be reset - Gbl.Usrs.Me.UsrDat.InsCod = -1L; - Gbl.Usrs.Me.UsrDat.Tch.CtrCod = -1L; - Gbl.Usrs.Me.UsrDat.Tch.DptCod = -1L; Enr_UpdateInstitutionCentreDepartment (); /***** Show form again *****/ @@ -4269,6 +4286,8 @@ void Rec_ChgCountryOfMyInstitution (void) void Rec_UpdateMyInstitution (void) { struct Instit Ins; + unsigned NumCtrs; + unsigned NumDpts; /***** Get my institution *****/ /* Get institution code */ @@ -4282,10 +4301,16 @@ void Rec_UpdateMyInstitution (void) Gbl.Usrs.Me.UsrDat.InsCtyCod = Ins.CtyCod; } - /***** Update institution, centre and department *****/ + /* Set institution code */ Gbl.Usrs.Me.UsrDat.InsCod = Ins.InsCod; - Gbl.Usrs.Me.UsrDat.Tch.CtrCod = -1L; - Gbl.Usrs.Me.UsrDat.Tch.DptCod = -1L; + + /***** When institution changes, the centre and department must be reset *****/ + NumCtrs = Ctr_GetNumCtrsInIns (Gbl.Usrs.Me.UsrDat.InsCod); + NumDpts = Dpt_GetNumDptsInIns (Gbl.Usrs.Me.UsrDat.InsCod); + Gbl.Usrs.Me.UsrDat.Tch.CtrCod = (NumCtrs ? -1L : 0); + Gbl.Usrs.Me.UsrDat.Tch.DptCod = (NumDpts ? -1L : 0); + + /***** Update institution, centre and department *****/ Enr_UpdateInstitutionCentreDepartment (); /***** Show form again *****/ @@ -4315,8 +4340,10 @@ void Rec_UpdateMyCentre (void) } } - /***** Update institution, centre and department *****/ + /* Set centre code */ Gbl.Usrs.Me.UsrDat.Tch.CtrCod = Ctr.CtrCod; + + /***** Update institution, centre and department *****/ Enr_UpdateInstitutionCentreDepartment (); /***** Show form again *****/ diff --git a/swad_text.c b/swad_text.c index 8bfeaed3e..5584ec737 100644 --- a/swad_text.c +++ b/swad_text.c @@ -28930,25 +28930,46 @@ const char *Txt_Please_enter_your_ID = "Por favor, digite nº de identificação."; #endif -const char *Txt_Please_fill_in_your_centre_and_department = +const char *Txt_Please_fill_in_your_centre = #if L==1 - "Si us plau, ompli el seu centre i department."; + "Si us plau, ompli el seu centre."; #elif L==2 - "Bitte geben Sie Ihre Zentrum und Abteilung zu füllen."; + "Bitte geben Sie Ihre Zentrum zu füllen."; #elif L==3 - "Please fill in your centre and department."; + "Please fill in your centre."; #elif L==4 - "Por favor, rellene su centro y departamento."; + "Por favor, rellene su centro."; #elif L==5 - "S'il vous plaít, indiquez votre centre et département."; + "S'il vous plaít, indiquez votre centre."; #elif L==6 - "Por favor, rellene su centro y departamento."; // Okoteve traducción + "Por favor, rellene su centro."; // Okoteve traducción #elif L==7 - "Per favore, inserisci il tuo centro e dipartimento."; + "Per favore, inserisci il tuo centro."; #elif L==8 - "Proszę, wpisz swoje tym centrum i działu."; + "Proszę, wpisz swoje tym centrum."; #elif L==9 - "Por favor, preencha o seu centro e departamento."; + "Por favor, preencha o seu centro."; +#endif + +const char *Txt_Please_fill_in_your_department = +#if L==1 + "Si us plau, ompli el seu department."; +#elif L==2 + "Bitte geben Sie Ihre Abteilung zu füllen."; +#elif L==3 + "Please fill in your department."; +#elif L==4 + "Por favor, rellene su departamento."; +#elif L==5 + "S'il vous plaít, indiquez votre département."; +#elif L==6 + "Por favor, rellene su departamento."; // Okoteve traducción +#elif L==7 + "Per favore, inserisci il tuo dipartimento."; +#elif L==8 + "Proszę, wpisz swoje tym działu."; +#elif L==9 + "Por favor, preencha o seu departamento."; #endif const char *Txt_Please_fill_in_your_email_address =