25 require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_payment/modules_supplier_payment.php';
36 public $version =
'dolibarr';
38 public $prefix =
'SPAY';
50 public $nom =
'Bronan';
55 public $name =
'Bronan';
66 return $langs->trans(
"SimpleNumRefModelDesc", $this->prefix);
77 return $this->prefix.
"0501-0001";
89 global $conf, $langs, $db;
91 $payyymm =
''; $max =
'';
93 $posindice = strlen($this->prefix) + 6;
94 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
95 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementfourn";
96 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
97 $sql .=
" AND entity = ".$conf->entity;
102 $row = $db->fetch_row(
$resql);
103 if ($row) { $payyymm = substr($row[0], 0, 6); $max = $row[0]; }
105 if ($payyymm && !preg_match(
'/'.$this->prefix.
'[0-9][0-9][0-9][0-9]/i', $payyymm))
107 $langs->load(
"errors");
108 $this->error = $langs->trans(
'ErrorNumRefModel', $max);
127 $posindice = strlen($this->prefix) + 6;
128 $sql =
"SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.
") AS SIGNED)) as max";
129 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementfourn";
130 $sql .=
" WHERE ref LIKE '".$db->escape($this->prefix).
"____-%'";
131 $sql .=
" AND entity = ".$conf->entity;
133 $resql = $db->query($sql);
136 $obj = $db->fetch_object(
$resql);
137 if ($obj) $max = intval($obj->max);
145 $date = $object->datepaye;
146 $yymm = strftime(
"%y%m", $date);
148 if ($max >= (pow(10, 4) - 1)) $num = $max + 1;
149 else $num = sprintf(
"%04s", $max + 1);
151 dol_syslog(__METHOD__.
" return ".$this->prefix.$yymm.
"-".$num);
152 return $this->prefix.$yymm.
"-".$num;
Class to manage customer payment numbering rules Cicada.
payment_get_num($objsoc, $objforref)
Return next free value.
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...
getExample()
Return an example of numbering.
info()
Return description of numbering module.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Payment numbering references mother class.
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.