Fixed: [ bug #1653 ] Can't access task notes

This commit is contained in:
Laurent Destailleur
2014-11-20 14:44:49 +01:00
parent ea02bdf85e
commit d462facf6d
3 changed files with 12 additions and 8 deletions

View File

@@ -601,18 +601,22 @@ abstract class CommonObject
/**
* Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty
*
* @return int <0 if KO, >0 if OK
* @param int $force_thirdparty_id Force thirdparty id
* @return int <0 if KO, >0 if OK
*/
function fetch_thirdparty()
function fetch_thirdparty($force_thirdparty_id=0)
{
global $conf;
if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty)) return 0;
if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id)) return 0;
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$idtofetch=isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty);
if ($force_thirdparty_id) $idtofetch=$force_thirdparty_id;
$thirdparty = new Societe($this->db);
$result=$thirdparty->fetch(isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty));
$result=$thirdparty->fetch($idtofetch);
$this->client = $thirdparty; // deprecated
$this->thirdparty = $thirdparty;