diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index acb543631d6..a3d9343cad7 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -3667,14 +3667,14 @@ class Propal extends CommonObject
}
$datas['customer'] = '
'.$langs->trans('Customer').': '.$this->thirdparty->getNomUrl(1, '', 0, 1);
}
- if (!empty($this->ref_client)) {
- $datas['refcustomer'] = '
'.$langs->trans('RefCustomer').': '.$this->ref_client;
+ if (!empty($this->ref_customer)) {
+ $datas['refcustomer'] = '
'.$langs->trans('RefCustomer').': '.$this->ref_customer;
}
if (!$nofetch) {
$langs->load('project');
- if (empty($this->project)) {
+ if (is_null($this->project) || (is_object($this->project) && $this->project->isEmpty())) {
$res = $this->fetch_project();
- if ($res > 0 && !empty($this->project) && $this->project instanceof Project) {
+ if ($res > 0 && $this->project instanceof Project) {
$datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1);
}
}
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 1ef4754bae4..290dd95235c 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -3755,9 +3755,9 @@ class Commande extends CommonOrder
$datas['RefCustomer'] = '
'.$langs->trans('RefCustomer').': '.(empty($this->ref_customer) ? (empty($this->ref_client) ? '' : $this->ref_client) : $this->ref_customer);
if (!$nofetch) {
$langs->load('project');
- if (empty($this->project)) {
+ if (is_null($this->project) || (is_object($this->project) && $this->project->isEmpty())) {
$res = $this->fetch_project();
- if ($res > 0 && !empty($this->project) && $this->project instanceof Project) {
+ if ($res > 0 && $this->project instanceof Project) {
$datas['project'] = '
'.$langs->trans('Project').': '.$this->project->getNomUrl(1, '', 0, 1);
}
}