diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index f5b13cbb620..00d247d1d63 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -367,7 +367,7 @@ foreach ($arrayofmodules as $file => $modCodeMember) { print ''.$modCodeMember->info($langs).''."\n"; print ''.$modCodeMember->getExample().''."\n"; - if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == "$file") { + if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON', 'mod_member_simple') == "$file") { print ''."\n"; print img_picto($langs->trans("Activated"), 'switch_on'); print "\n"; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 42798a0203a..d5fab4b50b3 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -712,23 +712,20 @@ class Adherent extends CommonObject $id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent"); if ($id > 0) { $this->id = $id; - if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == '') { - // keep old numbering - $this->ref = (string) $id; - } else { - // auto code - $modfile = dol_buildpath('core/modules/member/'.getDolGlobalString('MEMBER_CODEMEMBER_ADDON').'.php', 0); - try { - require_once $modfile; - $modname = getDolGlobalString('MEMBER_CODEMEMBER_ADDON'); - $modCodeMember = new $modname(); - '@phan-var-force ModeleNumRefMembers $modCodeMember'; - /** @var ModeleNumRefMembers $modCodeMember */ - $this->ref = $modCodeMember->getNextValue($mysoc, $this); - } catch (Exception $e) { - dol_syslog($e->getMessage(), LOG_ERR); - $error++; - } + + $modulenum = getDolGlobalString('MEMBER_CODEMEMBER_ADDON', 'mod_member_simple'); + + $modfile = dol_buildpath('core/modules/member/'.$modulenum.'.php', 0); + try { + require_once $modfile; + $modname = $modulenum; + $modCodeMember = new $modname(); + '@phan-var-force ModeleNumRefMembers $modCodeMember'; + /** @var ModeleNumRefMembers $modCodeMember */ + $this->ref = $modCodeMember->getNextValue($mysoc, $this); + } catch (Exception $e) { + dol_syslog($e->getMessage(), LOG_ERR); + $error++; } // Update minor fields