28require_once DOL_DOCUMENT_ROOT .
'/core/modules/workstation/modules_workstation.php';
39 public $version =
'dolibarr';
44 public $prefix =
'WKSTATION';
54 public $name =
'standard';
63 public function info($langs)
66 return $langs->trans(
"SimpleNumRefNoDateModelDesc", $this->prefix);
77 return $this->prefix.
"-0001";
94 $posindice = strlen($this->prefix) + 2;
95 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
96 $sql .=
" FROM ".MAIN_DB_PREFIX.
"workstation_workstation";
97 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"-%'";
98 if (
$object->ismultientitymanaged == 1) {
99 $sql .=
" AND entity = ".$conf->entity;
100 } elseif (!is_numeric(
$object->ismultientitymanaged)) {
104 $resql = $db->query($sql);
106 $row = $db->fetch_row($resql);
131 $posindice = strlen($this->prefix) + 2;
132 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
133 $sql .=
" FROM ".MAIN_DB_PREFIX.
"workstation_workstation";
134 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"-%'";
137 $resql = $db->query($sql);
139 $obj = $db->fetch_object($resql);
141 $max = intval($obj->max);
146 dol_syslog(
"mod_workstation_standard::getNextValue", LOG_DEBUG);
150 if ($max >= (pow(10, 4) - 1)) {
153 $num = sprintf(
"%04d", $max + 1);
156 dol_syslog(
"mod_workstation_standard::getNextValue return ".$this->prefix.
"-".$num);
157 return $this->prefix.
"-".$num;
if(! $sortfield) if(! $sortorder) $object
Parent class to manage numbering of Workstation.
Class to manage the Standard numbering rule for Workstation.
getExample()
Return an example of numbering.
canBeActivated($object)
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
info($langs)
Return description of numbering module.
getNextValue($object)
Return next free value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.