Fix use correct trackid

This commit is contained in:
Laurent Destailleur 2020-05-06 15:03:57 +02:00
parent db40dd8e49
commit abdb0cc8c0
2 changed files with 8 additions and 7 deletions

View File

@ -1972,12 +1972,12 @@ class User extends CommonObject
/**
* Send new password by email
*
* @param User $fuser Object user that send email
* @param User $user Object user that send the email (not the user we send too)
* @param string $password New password
* @param int $changelater 0=Send clear passwod into email, 1=Change password only after clicking on confirm email. @todo Add method 2 = Send link to reset password
* @return int < 0 si erreur, > 0 si ok
*/
public function send_password($fuser, $password = '', $changelater = 0)
public function send_password($user, $password = '', $changelater = 0)
{
// phpcs:enable
global $conf, $langs;
@ -1997,8 +1997,9 @@ class User extends CommonObject
{ // If user has defined its own language (rare because in most cases, auto is used)
$outputlangs->getDefaultLang($this->conf->MAIN_LANG_DEFAULT);
}
if ($fuser->conf->MAIN_LANG_DEFAULT) {
$outputlangs->setDefaultLang($fuser->conf->MAIN_LANG_DEFAULT);
if ($this->conf->MAIN_LANG_DEFAULT) {
$outputlangs->setDefaultLang($this->conf->MAIN_LANG_DEFAULT);
}
else
{ // If user has not defined its own language, we used current language
@ -2028,7 +2029,7 @@ class User extends CommonObject
$mesg .= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli).': '.$url."\n\n";
$mesg .= "--\n";
$mesg .= $fuser->getFullName($outputlangs); // Username that make then sending
$mesg .= $user->getFullName($outputlangs); // Username that send email
dol_syslog(get_class($this)."::send_password changelater is off, url=".$url);
}
@ -2048,7 +2049,7 @@ class User extends CommonObject
dol_syslog(get_class($this)."::send_password changelater is on, url=".$url);
}
$trackid = 'use'.$fuser->id;
$trackid = 'use'.$this->id;
$mailfile = new CMailFile(
$subject,

View File

@ -131,7 +131,7 @@ if ($action == 'buildnewpassword' && $username)
else
{
// Success
if ($edituser->send_password($edituser, $newpassword, 1) > 0)
if ($edituser->send_password($user, $newpassword, 1) > 0)
{
$message = '<div class="ok'.(empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent').'">'.$langs->trans("PasswordChangeRequestSent", $edituser->login, dolObfuscateEmail($edituser->email)).'</div>';
$username = '';