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) $this->prefix =
'PO';
78 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
89 return $this->prefix.
"0501-0001";
101 global $conf, $langs, $db;
103 $coyymm =
''; $max =
'';
105 $posindice = strlen($this->prefix) + 6;
106 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
107 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur";
108 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
109 $sql .=
" AND entity = ".$conf->entity;
110 $resql = $db->query($sql);
113 $row = $db->fetch_row(
$resql);
114 if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
116 if (!$coyymm || preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $coyymm))
120 $langs->load(
"errors");
121 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
138 $posindice = strlen($this->prefix) + 6;
139 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
140 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur";
141 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
142 $sql .=
" AND entity = ".$conf->entity;
144 $resql = $db->query($sql);
147 $obj = $db->fetch_object(
$resql);
148 if ($obj) $max = intval($obj->max);
153 $date = $object->date_commande;
154 if (empty($date)) $date = $object->date;
155 $yymm = strftime(
"%y%m", $date);
157 if ($max >= (pow(10, 4) - 1)) $num = $max + 1;
158 else $num = sprintf(
"%04s", $max + 1);
160 return $this->prefix.$yymm.
"-".$num;
Classe du modele de numerotation de reference de commande fournisseur Muguet.
__construct()
Constructor.
getNextValue()
Returns next value assigned.
info()
Return description of numbering module.
getNextValue($objsoc=0, $object= '')
Return next value.
Parent Class of numbering models of suppliers orders references.
getExample()
Return an example of numbering.
commande_get_num($objsoc=0, $object= '')
Renvoie la reference de commande suivante non utilisee.
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.
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...