Skip to content
Snippets Groups Projects
Commit 06eda34b authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.7

parents 9876b303 0d4aad41
No related branches found
No related tags found
No related merge requests found
...@@ -893,15 +893,15 @@ class BonPrelevement extends CommonObject ...@@ -893,15 +893,15 @@ class BonPrelevement extends CommonObject
*/ */
if (!$error) if (!$error)
{ {
$ref = "T".substr($year,-2).$month; $ref = substr($year,-2).$month;
$sql = "SELECT CAST(RIGHT(ref,2) AS SIGNED INTEGER)"; $sql = "SELECT substring(ref from char_length(ref) - 1)";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
$sql.= " WHERE ref LIKE '".$ref."%'"; $sql.= " WHERE ref LIKE '%".$ref."%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " ORDER BY ref DESC LIMIT 1"; $sql.= " ORDER BY ref DESC LIMIT 1";
dol_syslog(get_class($this)."::Create", LOG_DEBUG); dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
...@@ -914,7 +914,7 @@ class BonPrelevement extends CommonObject ...@@ -914,7 +914,7 @@ class BonPrelevement extends CommonObject
dol_syslog("Erreur recherche reference"); dol_syslog("Erreur recherche reference");
} }
$ref = $ref . substr("00".($row[0]+1), -2); $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1),2,"0",STR_PAD_LEFT);
$filebonprev = $ref; $filebonprev = $ref;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment