Fix crash when opportunity won without third-party
This commit is contained in:
parent
a50394e4df
commit
a41622707e
1 changed files with 8 additions and 4 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue