25 dol_include_once(
'/recruitment/core/modules/recruitment/modules_recruitmentjobposition.php');
37 public $version =
'dolibarr';
39 public $prefix =
'JOB';
49 public $name =
'standard';
60 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
71 return $this->prefix.
"0501-0001";
84 global $conf, $langs, $db;
86 $coyymm =
''; $max =
'';
88 $posindice = strlen($this->prefix) + 6;
89 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
90 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition";
91 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
92 if ($object->ismultientitymanaged == 1) {
93 $sql .=
" AND entity = ".$conf->entity;
94 } elseif ($object->ismultientitymanaged == 2) {
101 $row = $db->fetch_row(
$resql);
102 if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
104 if ($coyymm && !preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $coyymm))
106 $langs->load(
"errors");
107 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
125 $posindice = strlen($this->prefix) + 6;
126 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
127 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition";
128 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
129 if ($object->ismultientitymanaged == 1) {
130 $sql .=
" AND entity = ".$conf->entity;
131 } elseif ($object->ismultientitymanaged == 2) {
135 $resql = $db->query($sql);
138 $obj = $db->fetch_object(
$resql);
139 if ($obj) $max = intval($obj->max);
142 dol_syslog(
"mod_recruitmentjobposition_standard::getNextValue", LOG_DEBUG);
147 $date = $object->date_creation;
148 $yymm = strftime(
"%y%m", $date);
150 if ($max >= (pow(10, 4) - 1)) $num = $max + 1;
151 else $num = sprintf(
"%04s", $max + 1);
153 dol_syslog(
"mod_recruitmentjobposition_standard::getNextValue return ".$this->prefix.$yymm.
"-".$num);
154 return $this->prefix.$yymm.
"-".$num;
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
getNextValue($object)
Return next free value.
Parent class to manage numbering of RecruitmentJobPosition.
info()
Return description of numbering module.
canBeActivated($object)
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
getExample()
Return an example of numbering.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Class to manage customer order numbering rules standard.