26require_once DOL_DOCUMENT_ROOT.
'/core/modules/member/modules_member.class.php';
38 public $version =
'dolibarr';
55 public $name =
'Simple';
60 public $code_auto = 1;
70 return $langs->trans(
"SimpleRefNumRefModelDesc");
93 global $conf, $langs, $db;
98 $sql =
"SELECT MAX(CAST(ref AS SIGNED)) as max";
99 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
100 $sql .=
" WHERE entity = ".$conf->entity;
101 $resql = $db->query($sql);
103 $row = $db->fetch_row($resql);
105 $coyymm = substr($row[0], 0, 6);
109 if (!$coyymm || preg_match(
'/[0-9][0-9][0-9][0-9]/i', $coyymm)) {
112 $langs->load(
"errors");
113 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
131 $sql =
"SELECT MAX(CAST(ref AS SIGNED)) as max";
132 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
133 $sql .=
" WHERE entity = ".(int) $conf->entity;
135 $resql = $db->query($sql);
137 $obj = $db->fetch_object($resql);
139 $max = intval($obj->max) + 1;
144 dol_syslog(
"mod_member_simple::getNextValue", LOG_DEBUG);
147 $max = str_pad((
string) $max,
getDolGlobalInt(
'MEMBER_MOD_SIMPLE_LPAD'),
"0", STR_PAD_LEFT);
Classe mere des modeles de numerotation des references de members.
Class to manage the numbering module Simple for member references.
info()
Return description of numbering module.
getNextValue($objsoc, $object)
Return next value.
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
getExample()
Return an example of numbering module values.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.