Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-09-16 19:23:26 +02:00
commit ee4d404148
11 changed files with 31 additions and 21 deletions

View File

@ -143,7 +143,7 @@ if (!function_exists("ldap_connect")) {
print dol_get_fiche_head($head, 'contacts', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'contacts', $langs->trans("LDAPSetup"), -1);
print $langs->trans("LDAPDescContact").'<br>'; print '<span class="opacitymedium">'.$langs->trans("LDAPDescContact").'</span><br>';
print '<br>'; print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';

View File

@ -117,7 +117,7 @@ if (!function_exists("ldap_connect")) {
print dol_get_fiche_head($head, 'groups', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'groups', $langs->trans("LDAPSetup"), -1);
print $langs->trans("LDAPDescGroups").'<br>'; print '<span class="opacitymedium">'.$langs->trans("LDAPDescGroups").'</span><br>';
print '<br>'; print '<br>';

View File

@ -191,7 +191,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1);
print $langs->trans("LDAPDescMembers").'<br>'; print '<span class="opacitymedium">'.$langs->trans("LDAPDescMembers").'</span><br>';
print '<br>'; print '<br>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';

View File

@ -109,7 +109,7 @@ if (!function_exists("ldap_connect")) {
print dol_get_fiche_head($head, 'memberstypes', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'memberstypes', $langs->trans("LDAPSetup"), -1);
print $langs->trans("LDAPDescMembersTypes").'<br>'; print '<span class="opacitymedium">'.$langs->trans("LDAPDescMembersTypes").'</span><br>';
print '<br>'; print '<br>';

View File

@ -180,7 +180,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'users', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'users', $langs->trans("LDAPSetup"), -1);
print $langs->trans("LDAPDescUsers").'<br>'; print '<span class="opacitymedium">'.$langs->trans("LDAPDescUsers").'</span><br>';
print '<br>'; print '<br>';

View File

@ -4886,7 +4886,7 @@ class Form
* @param string $action Action * @param string $action Action
* @param array $formquestion An array with forms complementary inputs * @param array $formquestion An array with forms complementary inputs
* @param string $selectedchoice "" or "no" or "yes" * @param string $selectedchoice "" or "no" or "yes"
* @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=preoutput confirm box with div id=dialog-confirm-xxx * @param int|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
* @param int $height Force height of box * @param int $height Force height of box
* @param int $width Force width of box * @param int $width Force width of box
* @return void * @return void
@ -5151,8 +5151,10 @@ class Form
} }
$jsforcursor = ''; $jsforcursor = '';
if ($useajax == 1) {
$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";
$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n";
}
$formconfirm .= ' $formconfirm .= '
resizable: false, resizable: false,
@ -5212,6 +5214,7 @@ class Form
var urljump=pageno + (pageno.indexOf("?") < 0 ? "?" : "") + options; var urljump=pageno + (pageno.indexOf("?") < 0 ? "?" : "") + options;
//alert(urljump); //alert(urljump);
if (pageno.length > 0) { if (pageno.length > 0) {
'.$jsforcursor.'
var post = $.post( var post = $.post(
pageno, pageno,
options, options,

View File

@ -263,6 +263,7 @@ class Ldap
if ($this->result) { if ($this->result) {
$this->bind = $this->result; $this->bind = $this->result;
$connected = 2; $connected = 2;
$this->connectedServer = $host;
break; break;
} else { } else {
$this->error = ldap_errno($this->connection).' '.ldap_error($this->connection); $this->error = ldap_errno($this->connection).' '.ldap_error($this->connection);
@ -275,6 +276,7 @@ class Ldap
if ($this->result) { if ($this->result) {
$this->bind = $this->result; $this->bind = $this->result;
$connected = 2; $connected = 2;
$this->connectedServer = $host;
break; break;
} else { } else {
$this->error = ldap_errno($this->connection).' '.ldap_error($this->connection); $this->error = ldap_errno($this->connection).' '.ldap_error($this->connection);
@ -287,6 +289,7 @@ class Ldap
if ($result) { if ($result) {
$this->bind = $this->result; $this->bind = $this->result;
$connected = 1; $connected = 1;
$this->connectedServer = $host;
break; break;
} else { } else {
$this->error = ldap_errno($this->connection).' '.ldap_error($this->connection); $this->error = ldap_errno($this->connection).' '.ldap_error($this->connection);
@ -297,10 +300,8 @@ class Ldap
if (!$connected) { if (!$connected) {
$this->unbind(); $this->unbind();
} else {
$this->connectedServer = $host;
}
} }
} // End loop on each server
} }
if ($connected) { if ($connected) {

View File

@ -233,6 +233,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
$usertmp = new User($db); $usertmp = new User($db);
$usertmp->fetch('', $login); $usertmp->fetch('', $login);
if (is_object($mc)) {
$ret = $mc->checkRight($usertmp->id, $entitytotest); $ret = $mc->checkRight($usertmp->id, $entitytotest);
if ($ret < 0) { if ($ret < 0) {
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE); dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE);
@ -241,6 +242,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
unset($usertmp); unset($usertmp);
} }
} }
}
if ($result == 1) { if ($result == 1) {
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO bad user/password for '".$usertotest."'", LOG_NOTICE); dol_syslog("functions_ldap::check_user_password_ldap Authentication KO bad user/password for '".$usertotest."'", LOG_NOTICE);
sleep(1); sleep(1);

View File

@ -586,7 +586,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Cancel // Cancel
if ($permissiontoadd) { if ($permissiontoadd) {
if ($object->status == $object::STATUS_VALIDATED) { if ($object->status == $object::STATUS_VALIDATED) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close">'.$langs->trans("Cancel").'</a>'."\n"; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken().'">'.$langs->trans("Cancel").'</a>'."\n";
} elseif ($object->status == $object::STATUS_REFUSED || $object->status == $object::STATUS_CANCELED || $object->status == $object::STATUS_CONTRACT_REFUSED) { } elseif ($object->status == $object::STATUS_REFUSED || $object->status == $object::STATUS_CANCELED || $object->status == $object::STATUS_CONTRACT_REFUSED) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes&token='.newToken().'">'.$langs->trans("Re-Open").'</a>'."\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes&token='.newToken().'">'.$langs->trans("Re-Open").'</a>'."\n";
} }

View File

@ -83,7 +83,7 @@ if (!$action) {
// Security check // Security check
$id = GETPOST("id", 'int'); $id = GETPOST("id", 'int');
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) $socid = $user->socid;
$result = restrictedArea($user, 'ticket', $id, ''); $result = restrictedArea($user, 'ticket', $object->id, '');
// restrict access for externals users // restrict access for externals users
if ($user->socid > 0 && ($object->fk_soc != $user->socid)) { if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
@ -164,11 +164,15 @@ if ($object->fk_user_create > 0) {
$langs->load("users"); $langs->load("users");
$fuser = new User($db); $fuser = new User($db);
$fuser->fetch($object->fk_user_create); $fuser->fetch($object->fk_user_create);
$morehtmlref .= $fuser->getNomUrl(0); $morehtmlref .= $fuser->getNomUrl(-1);
} } elseif (!empty($object->email_msgid)) {
if (!empty($object->origin_email)) {
$morehtmlref .= '<br>'.$langs->trans("CreatedBy").' : '; $morehtmlref .= '<br>'.$langs->trans("CreatedBy").' : ';
$morehtmlref .= $object->origin_email.' <small>('.$langs->trans("TicketEmailOriginIssuer").')</small>'; $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"');
$morehtmlref .= dol_escape_htmltag($object->origin_email).' <small class="hideonsmartphone opacitymedium">('.$form->textwithpicto($langs->trans("CreatedByEmailCollector"), $langs->trans("EmailMsgID").': '.$object->email_msgid).')</small>';
} elseif (!empty($object->origin_email)) {
$morehtmlref .= '<br>'.$langs->trans("CreatedBy").' : ';
$morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"');
$morehtmlref .= dol_escape_htmltag($object->origin_email).' <small class="hideonsmartphone opacitymedium">('.$langs->trans("CreatedByPublicPortal").')</small>';
} }
// Thirdparty // Thirdparty

View File

@ -51,7 +51,7 @@ if (!$sortfield) {
$sortfield = "a.datep,a.id"; $sortfield = "a.datep,a.id";
} }
if (!$sortorder) { if (!$sortorder) {
$sortorder = "desc"; $sortorder = "DESC";
} }
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;