From ec40c54cb9c47661bae00a6d90f4f45dc01989d4 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 18 Feb 2013 18:46:31 +0000 Subject: [PATCH] show duplicate values for unique columns --- lam/templates/massBuildAccounts.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lam/templates/massBuildAccounts.php b/lam/templates/massBuildAccounts.php index d5197297..0ef6e525 100644 --- a/lam/templates/massBuildAccounts.php +++ b/lam/templates/massBuildAccounts.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2004 - 2012 Roland Gruber + Copyright (C) 2004 - 2013 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -163,7 +163,14 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) { } $values_unique = array_unique($values_given); if (sizeof($values_given) != sizeof($values_unique)) { - $errors[] = array(_("This column is defined to include unique entries but duplicates were found:"), $columns[$i]['name']); + $duplicates = array(); + foreach ($values_given as $key => $value) { + if (!isset($values_unique[$key])) { + $duplicates[] = htmlspecialchars($value); + } + } + $duplicates = array_values(array_unique($duplicates)); + $errors[] = array(_("This column is defined to include unique entries but duplicates were found:") . ' ' . $columns[$i]['name'], implode(', ', $duplicates)); } } }