Show link to member on third party card

This commit is contained in:
Laurent Destailleur 2009-07-29 17:40:57 +00:00
parent 22340edc51
commit 0eda04d389
2 changed files with 29 additions and 5 deletions

View File

@ -909,11 +909,12 @@ class Adherent extends CommonObject
/**
* \brief Load member from database
* \param rowid id of object to load
* \param ref Ref of invoice
* \return int >0 if OK, <0 if KO
* \param rowid Id of object to load
* \param ref To load member from its ref
* \param fk_soc To load member from its link to third party
* \return int >0 if OK, 0 if not found, <0 if KO
*/
function fetch($rowid,$ref='')
function fetch($rowid,$ref='',$fk_soc='')
{
global $langs;
@ -934,6 +935,7 @@ class Adherent extends CommonObject
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member";
$sql.= " WHERE d.fk_adherent_type = t.rowid";
if ($ref) $sql.= " AND d.rowid='".$ref."'";
elseif ($fk_soc) $sql.= " AND d.fk_soc='".$fk_soc."'";
else $sql.= " AND d.rowid=".$rowid;
dol_syslog("Adherent::fetch sql=".$sql);
@ -993,7 +995,7 @@ class Adherent extends CommonObject
}
else
{
return -1;
return 0;
}
}
else

View File

@ -32,6 +32,7 @@ require("pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/html.formcompany.class.php");
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
if ($conf->adherent->enabled) require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
$langs->load("companies");
$langs->load("commercial");
@ -1222,6 +1223,27 @@ else
}
print '</td></tr>';
// Module Adherent
if ($conf->adherent->enabled)
{
$langs->load("members");
print '<tr><td width="25%" valign="top">'.$langs->trans("LinkedToDolibarrMember").'</td>';
print '<td colspan="3">';
$adh=new Adherent($db);
$result=$adh->fetch('','',$soc->id);
if ($result > 0)
{
$adh->ref=$adh->fullname;
print $adh->getNomUrl(1);
}
else
{
print $langs->trans("UserNotLinkedToMember");
}
print '</td>';
print "</tr>\n";
}
print '</table>';
print '</form>';
print "</div>\n";