27 require_once DOL_DOCUMENT_ROOT.
'/core/modules/delivery/modules_delivery.php';
41 public $version =
'dolibarr';
58 public $name =
'Jade';
60 public $prefix =
'BL';
71 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
81 return $this->prefix.
"0501-0001";
92 global $langs, $conf, $db;
94 $langs->load(
"bills");
100 $posindice = strlen($this->prefix) + 6;
101 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
102 $sql .=
" FROM ".MAIN_DB_PREFIX.
"delivery";
103 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
104 $sql .=
" AND entity = ".$conf->entity;
106 $resql = $db->query($sql);
108 $row = $db->fetch_row(
$resql);
110 $fayymm = substr($row[0], 0, 6);
114 if ($fayymm && !preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $fayymm)) {
115 $langs->load(
"errors");
116 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
135 $posindice = strlen($this->prefix) + 6;
136 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
137 $sql .=
" FROM ".MAIN_DB_PREFIX.
"delivery";
138 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
139 $sql .=
" AND entity = ".$conf->entity;
141 $resql = $db->query($sql);
142 dol_syslog(
"mod_delivery_jade::getNextValue", LOG_DEBUG);
144 $obj = $db->fetch_object(
$resql);
146 $max = intval($obj->max);
154 $date = $object->date_delivery;
158 $yymm = strftime(
"%y%m", $date);
160 if ($max >= (pow(10, 4) - 1)) {
163 $num = sprintf(
"%04s", $max + 1);
166 dol_syslog(
"mod_delivery_jade::getNextValue return ".$this->prefix.$yymm.
"-".$num);
167 return $this->prefix.$yymm.
"-".$num;
Classe mere des modeles de numerotation des references de bon de livraison.
Classe du modele de numerotation de reference de bon de livraison Jade.
info()
Returns the description of the numbering model.
getNextValue($objsoc, $object)
Return next free value.
getExample()
Return an example of numbering.
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...
delivery_get_num($objsoc=0, $object='')
Return next free ref.
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.
dol_now($mode='auto')
Return date for now.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.