28require_once DOL_DOCUMENT_ROOT .
'/core/modules/workstation/modules_workstation.php';
39 public $version =
'dolibarr';
41 public $prefix =
'WKSTATION';
51 public $name =
'standard';
60 public function info($langs)
63 return $langs->trans(
"SimpleNumRefNoDateModelDesc", $this->prefix);
74 return $this->prefix.
"-0001";
87 global $conf, $langs, $db;
91 $posindice = strlen($this->prefix) + 2;
92 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
93 $sql .=
" FROM ".MAIN_DB_PREFIX.
"workstation_workstation";
94 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"-%'";
95 if (
$object->ismultientitymanaged == 1) {
96 $sql .=
" AND entity = ".$conf->entity;
97 } elseif (
$object->ismultientitymanaged == 2) {
101 $resql = $db->query($sql);
103 $row = $db->fetch_row($resql);
128 $posindice = strlen($this->prefix) + 2;
129 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
130 $sql .=
" FROM ".MAIN_DB_PREFIX.
"workstation_workstation";
131 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"-%'";
134 $resql = $db->query($sql);
136 $obj = $db->fetch_object($resql);
138 $max = intval($obj->max);
143 dol_syslog(
"mod_workstation_standard::getNextValue", LOG_DEBUG);
147 if ($max >= (pow(10, 4) - 1)) {
150 $num = sprintf(
"%04d", $max + 1);
153 dol_syslog(
"mod_workstation_standard::getNextValue return ".$this->prefix.
"-".$num);
154 return $this->prefix.
"-".$num;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.