26 require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_proposal/modules_supplier_proposal.php';
38 public $version =
'dolibarr';
40 public $prefix =
'RQ';
52 public $nom =
'Marbre';
57 public $name =
'Marbre';
68 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
79 return $this->prefix.
"0501-0001";
91 global $conf, $langs, $db;
96 $posindice = strlen($this->prefix) + 6;
97 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
98 $sql .=
" FROM ".MAIN_DB_PREFIX.
"supplier_proposal";
99 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
100 $sql .=
" AND entity = ".$conf->entity;
102 $resql = $db->query($sql);
104 $row = $db->fetch_row(
$resql);
106 $pryymm = substr($row[0], 0, 6);
111 if (!$pryymm || preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $pryymm)) {
114 $langs->load(
"errors");
115 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
132 $posindice = strlen($this->prefix) + 6;
133 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
134 $sql .=
" FROM ".MAIN_DB_PREFIX.
"supplier_proposal";
135 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
136 $sql .=
" AND entity = ".$conf->entity;
138 $resql = $db->query($sql);
140 $obj = $db->fetch_object(
$resql);
142 $max = intval($obj->max);
147 dol_syslog(get_class($this).
"::getNextValue", LOG_DEBUG);
152 $yymm = strftime(
"%y%m", $date);
154 if ($max >= (pow(10, 4) - 1)) {
157 $num = sprintf(
"%04s", $max + 1);
160 dol_syslog(get_class($this).
"::getNextValue return ".$this->prefix.$yymm.
"-".$num);
161 return $this->prefix.$yymm.
"-".$num;
Class to manage customer order numbering rules Marbre.
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
getNumRef($objsoc, $objforref)
Return next free value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
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.
Classe mere des modeles de numerotation des references de propales.
getExample()
Return an example of numbering module values.
info()
Return description of numbering module.
getNextValue($objsoc, $supplier_proposal)
Return next value.