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;
68 public function info($langs)
71 return $langs->trans(
"SimpleRefNumRefModelDesc");
95 global $conf, $langs, $db;
100 $sql =
"SELECT MAX(CAST(ref AS SIGNED)) as max";
101 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
102 $sql .=
" WHERE entity = ".$conf->entity;
103 $resql = $db->query($sql);
105 $row = $db->fetch_row($resql);
107 $coyymm = substr($row[0], 0, 6);
111 if (!$coyymm || preg_match(
'/[0-9][0-9][0-9][0-9]/i', $coyymm)) {
114 $langs->load(
"errors");
115 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
133 $sql =
"SELECT MAX(CAST(ref AS SIGNED)) as max";
134 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
135 $sql .=
" WHERE entity = ".(int) $conf->entity;
137 $resql = $db->query($sql);
139 $obj = $db->fetch_object($resql);
141 $max = intval($obj->max) + 1;
146 dol_syslog(
"mod_member_simple::getNextValue", LOG_DEBUG);
149 $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($langs)
Return description of numbering module.
getNextValue($objsoc, $object)
Return next value.
canBeActivated($object)
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 a Dolibarr global constant int value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.