27dol_include_once(
'/recruitment/core/modules/recruitment/modules_recruitmentjobposition.php');
39 public $version =
'dolibarr';
41 public $prefix =
'JOB';
51 public $name =
'standard';
60 public function info($langs)
62 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
73 return $this->prefix.
"0501-0001";
86 global $conf, $langs, $db;
91 $posindice = strlen($this->prefix) + 6;
92 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
93 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition";
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);
105 $coyymm = substr($row[0], 0, 6);
109 if ($coyymm && !preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
110 $langs->load(
"errors");
111 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
129 $posindice = strlen($this->prefix) + 6;
130 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
131 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition";
132 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
133 if (
$object->ismultientitymanaged == 1) {
134 $sql .=
" AND entity = ".$conf->entity;
135 } elseif (
$object->ismultientitymanaged == 2) {
139 $resql = $db->query($sql);
141 $obj = $db->fetch_object($resql);
143 $max = intval($obj->max);
148 dol_syslog(
"mod_recruitmentjobposition_standard::getNextValue", LOG_DEBUG);
153 $date =
$object->date_creation;
156 if ($max >= (pow(10, 4) - 1)) {
159 $num = sprintf(
"%04d", $max + 1);
162 dol_syslog(
"mod_recruitmentjobposition_standard::getNextValue return ".$this->prefix.$yymm.
"-".$num);
163 return $this->prefix.$yymm.
"-".$num;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Parent class to manage numbering of RecruitmentJobPosition.
Class to manage the Standard numbering rule for Job positions.
getExample()
Return an example of numbering.
info($langs)
Return description of numbering module.
getNextValue($object)
Return next free value.
canBeActivated($object)
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.