From 3614ba9451a1cc4eaf5694e4b3eb183df973c38f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Tue, 18 Apr 2017 09:55:53 +0200 Subject: [PATCH] Fixed compare of duplicated users while csv user import. --- CHANGELOG | 1 + openslides/users/static/js/users/site.js | 28 ++++++++++--- .../static/templates/users/user-import.html | 41 +++++++++++-------- 3 files changed, 47 insertions(+), 23 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 08f9d2d51..7763a5d11 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,6 +32,7 @@ Users: permissions [#3191]. - Added support for password validation using Django or custom validators e. g. for minimum password length [#3200]. +- Fixed compare of duplicated users while csv user import [#3201]. Version 2.1.1 (2017-04-05) diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 004719437..fe4289a4f 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -1021,9 +1021,17 @@ angular.module('OpenSlidesApp.users.site', [ // Check for duplicates user.duplicate = false; users.forEach(function(user_) { - if (user_.first_name == user.first_name && - user_.last_name == user.last_name && - user_.structure_level == user.structure_level) { + user_.fullname = [ + user_.title, + user_.first_name, + user_.last_name, + user_.structure_level].join(' ').trim(); + user.fullname = [ + user.title, + user.first_name, + user.last_name, + user.structure_level].join(' ').trim(); + if (user_.fullname === user.fullname) { if (user.duplicate) { // there are multiple duplicates! user.duplicate_info += '\n' + gettextCatalog.getString('There are more than one duplicates of this user!'); @@ -1130,9 +1138,17 @@ angular.module('OpenSlidesApp.users.site', [ // delete existing user var deletePromises = []; existingUsers.forEach(function(user_) { - if (user_.first_name == user.first_name && - user_.last_name == user.last_name && - user_.structure_level == user.structure_level) { + user_.fullname = [ + user_.title, + user_.first_name, + user_.last_name, + user_.structure_level].join(' ').trim(); + user.fullname = [ + user.title, + user.first_name, + user.last_name, + user.structure_level].join(' ').trim(); + if (user_.fullname === user.fullname) { deletePromises.push(User.destroy(user_.id)); } }); diff --git a/openslides/users/static/templates/users/user-import.html b/openslides/users/static/templates/users/user-import.html index 53b002fc6..34b51184e 100644 --- a/openslides/users/static/templates/users/user-import.html +++ b/openslides/users/static/templates/users/user-import.html @@ -189,23 +189,30 @@ last-text="»"> -
- - {{ usersWillNotBeImported }} - participants will be not imported. -
-
- - {{ usersWillBeImported }} - participants will be imported. -
-
-
-
- - {{ usersImported.length }} - participants were successfully imported. - (Groups created: {{ groupsCreated }}) +
+
+ + {{ usersWillNotBeImported }} + participants will be not imported. +
+
+ + {{ duplicates }} + duplicates! +
+
+ + {{ usersWillBeImported }} + participants will be imported. +
+
+
+
+ + {{ usersImported.length }} + participants were successfully imported. + (Groups created: {{ groupsCreated }}) +