From 90f93a60d6737a4b4c7b17737d7a186043bb2c31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 04:47:37 +0100 Subject: [PATCH 1/2] Fix pass parameter by reference --- htdocs/adherents/vcard.php | 25 +++++++++++++++---------- htdocs/contact/vcard.php | 25 +++++++++++++++---------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/htdocs/adherents/vcard.php b/htdocs/adherents/vcard.php index 1b5a0e5d0fe..50ea8d98fdc 100644 --- a/htdocs/adherents/vcard.php +++ b/htdocs/adherents/vcard.php @@ -122,18 +122,23 @@ if ($company->id) { } elseif (empty(trim($object->email))) { // when adherent e-mail is empty, use only company e-mail $v->setEmail($company->email); - } elseif (strtolower(end(explode("@", $object->email))) == strtolower(end(explode("@", $company->email)))) { - // when e-mail domain of adherent and company are the same, use adherent e-mail at first (and company e-mail at second) - $v->setEmail($object->email); - - // support by Microsoft Outlook (2019 and possible earlier) - $v->setEmail($company->email, 'INTERNET'); } else { - // when e-mail of adherent and company complete different use company e-mail at first (and adherent e-mail at second) - $v->setEmail($company->email); + $tmpobject = explode("@", trim($object->email)); + $tmpcompany = explode("@", trim($company->email)); - // support by Microsoft Outlook (2019 and possible earlier) - $v->setEmail($object->email, 'INTERNET'); + if (strtolower(end($tmpobject)) == strtolower(end($tmpcompany))) { + // when e-mail domain of adherent and company are the same, use adherent e-mail at first (and company e-mail at second) + $v->setEmail($object->email); + + // support by Microsoft Outlook (2019 and possible earlier) + $v->setEmail($company->email, 'INTERNET'); + } else { + // when e-mail of adherent and company complete different use company e-mail at first (and adherent e-mail at second) + $v->setEmail($company->email); + + // support by Microsoft Outlook (2019 and possible earlier) + $v->setEmail($object->email, 'INTERNET'); + } } // Si adherent lie a un tiers non de type "particulier" diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index fe11c90c0b9..d366d1c2b17 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -92,18 +92,23 @@ if ($company->id) { } elseif (empty(trim($contact->email))) { // when contact e-mail is empty, use only company e-mail $v->setEmail($company->email); - } elseif (strtolower(end(explode("@", $contact->email))) == strtolower(end(explode("@", $company->email)))) { - // when e-mail domain of contact and company are the same, use contact e-mail at first (and company e-mail at second) - $v->setEmail($contact->email); - - // support by Microsoft Outlook (2019 and possible earlier) - $v->setEmail($company->email, 'INTERNET'); } else { - // when e-mail of contact and company complete different use company e-mail at first (and contact e-mail at second) - $v->setEmail($company->email); + $tmpcontact = explode("@", trim($contact->email)); + $tmpcompany = explode("@", trim($company->email)); - // support by Microsoft Outlook (2019 and possible earlier) - $v->setEmail($contact->email, 'INTERNET'); + if (strtolower(end($tmpcontact)) == strtolower(end($tmpcompany))) { + // when e-mail domain of contact and company are the same, use contact e-mail at first (and company e-mail at second) + $v->setEmail($contact->email); + + // support by Microsoft Outlook (2019 and possible earlier) + $v->setEmail($company->email, 'INTERNET'); + } else { + // when e-mail of contact and company complete different use company e-mail at first (and contact e-mail at second) + $v->setEmail($company->email); + + // support by Microsoft Outlook (2019 and possible earlier) + $v->setEmail($contact->email, 'INTERNET'); + } } // Si contact lie a un tiers non de type "particulier" From a272b620f5835f42084ad93d421d4b32c82b2141 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 05:00:36 +0100 Subject: [PATCH 2/2] Fix code not reachable --- htdocs/core/class/lessc.class.php | 5 ++--- htdocs/hrm/class/skill.class.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index bd2d6d020cd..40c4d21abaa 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -703,8 +703,8 @@ class Lessc // has default value $value = $a[2]; } else { - $this->throwError("Failed to assign arg ".$a[1]); $value = null; // :( + $this->throwError("Failed to assign arg ".$a[1]); // This end function by throwing an exception } $value = $this->reduce($value); @@ -1118,8 +1118,7 @@ class Lessc if (isset($items[0])) { return $this->lib_e($items[0]); } - $this->throwError("unrecognised input"); - return null; + $this->throwError("unrecognised input"); // This end function by throwing an exception case "string": $arg[1] = ""; return $arg; diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 2c86c5dca56..0cdc63ec24e 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -521,7 +521,7 @@ class Skill extends CommonObject */ public function delete(User $user, $notrigger = false) { - return $this->deleteCommon($user, $notrigger);; + return $this->deleteCommon($user, $notrigger); } /**