25 require_once DOL_DOCUMENT_ROOT.
'/core/modules/commande/modules_commande.php';
36 public $version =
'dolibarr';
38 public $prefix =
'CO';
48 public $name =
'Marbre';
59 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
70 return $this->prefix.
"0501-0001";
82 global $conf, $langs, $db;
84 $coyymm =
''; $max =
'';
86 $posindice = strlen($this->prefix) + 6;
87 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
88 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande";
89 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
90 $sql .=
" AND entity = ".$conf->entity;
95 $row = $db->fetch_row(
$resql);
96 if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
98 if ($coyymm && !preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $coyymm))
100 $langs->load(
"errors");
101 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
120 $posindice = strlen($this->prefix) + 6;
121 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
122 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande";
123 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
124 $sql .=
" AND entity IN (".getEntity(
'ordernumber', 1, $object).
")";
126 $resql = $db->query($sql);
129 $obj = $db->fetch_object(
$resql);
130 if ($obj) $max = intval($obj->max);
133 dol_syslog(
"mod_commande_marbre::getNextValue", LOG_DEBUG);
138 $date = $object->date;
139 $yymm = strftime(
"%y%m", $date);
141 if ($max >= (pow(10, 4) - 1)) $num = $max + 1;
142 else $num = sprintf(
"%04s", $max + 1);
144 dol_syslog(
"mod_commande_marbre::getNextValue return ".$this->prefix.$yymm.
"-".$num);
145 return $this->prefix.$yymm.
"-".$num;
Class to manage customer order numbering rules Marbre.
Parent class to manage numbering of Sale Orders.
getExample()
Return an example of numbering.
getNextValue($objsoc, $object)
Return next free value.
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
commande_get_num($objsoc, $objforref)
Return next free value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
info()
Return description of numbering module.
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.