26 require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_order/modules_commandefournisseur.php';
38 public $version =
'dolibarr';
50 public $nom =
'Muguet';
55 public $name =
'Muguet';
57 public $prefix =
'CF';
67 if ((
float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 5.0) {
80 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
91 return $this->prefix.
"0501-0001";
103 global $conf, $langs, $db;
108 $posindice = strlen($this->prefix) + 6;
109 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
110 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur";
111 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
112 $sql .=
" AND entity = ".$conf->entity;
113 $resql = $db->query($sql);
115 $row = $db->fetch_row(
$resql);
117 $coyymm = substr($row[0], 0, 6);
121 if (!$coyymm || preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
124 $langs->load(
"errors");
125 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
142 $posindice = strlen($this->prefix) + 6;
143 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
144 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur";
145 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
146 $sql .=
" AND entity = ".$conf->entity;
148 $resql = $db->query($sql);
150 $obj = $db->fetch_object(
$resql);
152 $max = intval($obj->max);
159 $date = $object->date_commande;
161 $date = $object->date;
163 $yymm = strftime(
"%y%m", $date);
165 if ($max >= (pow(10, 4) - 1)) {
168 $num = sprintf(
"%04s", $max + 1);
171 return $this->prefix.$yymm.
"-".$num;
Parent Class of numbering models of suppliers orders references.
Classe du modele de numerotation de reference de commande fournisseur Muguet.
getNextValue($objsoc=0, $object='')
Return next value.
commande_get_num($objsoc=0, $object='')
Renvoie la reference de commande suivante non utilisee.
info()
Return description of numbering module.
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
__construct()
Constructor.
getExample()
Return an example of numbering.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.