Fix: Resotre synchro ldap 2 dolibarr

This commit is contained in:
Laurent Destailleur 2012-10-24 17:35:28 +02:00
parent f701c1afba
commit c88d8f5d0e

View File

@ -462,6 +462,7 @@ if ($action == 'adduserldap')
$selecteduser = $_POST['users']; $selecteduser = $_POST['users'];
$required_fields = array( $required_fields = array(
$conf->global->LDAP_KEY_USERS,
$conf->global->LDAP_FIELD_NAME, $conf->global->LDAP_FIELD_NAME,
$conf->global->LDAP_FIELD_FIRSTNAME, $conf->global->LDAP_FIELD_FIRSTNAME,
$conf->global->LDAP_FIELD_LOGIN, $conf->global->LDAP_FIELD_LOGIN,
@ -532,7 +533,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
print "<br>"; print "<br>";
print "<br>"; print "<br>";
dol_htmloutput_errors($message); dol_htmloutput_mesg($message);
if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')) if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr'))
{ {
@ -557,6 +558,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
// Get from LDAP database an array of results // Get from LDAP database an array of results
$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1); $ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
if (is_array($ldapusers)) if (is_array($ldapusers))
{ {
$liste=array(); $liste=array();
@ -586,8 +588,6 @@ if (($action == 'create') || ($action == 'adduserldap'))
} }
// Si la liste des users est rempli, on affiche la liste deroulante // Si la liste des users est rempli, on affiche la liste deroulante
if (is_array($liste))
{
print "\n\n<!-- Form liste LDAP debut -->\n"; print "\n\n<!-- Form liste LDAP debut -->\n";
print '<form name="add_user_ldap" action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form name="add_user_ldap" action="'.$_SERVER["PHP_SELF"].'" method="post">';
@ -598,16 +598,18 @@ if (($action == 'create') || ($action == 'adduserldap'))
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print '<input type="hidden" name="action" value="adduserldap">'; print '<input type="hidden" name="action" value="adduserldap">';
if (is_array($liste) && count($liste))
{
print $form->selectarray('users', $liste, '', 1); print $form->selectarray('users', $liste, '', 1);
}
print '</td><td align="center">'; print '</td><td align="center">';
print '<input type="submit" class="button" value="'.$langs->trans('Get').'">'; print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Get')).'"'.(count($liste)?'':' disabled="disabled"').'>';
print '</td></tr></table>'; print '</td></tr></table>';
print '</form>'; print '</form>';
print "\n<!-- Form liste LDAP fin -->\n\n"; print "\n<!-- Form liste LDAP fin -->\n\n";
print '<br>'; print '<br>';
} }
}
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST" name="createuser">'; print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST" name="createuser">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';