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 * 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; 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'; 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); $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->client = $thirdparty; // deprecated
$this->thirdparty = $thirdparty; $this->thirdparty = $thirdparty;

View File

@ -260,7 +260,7 @@ if (empty($reshook))
{ {
$db->commit(); $db->commit();
if (GETPOST('socid','int') > 0) $object->thirdparty->fetch(GETPOST('socid','int')); if (GETPOST('socid','int') > 0) $object->fetch_thirdparty(GETPOST('socid','int'));
else unset($object->thirdparty); else unset($object->thirdparty);
} }
} }

View File

@ -51,7 +51,7 @@ if ($id > 0 || ! empty($ref))
if ($object->fetch($id,$ref) > 0) if ($object->fetch($id,$ref) > 0)
{ {
$projectstatic->fetch($object->fk_project); $projectstatic->fetch($object->fk_project);
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
$object->project = dol_clone($projectstatic); $object->project = dol_clone($projectstatic);
} }
@ -134,7 +134,7 @@ if ($object->id > 0)
// Company // Company
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); if (! empty($projectstatic->thirdparty->id)) print $projectstatic->thirdparty->getNomUrl(1);
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -196,7 +196,7 @@ if ($object->id > 0)
// Third party // Third party
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($projectstatic->societe->id > 0) print $projectstatic->societe->getNomUrl(1); if ($projectstatic->thirdparty->id > 0) print $projectstatic->thirdparty->getNomUrl(1);
else print'&nbsp;'; else print'&nbsp;';
print '</td></tr>'; print '</td></tr>';
} }