26 require_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
37 public $version =
'dolibarr';
39 public $prefix =
'FI';
51 public $nom =
'pacific';
56 public $name =
'pacific';
67 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
77 return $this->prefix.
"0501-0001";
88 global $langs, $conf, $db;
90 $langs->load(
"bills");
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.
"fichinter";
98 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
99 $sql .=
" WHERE entity = ".$conf->entity;
101 $resql = $db->query($sql);
103 $row = $db->fetch_row(
$resql);
105 $fayymm = substr($row[0], 0, 6);
109 if (!$fayymm || preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $fayymm)) {
112 $langs->load(
"errors");
113 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
130 $posindice = strlen($this->prefix) + 6;
131 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
132 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter";
133 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
134 $sql .=
" AND entity = ".$conf->entity;
136 $resql = $db->query($sql);
138 $obj = $db->fetch_object(
$resql);
140 $max = intval($obj->max);
147 $date = $object->datec;
148 $yymm = strftime(
"%y%m", $date);
150 if ($max >= (pow(10, 4) - 1)) {
153 $num = sprintf(
"%04s", $max + 1);
156 return $this->prefix.$yymm.
"-".$num;
getExample()
Return an example of numbering.
getNumRef($objsoc, $objforref)
Return next free value.
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
info()
Return description of numbering module.
Parent class numbering models of intervention sheet references.
getNextValue($objsoc=0, $object= '')
Return next free value.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Class to manage numbering of intervention cards with rule Pacific.