Fix tests + fix php warning

pull/2487/head
jmontoyaa 7 years ago
parent e69b5f093e
commit a4a4172257
  1. 19
      main/admin/dashboard_add_users_to_user.php
  2. 4
      tests/behat/features/createUser.feature

@ -287,7 +287,7 @@ if (!empty($filters) && !empty($filterData)) {
}
if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
$user_list = $_POST['UsersList'];
$user_list = isset($_POST['UsersList']) ? $_POST['UsersList'] : null;
switch ($userStatus) {
case DRH:
//no break;
@ -391,12 +391,13 @@ if (!empty($conditions)) {
if (api_is_multiple_url_enabled()) {
$sql = "SELECT user.user_id, username, lastname, firstname
FROM $tbl_user user LEFT JOIN $tbl_access_url_rel_user au
FROM $tbl_user user
LEFT JOIN $tbl_access_url_rel_user au
ON (au.user_id = user.user_id)
WHERE
$without_assigned_users
user.user_id NOT IN ($user_anonymous, $current_user_id, $user_id) AND
status NOT IN(".DRH.", ".SESSIONADMIN.") $search_user AND
status NOT IN(".DRH.", ".SESSIONADMIN.", ".ANONYMOUS.") $search_user AND
access_url_id = ".api_get_current_access_url_id()."
$sqlConditions
ORDER BY firstname";
@ -406,7 +407,7 @@ if (api_is_multiple_url_enabled()) {
WHERE
$without_assigned_users
user_id NOT IN ($user_anonymous, $current_user_id, $user_id) AND
status NOT IN(".DRH.", ".SESSIONADMIN.")
status NOT IN(".DRH.", ".SESSIONADMIN.", ".ANONYMOUS.")
$search_user
$sqlConditions
ORDER BY firstname ";
@ -423,11 +424,11 @@ $result = Database::query($sql);
<div id="ajax_list_users_multiple">
<select id="origin" class="form-control" name="NoAssignedUsersList[]" multiple="multiple" size="15">
<?php
while ($enreg = Database::fetch_array($result)) {
$person_name = api_get_person_name($enreg['firstname'], $enreg['lastname']); ?>
<option value="<?php echo $enreg['user_id']; ?>" <?php echo 'title="'.htmlspecialchars($person_name, ENT_QUOTES).'"'; ?>>
<?php echo $person_name.' ('.$enreg['username'].')'; ?>
</option>
while ($enreg = Database::fetch_array($result)) {
$person_name = api_get_person_name($enreg['firstname'], $enreg['lastname']); ?>
<option value="<?php echo $enreg['user_id']; ?>" <?php echo 'title="'.htmlspecialchars($person_name, ENT_QUOTES).'"'; ?>>
<?php echo $person_name.' ('.$enreg['username'].')'; ?>
</option>
<?php } ?>
</select>
</div>

@ -74,11 +74,12 @@ Feature: Users management as admin
And I fill in select bootstrap static input "#status_select" select "5"
And I press "submit"
Then I should see "The user has been added"
#
Scenario: HRM follows teacher
Given I am a platform administrator
And I am on "/main/admin/user_list.php?keyword=hrm&submit=&_qf__search_simple="
And I should see "HRM lastname"
And I should see "Human Resources Manager"
And I follow "Assign users"
And I select "teacher firstname teacher lastname" from "NoAssignedUsersList[]"
And I press "add_user_button"
@ -89,6 +90,7 @@ Feature: Users management as admin
Given I am a platform administrator
And I am on "/main/admin/user_list.php?keyword=hrm&submit=&_qf__search_simple="
And I should see "HRM lastname"
And I should see "Human Resources Manager"
And I follow "Assign users"
And I select "student firstname student lastname" from "NoAssignedUsersList[]"
And I press "add_user_button"

Loading…
Cancel
Save