diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 2e322ac2c3f..6a818e59bab 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -222,7 +222,8 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') $listofprojcontact = $project->liste_type_contact('internal'); if (count($listofprojcontact)) { - $typeforprojectcontact = reset(array_keys($listofprojcontact)); + $tmparray = array_keys($listofprojcontact); + $typeforprojectcontact = reset($tmparray); $result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal'); } } diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index c013c07c23a..e21c5f4fb7a 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -167,7 +167,8 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') $listofprojcontact = $project->liste_type_contact('internal'); if (count($listofprojcontact)) { - $typeforprojectcontact = reset(array_keys($listofprojcontact)); + $tmparray = array_keys($listofprojcontact); + $typeforprojectcontact = reset($tmparray); $result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal'); } } diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index d41dcc39494..82b62a744f9 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -229,7 +229,8 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') $listofprojcontact = $project->liste_type_contact('internal'); if (count($listofprojcontact)) { - $typeforprojectcontact = reset(array_keys($listofprojcontact)); + $tmparray = array_keys($listofprojcontact); + $typeforprojectcontact = reset($tmparray); $result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal'); } } diff --git a/htdocs/user/vcard.php b/htdocs/user/vcard.php index 44b7fda1e05..6e7035d99ec 100644 --- a/htdocs/user/vcard.php +++ b/htdocs/user/vcard.php @@ -99,18 +99,23 @@ if ($company->id) { } elseif (empty(trim($user2->email))) { // when user e-mail is empty, use only company e-mail $v->setEmail($company->email, "TYPE=WORK"); - } elseif (strtolower(end(explode("@", $user2->email))) == strtolower(end(explode("@", $company->email)))) { - // when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second) - $v->setEmail($user2->email, "TYPE=WORK"); - - // support by Microsoft Outlook (2019 and possible earlier) - $v->setEmail($company->email, 'INTERNET'); } else { - // when e-mail of user and company complete different use company e-mail at first (and user e-mail at second) - $v->setEmail($company->email, "TYPE=WORK"); + $tmpuser2 = explode("@", trim($user2->email)); + $tmpcompany = explode("@", trim($company->email)); - // support by Microsoft Outlook (2019 and possible earlier) - $v->setEmail($user2->email, 'INTERNET'); + if (strtolower(end($tmpuser2)) == strtolower(end($tmpcompany))) { + // when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second) + $v->setEmail($user2->email, "TYPE=WORK"); + + // support by Microsoft Outlook (2019 and possible earlier) + $v->setEmail($company->email, 'INTERNET'); + } else { + // when e-mail of user and company complete different use company e-mail at first (and user e-mail at second) + $v->setEmail($company->email, "TYPE=WORK"); + + // support by Microsoft Outlook (2019 and possible earlier) + $v->setEmail($user2->email, 'INTERNET'); + } } // Si user lie a un tiers non de type "particulier"