Try to remove a warning

This commit is contained in:
Laurent Destailleur 2014-05-03 03:10:58 +02:00
parent ada08986cf
commit e1d30837e9
2 changed files with 9 additions and 6 deletions

View File

@ -237,11 +237,14 @@ if ($resql)
$staticmember->id=$obj->rowid; $staticmember->id=$obj->rowid;
$staticmember->lastname=$obj->lastname; $staticmember->lastname=$obj->lastname;
$staticmember->firstname=$obj->firstname; $staticmember->firstname=$obj->firstname;
if (! empty($obj->fk_soc)) { if (! empty($obj->fk_soc))
$staticmember->socid = $obj->fk_soc; {
$staticmember->fk_soc = $obj->fk_soc;
$staticmember->fetch_thirdparty(); $staticmember->fetch_thirdparty();
$staticmember->name=$staticmember->thirdparty->name; $staticmember->name=$staticmember->thirdparty->name;
} else { }
else
{
$staticmember->name=$obj->company; $staticmember->name=$obj->company;
} }
$staticmember->ref=$staticmember->getFullName($langs); $staticmember->ref=$staticmember->getFullName($langs);

View File

@ -590,7 +590,7 @@ abstract class CommonObject
} }
/** /**
* Load the third party of object from id $this->socid into this->thirdpary * Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdpary
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -598,10 +598,10 @@ abstract class CommonObject
{ {
global $conf; global $conf;
if (empty($this->socid)) return 0; if (empty($this->socid) && empty($this->fk_soc)) return 0;
$thirdparty = new Societe($this->db); $thirdparty = new Societe($this->db);
$result=$thirdparty->fetch($this->socid); $result=$thirdparty->fetch(isset($this->socid)?$this->socid:$this->fk_soc);
$this->client = $thirdparty; // deprecated $this->client = $thirdparty; // deprecated
$this->thirdparty = $thirdparty; $this->thirdparty = $thirdparty;