diff --git a/swad_changelog.h b/swad_changelog.h index 6fa0404dd..b7547b4b7 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -120,6 +120,7 @@ // TODO: In social refreshing via AJAX, an error occurs when session expirates // TODO: Messages in msg_content_deleted older than a certain time should be deleted to ensure the protection of personal data // TODO: FIX BUG: A teacher uploads a document in course documents zone, then he/she unregister from course, then he/she search for his/her documents, a document is shown in results but he/she can not view it +// TODO: Add StackOverflow (and similar) to webs/networks // TODO: Modify WS function getUsers changing: userRole to indicate all users, and a new parameter filter (search string (name, @nickname, mail)) to restring number of users // TODO: Add a new WS function to count the nunmber of users to return in call to function getUsers @@ -128,13 +129,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.226 (2016-06-17)" +#define Log_PLATFORM_VERSION "SWAD 15.226.1 (2016-06-17)" #define CSS_FILE "swad15.226.css" #define JS_FILE "swad15.226.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.226.1: Jun 17, 2016 Changed layout of listing of similar users. (202887 lines) Version 15.226: Jun 17, 2016 Fixed bug in photo zoom. (202870 lines) Version 15.225.21:Jun 17, 2016 Fixed bug in photo zoom, reported by Javier Fernández Baldomero. (202894 lines) Version 15.225.20:Jun 17, 2016 Show details of user's profile in similar users. (202893 lines) diff --git a/swad_duplicate.c b/swad_duplicate.c index 10fb96fb7..18f493f22 100644 --- a/swad_duplicate.c +++ b/swad_duplicate.c @@ -63,6 +63,8 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ +static bool Usr_CheckIfUsrIsDup (long UsrCod); + /*****************************************************************************/ /******************** Report a user as possible duplicate ********************/ /*****************************************************************************/ @@ -236,6 +238,7 @@ void Dup_ListSimilarUsrs (void) extern const char *Txt_Informants; extern const char *Txt_Similar_users; extern const char *Txt_No_users_found[Rol_NUM_ROLES]; + struct UsrData UsrDatFromForm; struct UsrData UsrDat; char Query[256]; MYSQL_RES *mysql_res; @@ -244,7 +247,7 @@ void Dup_ListSimilarUsrs (void) unsigned NumUsr; /***** Get user's code *****/ - Usr_GetParamOtherUsrCodEncrypted (&UsrDat); + Usr_GetParamOtherUsrCodEncrypted (&UsrDatFromForm); /***** Start frame with list of possible duplicate users *****/ Lay_StartRoundFrame (NULL,Txt_Possibly_duplicate_users,NULL); @@ -253,7 +256,7 @@ void Dup_ListSimilarUsrs (void) sprintf (Query,"SELECT DISTINCT UsrCod FROM usr_IDs" " WHERE usr_IDs.UsrID IN" " (SELECT UsrID FROM usr_IDs WHERE UsrCod='%ld')", - UsrDat.UsrCod); + UsrDatFromForm.UsrCod); NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get similar users"); /***** List possible duplicated users *****/ @@ -317,18 +320,21 @@ void Dup_ListSimilarUsrs (void) Usr_NUM_MAIN_FIELDS_DATA_USR-2, Gbl.RowEvenOdd); - // TODO: Show the following button only if this user is in list of duplicates - Act_FormStart (ActLstSimUsr); // TODO: Change to a new action - Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); - Lay_PutConfirmButtonInline ("No es duplicado"); // TODO: Need translation!!! - Act_FormEnd (); - /* Button to remove this user */ Act_FormStart (ActLstSimUsr); // TODO: Change to action to request confirmation to remove Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); Lay_PutRemoveButtonInline ("Eliminar usuario"); // TODO: Need translation!!! Act_FormEnd (); + /* Button to remove from list of possible duplicate users */ + if (Usr_CheckIfUsrIsDup (UsrDat.UsrCod)) + { + Act_FormStart (ActLstSimUsr); // TODO: Change to a new action + Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); + Lay_PutConfirmButtonInline ("No es duplicado"); // TODO: Need translation!!! + Act_FormEnd (); + } + fprintf (Gbl.F.Out,"" ""); @@ -349,6 +355,19 @@ void Dup_ListSimilarUsrs (void) Lay_EndRoundFrame (); } +/*****************************************************************************/ +/********** Check if a user is in list of possible duplicate users ***********/ +/*****************************************************************************/ + +static bool Usr_CheckIfUsrIsDup (long UsrCod) + { + char Query[128]; + + sprintf (Query,"SELECT COUNT(*) FROM usr_duplicated WHERE UsrCod='%ld'", + UsrCod); + return (DB_QueryCOUNT (Query,"can not if user is in list of possible duplicate users") != 0); + } + /*****************************************************************************/ /********************* Remove a request for enrollment ***********************/ /*****************************************************************************/