27require_once DOL_DOCUMENT_ROOT.
'/core/modules/member/modules_member.class.php';
36 public $name =
'Simple';
37 public $version =
'dolibarr';
42 public $position = 30;
65 public function info($langs)
68 return $langs->trans(
"SimpleRefNumRefModelDesc");
92 global $conf, $langs, $db;
97 $sql =
"SELECT MAX(CAST(ref AS SIGNED)) as max";
98 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
99 $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;
134 $sql .=
" AND ref <> '(PROV)'";
136 $resql = $db->query($sql);
138 $obj = $db->fetch_object($resql);
140 $max = intval($obj->max) + 1;
145 dol_syslog(
"mod_member_simple::getNextValue", LOG_DEBUG);
148 $max = str_pad((
string) $max,
getDolGlobalInt(
'MEMBER_MOD_SIMPLE_LPAD'),
"0", STR_PAD_LEFT);
if(! $sortfield) if(! $sortorder) $object
Class mere des modeles de numerotation des references de members.
Class to manage the numbering module Simple for member references.
__construct()
Constructor.
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.