From 6ce7ba17f4d24bdd4d4c3ad67860b105ec7e37bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 9 Dec 2025 10:42:51 +0100 Subject: [PATCH] fix read property client on null --- htdocs/projet/card.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index b53a8ee9954..6ed3c6f4ab2 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -364,15 +364,13 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors'); } - if (!$error) { - if ((int) $object->thirdparty->client == 0 || (int) $object->thirdparty->client == 2) { // If not yet customer - // Get ID of the special opportunity status code 'WON' - $idoppstatuswon = (int) dol_getIdFromCode($db, 'WON', 'c_lead_status', 'code', 'rowid'); + if (!$error && !is_null($object->thirdparty) && (int) $object->thirdparty->client == 0 || (int) $object->thirdparty->client == 2) { // If not yet customer + // Get ID of the special opportunity status code 'WON' + $idoppstatuswon = (int) dol_getIdFromCode($db, 'WON', 'c_lead_status', 'code', 'rowid'); - if ($object->opp_status == $idoppstatuswon) { - // Switch the thirdparty into a customer - $object->thirdparty->setAsCustomer(); - } + if ($object->opp_status == $idoppstatuswon) { + // Switch the thirdparty into a customer + $object->thirdparty->setAsCustomer(); } } } @@ -461,7 +459,7 @@ if (empty($reshook)) { } // If opportunities are used and the customer is not yet a customer - if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && $object->usage_opportunity) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && $object->usage_opportunity && !is_null($object->thirdparty)) { if ((int) $object->thirdparty->client == 0 || (int) $object->thirdparty->client == 2) { // If not yet customer // Get ID of the special opportunity status code 'WON' $idoppstatuswon = (int) dol_getIdFromCode($db, 'WON', 'c_lead_status', 'code', 'rowid');