Code Duplication    Length = 6-8 lines in 3 locations

main/admin/user_import.php 1 location

@@ 36-41 (lines=6) @@
33
    $usergroup = new UserGroup();
34
35
    foreach ($users as $user) {
36
        foreach ($mandatory_fields as $field) {
37
            if (empty($user[$field])) {
38
                $user['error'] = get_lang($field.'Mandatory');
39
                $errors[] = $user;
40
            }
41
        }
42
        $username = $user['UserName'];
43
        // 2. Check username, first, check whether it is empty.
44
        if (!UserManager::is_username_empty($username)) {

main/admin/user_update_import.php 1 location

@@ 34-41 (lines=8) @@
31
    $usergroup = new UserGroup();
32
33
    foreach ($users as $user) {
34
        foreach ($mandatory_fields as $field) {
35
            if (isset($user[$field])) {
36
                if (empty($user[$field])) {
37
                    $user['error'] = get_lang($field.'Mandatory');
38
                    $errors[] = $user;
39
                }
40
            }
41
        }
42
43
        // 2. Check username, first, check whether it is empty.
44

main/admin/skills_import.php 1 location

@@ 24-29 (lines=6) @@
21
    // 1. Check if mandatory fields are set.
22
    $mandatory_fields = array('id', 'parent_id', 'name');
23
    foreach ($skills as $index => $skill) {
24
        foreach ($mandatory_fields as $field) {
25
            if (empty($skill[$field])) {
26
                $skill['error'] = get_lang(ucfirst($field).'Mandatory');
27
                $errors[] = $skill;
28
            }
29
        }
30
        // 2. Check skill ID is not empty
31
        if (!isset($skill['id']) || empty($skill['id'])) {
32
            $skill['error'] = get_lang('SkillImportNoID');