27require_once DOL_DOCUMENT_ROOT.
'/core/modules/member/modules_member.class.php';
36 public $name =
'Simple';
37 public $version =
'dolibarr';
60 public function info($langs)
63 return $langs->trans(
"SimpleRefNumRefModelDesc");
87 global $conf, $langs, $db;
92 $sql =
"SELECT MAX(CAST(ref AS SIGNED)) as max";
93 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
94 $sql .=
" WHERE entity = ".$conf->entity;
95 $resql = $db->query($sql);
97 $row = $db->fetch_row($resql);
99 $coyymm = substr($row[0], 0, 6);
103 if (!$coyymm || preg_match(
'/[0-9][0-9][0-9][0-9]/i', $coyymm)) {
106 $langs->load(
"errors");
107 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
125 $sql =
"SELECT MAX(CAST(ref AS SIGNED)) as max";
126 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
127 $sql .=
" WHERE entity = ".(int) $conf->entity;
129 $resql = $db->query($sql);
131 $obj = $db->fetch_object($resql);
133 $max = intval($obj->max) + 1;
138 dol_syslog(
"mod_member_simple::getNextValue", LOG_DEBUG);
141 $max = str_pad((
string) $max,
getDolGlobalInt(
'MEMBER_MOD_SIMPLE_LPAD'),
"0", STR_PAD_LEFT);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.