diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 19e3554d155..8bdfb0800a1 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -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 diff --git a/htdocs/soc.php b/htdocs/soc.php index c1470b23dfa..6590b5cf022 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -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 ''; + // Module Adherent + if ($conf->adherent->enabled) + { + $langs->load("members"); + print '