From 09beccd9c60ba8a19355eaee22359e02bf3e4a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 23 Oct 2016 18:39:04 +0200 Subject: [PATCH] Version 16.41.2 --- swad_changelog.h | 3 ++- swad_course.c | 6 ++---- swad_degree.c | 31 ++++++++++--------------------- swad_degree_type.c | 3 +-- swad_photo.c | 3 +-- 5 files changed, 16 insertions(+), 30 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 7270962f4..c571b3e1d 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -150,13 +150,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.41.1 (2016-10-23)" +#define Log_PLATFORM_VERSION "SWAD 16.41.2 (2016-10-23)" #define CSS_FILE "swad16.32.1.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.41.2: Oct 23, 2016 Code refactoring in degrees. (205430 lines) Version 16.41.1: Oct 23, 2016 Code refactoring in courses. (205443 lines) Version 16.41: Oct 23, 2016 New form in degree configuration to change short name. (205453 lines) 1 change necessary in database: diff --git a/swad_course.c b/swad_course.c index 1ac81b778..aba7e8d33 100644 --- a/swad_course.c +++ b/swad_course.c @@ -2411,10 +2411,8 @@ void Crs_ChangeCrsDegInConfig (void) extern const char *Txt_The_course_X_has_been_moved_to_the_degree_Y; struct Degree NewDeg; - /***** Get parameters from form *****/ - /* Get parameter with degree code */ - if ((NewDeg.DegCod = Deg_GetParamOtherDegCod ()) == -1L) - Lay_ShowErrorAndExit ("Code of degree is missing."); + /***** Get parameter with degree code *****/ + NewDeg.DegCod = Deg_GetParamOtherDegCod (); /***** Check if degree has changed *****/ if (NewDeg.DegCod != Gbl.CurrentCrs.Crs.DegCod) diff --git a/swad_degree.c b/swad_degree.c index 0e8277b20..354bf828c 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -106,7 +106,6 @@ static void Deg_RecFormRequestOrCreateDeg (unsigned Status); static void Deg_PutParamOtherDegCod (long DegCod); static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row); -static void Deg_GetDegCodFromForm (void); static void Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFullName); static bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Name,long DegCod,long CtrCod); static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod); @@ -1987,8 +1986,7 @@ void Deg_RemoveDegree (void) struct Degree Deg; /***** Get degree code *****/ - if ((Deg.DegCod = Deg_GetParamOtherDegCod ()) == -1L) - Lay_ShowErrorAndExit ("Code of degree is missing."); + Deg.DegCod = Deg_GetParamOtherDegCod (); /***** Get data of degree *****/ Deg_GetDataOfDegreeByCod (&Deg); @@ -2036,10 +2034,14 @@ static void Deg_PutParamOtherDegCod (long DegCod) long Deg_GetParamOtherDegCod (void) { char LongStr[1+10+1]; + long DegCod; /***** Get parameter with code of degree *****/ Par_GetParToText ("OthDegCod",LongStr,1+10); - return Str_ConvertStrCodToLongCod (LongStr); + if ((DegCod = Str_ConvertStrCodToLongCod (LongStr)) < 0) + Lay_ShowErrorAndExit ("Code of degree is missing."); + + return DegCod; } /*****************************************************************************/ @@ -2331,7 +2333,7 @@ void Deg_RemoveDegreeCompletely (long DegCod) void Deg_RenameDegreeShort (void) { - Deg_GetDegCodFromForm (); + Gbl.Degs.EditingDeg.DegCod = Deg_GetParamOtherDegCod (); Deg_RenameDegree (&Gbl.Degs.EditingDeg,Cns_SHORT_NAME); } @@ -2346,7 +2348,7 @@ void Deg_RenameDegreeShortInConfig (void) void Deg_RenameDegreeFull (void) { - Deg_GetDegCodFromForm (); + Gbl.Degs.EditingDeg.DegCod = Deg_GetParamOtherDegCod (); Deg_RenameDegree (&Gbl.Degs.EditingDeg,Cns_FULL_NAME); } @@ -2355,17 +2357,6 @@ void Deg_RenameDegreeFullInConfig (void) Deg_RenameDegree (&Gbl.CurrentDeg.Deg,Cns_FULL_NAME); } -/*****************************************************************************/ -/************************ Get the code of the degree *************************/ -/*****************************************************************************/ - -static void Deg_GetDegCodFromForm (void) - { - /***** Get the code of the degree *****/ - if ((Gbl.Degs.EditingDeg.DegCod = Deg_GetParamOtherDegCod ()) < 0) - Lay_ShowErrorAndExit ("Code of degree is missing."); - } - /*****************************************************************************/ /************************ Change the name of a degree ************************/ /*****************************************************************************/ @@ -2557,8 +2548,7 @@ void Deg_ChangeDegWWW (void) /***** Get parameters from form *****/ /* Get the code of the degree */ - if ((Deg->DegCod = Deg_GetParamOtherDegCod ()) == -1L) - Lay_ShowErrorAndExit ("Code of degree is missing."); + Deg->DegCod = Deg_GetParamOtherDegCod (); /* Get the new WWW for the degree */ Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW); @@ -2646,8 +2636,7 @@ void Deg_ChangeDegStatus (void) /***** Get parameters from form *****/ /* Get degree code */ - if ((Deg->DegCod = Deg_GetParamOtherDegCod ()) == -1L) - Lay_ShowErrorAndExit ("Code of degree is missing."); + Deg->DegCod = Deg_GetParamOtherDegCod (); /* Get parameter with status */ Par_GetParToText ("Status",UnsignedNum,1); diff --git a/swad_degree_type.c b/swad_degree_type.c index 326663491..6184e12df 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -813,8 +813,7 @@ void DT_ChangeDegreeType (void) /***** Get parameters from form *****/ /* Get degree code */ - if ((Deg->DegCod = Deg_GetParamOtherDegCod ()) == -1L) - Lay_ShowErrorAndExit ("Code of degree is missing."); + Deg->DegCod = Deg_GetParamOtherDegCod (); /* Get the new degree type */ NewDegTypCod = DT_GetParamOtherDegTypCod (); diff --git a/swad_photo.c b/swad_photo.c index 7d5e8101a..ebedfd050 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -1274,8 +1274,7 @@ void Pho_CalcPhotoDegree (void) Fil_RemoveOldTmpFiles (PathPhotosTmpPriv,Cfg_TIME_TO_DELETE_PHOTOS_TMP_FILES,false); /***** Get the degree which photo will be computed *****/ - if ((DegCod = Deg_GetParamOtherDegCod ()) == -1L) - Lay_ShowErrorAndExit ("Code of degree is missing."); + DegCod = Deg_GetParamOtherDegCod (); /***** Prevent the computing of an average photo too recently updated *****/ if (Pho_GetTimeAvgPhotoWasComputed (DegCod) >=