26 require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
38 public $version =
'dolibarr';
40 public $prefix =
'PJ';
52 public $nom =
'Simple';
57 public $name =
'Simple';
68 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
79 return $this->prefix.
"0501-0001";
91 global $conf, $langs, $db;
93 $coyymm =
''; $max =
'';
95 $posindice = strlen($this->prefix) + 6;
96 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
97 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet";
98 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
99 $sql .=
" AND entity = ".$conf->entity;
100 $resql = $db->query($sql);
103 $row = $db->fetch_row(
$resql);
104 if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
106 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.
"projet";
132 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
133 $sql .=
" AND entity = ".$conf->entity;
135 $resql = $db->query($sql);
138 $obj = $db->fetch_object(
$resql);
139 if ($obj) $max = intval($obj->max);
142 dol_syslog(
"mod_project_simple::getNextValue", LOG_DEBUG);
146 $date = empty($project->date_c) ?
dol_now() : $project->date_c;
149 $yymm = strftime(
"%y%m", $date);
151 if ($max >= (pow(10, 4) - 1)) $num = $max + 1;
152 else $num = sprintf(
"%04s", $max + 1);
154 dol_syslog(
"mod_project_simple::getNextValue return ".$this->prefix.$yymm.
"-".$num);
155 return $this->prefix.$yymm.
"-".$num;
getNextValue($objsoc, $project)
Return next value.
dol_now($mode= 'auto')
Return date for now.
Class to manage the numbering module Simple for project references.
getExample()
Return an example of numbering module values.
info()
Return description of numbering module.
Classe mere des modeles de numerotation des references de projets.
canBeActivated()
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.
project_get_num($objsoc=0, $project= '')
Return next reference not yet used as a reference.
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.