24 require_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
35 public $version =
'dolibarr';
37 public $prefix =
'SH';
49 public $nom =
'Safor';
54 public $name =
'Safor';
65 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
76 return $this->prefix.
"0501-0001";
87 global $conf, $langs, $db;
92 $posindice = strlen($this->prefix) + 6;
93 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
94 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expedition";
95 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
96 $sql .=
" AND entity = ".$conf->entity;
100 $row = $db->fetch_row(
$resql);
102 $coyymm = substr($row[0], 0, 6);
106 if ($coyymm && !preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
107 $langs->load(
"errors");
108 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
126 $posindice = strlen($this->prefix) + 6;
127 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
128 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expedition";
129 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
130 $sql .=
" AND entity = ".$conf->entity;
132 $resql = $db->query($sql);
134 $obj = $db->fetch_object(
$resql);
136 $max = intval($obj->max);
141 dol_syslog(
"mod_expedition_safor::getNextValue", LOG_DEBUG);
146 $yymm = strftime(
"%y%m", $date);
148 if ($max >= (pow(10, 4) - 1)) {
151 $num = sprintf(
"%04s", $max + 1);
154 dol_syslog(
"mod_expedition_safor::getNextValue return ".$this->prefix.$yymm.
"-".$num);
155 return $this->prefix.$yymm.
"-".$num;
info()
Return default description of numbering model.
Class to manage expedition numbering rules Safor.
getNextValue($objsoc, $shipment)
Return next value.
getExample()
Return numbering example.
Parent Class of numbering models of sending receipts references.
expedition_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.
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.
canBeActivated()
Test if existing numbers make problems with numbering.