25 require_once DOL_DOCUMENT_ROOT.
'/core/modules/payment/modules_payment.php';
36 public $version =
'dolibarr';
38 public $prefix =
'PAY';
50 public $nom =
'Cicada';
55 public $name =
'Cicada';
66 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
77 return $this->prefix.
"0501-0001";
89 global $conf, $langs, $db;
94 $posindice = strlen($this->prefix) + 6;
95 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
96 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiement";
97 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
98 $sql .=
" AND entity = ".$conf->entity;
100 $resql = $db->query($sql);
102 $row = $db->fetch_row(
$resql);
104 $payyymm = substr($row[0], 0, 6);
108 if ($payyymm && !preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $payyymm)) {
109 $langs->load(
"errors");
110 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
129 $posindice = strlen($this->prefix) + 6;
130 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
131 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiement";
132 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
133 $sql .=
" AND entity = ".$conf->entity;
135 $resql = $db->query($sql);
137 $obj = $db->fetch_object(
$resql);
139 $max = intval($obj->max);
149 $date = $object->datepaye;
150 $yymm = strftime(
"%y%m", $date);
152 if ($max >= (pow(10, 4) - 1)) {
155 $num = sprintf(
"%04s", $max + 1);
158 dol_syslog(__METHOD__.
" return ".$this->prefix.$yymm.
"-".$num);
159 return $this->prefix.$yymm.
"-".$num;
info()
Return description of numbering module.
getNextValue($objsoc, $object)
Return next free value.
Payment numbering references mother class.
payment_get_num($objsoc, $objforref)
Return next free value.
getExample()
Return an example of numbering.
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.
Class to manage customer payment numbering rules Cicada.
canBeActivated()
Checks if the numbers already in the database do not cause conflicts that would prevent this numberin...