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");
97 $fayymm =
''; $max =
'';
99 $posindice = strlen($this->prefix) + 6;
100 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
101 $sql .=
" FROM ".MAIN_DB_PREFIX.
"delivery";
102 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
103 $sql .=
" AND entity = ".$conf->entity;
105 $resql = $db->query($sql);
108 $row = $db->fetch_row(
$resql);
109 if ($row) { $fayymm = substr($row[0], 0, 6); $max = $row[0]; }
111 if ($fayymm && !preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $fayymm))
113 $langs->load(
"errors");
114 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
133 $posindice = strlen($this->prefix) + 6;
134 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
135 $sql .=
" FROM ".MAIN_DB_PREFIX.
"delivery";
136 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
137 $sql .=
" AND entity = ".$conf->entity;
139 $resql = $db->query($sql);
140 dol_syslog(
"mod_delivery_jade::getNextValue", LOG_DEBUG);
142 $obj = $db->fetch_object(
$resql);
143 if ($obj) $max = intval($obj->max);
149 $date = $object->date_delivery;
150 if (empty($date)) $date =
dol_now();
151 $yymm = strftime(
"%y%m", $date);
153 if ($max >= (pow(10, 4) - 1)) $num = $max + 1;
154 else $num = sprintf(
"%04s", $max + 1);
156 dol_syslog(
"mod_delivery_jade::getNextValue return ".$this->prefix.$yymm.
"-".$num);
157 return $this->prefix.$yymm.
"-".$num;
Classe du modele de numerotation de reference de bon de livraison Jade.
dol_now($mode= 'auto')
Return date for now.
info()
Returns the description of the numbering model.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
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...
Classe mere des modeles de numerotation des references de bon de livraison.
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.
delivery_get_num($objsoc=0, $object= '')
Return next free ref.