Fix generatore numerazione progressiva

This commit is contained in:
Beppe 2022-09-01 12:51:31 +02:00
parent 4d03890ce9
commit c4201b2cc3
1 changed files with 5 additions and 1 deletions

View File

@ -201,7 +201,11 @@ class Generator
$maschera = Generator::complete($maschera, [], $date); $maschera = Generator::complete($maschera, [], $date);
$maschera = str_replace('#', '%', $maschera); $maschera = str_replace('#', '%', $maschera);
$query = Manager::table($table)->select($field)->where($field, 'like', $maschera)->orderByRaw($order); //Lunghezza maschera
$mask_length = strlen($maschera);
$query = Manager::table($table)->select($field)->where($field, 'like', $maschera)->whereRaw('LENGTH( numero_esterno )<='.$mask_length)->orderByRaw('LENGTH(numero_esterno) DESC')->orderByRaw($order);
foreach ($where as $and) { foreach ($where as $and) {
$query->whereRaw($and); $query->whereRaw($and);