24 require_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
31 public $version =
'dolibarr';
32 public $prefix =
'RCP';
34 public $nom =
'Beryl';
45 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
56 return $this->prefix.
"0501-0001";
67 global $conf, $langs, $db;
69 $coyymm =
''; $max =
'';
71 $posindice = strlen($this->prefix) + 6;
72 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
73 $sql .=
" FROM ".MAIN_DB_PREFIX.
"reception";
74 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
75 $sql .=
" AND entity = ".$conf->entity;
80 $row = $db->fetch_row(
$resql);
81 if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
83 if ($coyymm && !preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $coyymm))
85 $langs->load(
"errors");
86 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
104 $posindice = strlen($this->prefix) + 6;
105 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
106 $sql .=
" FROM ".MAIN_DB_PREFIX.
"reception";
107 $sql .=
" WHERE ref like '".$db->escape($this->prefix).
"____-%'";
108 $sql .=
" AND entity = ".$conf->entity;
110 $resql = $db->query($sql);
113 $obj = $db->fetch_object(
$resql);
114 if ($obj) $max = intval($obj->max);
117 dol_syslog(
"mod_reception_beryl::getNextValue", LOG_DEBUG);
122 $yymm = strftime(
"%y%m", $date);
124 if ($max >= (pow(10, 4) - 1)) $num = $max + 1;
125 else $num = sprintf(
"%04s", $max + 1);
127 dol_syslog(
"mod_reception_beryl::getNextValue return ".$this->prefix.$yymm.
"-".$num);
128 return $this->prefix.$yymm.
"-".$num;
reception_get_num($objsoc, $objforref)
Return next free value.
Parent Class of numbering models of sending receipts references.
Class to manage reception numbering rules Beryl.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
info()
Return default description of numbering model.
getNextValue($objsoc, $shipment)
Return next value.
canBeActivated()
Test if existing numbers make problems with numbering.
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.
getExample()
Return numbering example.