diff --git a/swad_changelog.h b/swad_changelog.h index 32fa50441..c01c39609 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -128,14 +128,15 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.225.1 (2016-06-14)" +#define Log_PLATFORM_VERSION "SWAD 15.225.2 (2016-06-15)" #define CSS_FILE "swad15.224.3.css" #define JS_FILE "swad15.216.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 15.225.1: Jun 14, 2016 New option in user administration to report a user as possible duplicated. Not finished. (202468 lines) + Version 15.225.2: Jun 15, 2016 New option in user administration to report a user as possible duplicate. Not finished. (? lines) + Version 15.225.1: Jun 14, 2016 New option in user administration to report a user as possible duplicate. Not finished. (202468 lines) Version 15.225: Jun 14, 2016 Removing a user's photo now requires confirmation. (202425 lines) 5 changes necessary in database: INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1574','es','N','Preguntar si eliminar foto otro usr.'); diff --git a/swad_enrollment.c b/swad_enrollment.c index 849ea50de..0236062b8 100644 --- a/swad_enrollment.c +++ b/swad_enrollment.c @@ -3749,7 +3749,7 @@ void Enr_ModifyUsr (void) break; case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE: if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) - Lay_ShowAlert (Lay_INFO,"Option under development."); // TODO: Program this! + Usr_ReportUsrAsPossibleDuplicate (); else Error = true; break; diff --git a/swad_user.c b/swad_user.c index 0f05ce5d1..fc744ed7e 100644 --- a/swad_user.c +++ b/swad_user.c @@ -2705,6 +2705,7 @@ static void Usr_InsertMyLastData (void) (long) (time_t) 0); // The user never accessed to notifications DB_QueryINSERT (Query,"can not insert last user's data"); } + /*****************************************************************************/ /************* Write a row of a table with the data of a guest ***************/ /*****************************************************************************/ @@ -7841,3 +7842,34 @@ void Usr_RemoveUsrFromUsrBanned (long UsrCod) UsrCod); DB_QueryDELETE (Query,"can not remove user from users banned"); } + +/*****************************************************************************/ +/******************** Report a user as possible duplicate ********************/ +/*****************************************************************************/ + +void Usr_ReportUsrAsPossibleDuplicate (void) + { + extern const char *Txt_User_not_found_or_you_do_not_have_permission_; + char Query[256]; + bool ItsMe; + + /***** Get user to be reported as possible duplicate *****/ + if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) + { + /* Check if it's allowed to me to report users as possible duplicatedr */ + ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); + if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) + { + sprintf (Query,"REPLACE INTO usr_dup (UsrCod,UsrWhoReported,TimeReport)" + " VALUES ('%ld','%ld',NOW())", + Gbl.Usrs.Other.UsrDat.UsrCod, + Gbl.Usrs.Me.UsrDat.UsrCod); + Lay_ShowAlert (Lay_INFO,Query); // TODO: Remove this line, written only for debug purposes + // DB_QueryINSERT (Query,"can not report duplicate"); + } + else + Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + } + else + Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + } diff --git a/swad_user.h b/swad_user.h index fc4212967..be6b56779 100644 --- a/swad_user.h +++ b/swad_user.h @@ -350,4 +350,6 @@ void Usr_GetAndShowNumUsrsInPlatform (Rol_Role_t Role); bool Usr_CheckIfUsrBanned (long UsrCod); void Usr_RemoveUsrFromUsrBanned (long UsrCod); +void Usr_ReportUsrAsPossibleDuplicate (void); + #endif