mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-08 18:12:53 +01:00
Fix crash when opportunity won without third-party
This commit is contained in:
@@ -371,8 +371,10 @@ if (empty($reshook)) {
|
||||
$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();
|
||||
// Switch the thirdparty into a customer (only if thirdparty exists)
|
||||
if (!empty($object->thirdparty) && !empty($object->thirdparty->id)) {
|
||||
$object->thirdparty->setAsCustomer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -468,8 +470,10 @@ if (empty($reshook)) {
|
||||
$idoppstatuswon = (int) dol_getIdFromCode($db, 'WON', 'c_lead_status', 'code', 'rowid');
|
||||
|
||||
if (!$error && $object->opp_status == $idoppstatuswon) {
|
||||
// Switch the thirdparty into a customer
|
||||
$object->thirdparty->setAsCustomer();
|
||||
// Switch the thirdparty into a customer (only if thirdparty exists)
|
||||
if (!empty($object->thirdparty) && !empty($object->thirdparty->id)) {
|
||||
$object->thirdparty->setAsCustomer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user