Corretto codice intervento
Aggiunta correzione per inserire correttamente i modificatori al codice intervento per la ricerca ed elaborazione corretta della sequenza codici
This commit is contained in:
parent
0bfe9f8553
commit
b3259ffb2d
|
@ -11,13 +11,13 @@ unset($_SESSION['superselect']['non_fatturato']);
|
||||||
$idintervento_template = setting('Formato codice intervento');
|
$idintervento_template = setting('Formato codice intervento');
|
||||||
$idintervento_template = str_replace('#', '%', $idintervento_template);
|
$idintervento_template = str_replace('#', '%', $idintervento_template);
|
||||||
|
|
||||||
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice=(SELECT MAX(CAST(codice AS SIGNED)) FROM in_interventi) AND codice LIKE '.prepare($idintervento_template).' ORDER BY codice DESC LIMIT 0,1');
|
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice=(SELECT MAX(CAST(codice AS SIGNED)) FROM in_interventi) AND codice LIKE '.prepare(Util\Generator::complete($idintervento_template)).' ORDER BY codice DESC LIMIT 0,1');
|
||||||
if (!empty($rs[0]['codice'])) {
|
if (!empty($rs[0]['codice'])) {
|
||||||
$new_codice = Util\Generator::generate(setting('Formato codice intervento'), $rs[0]['codice']);
|
$new_codice = Util\Generator::generate(setting('Formato codice intervento'), $rs[0]['codice']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($new_codice)) {
|
if (empty($new_codice)) {
|
||||||
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice LIKE '.prepare($idintervento_template).' ORDER BY codice DESC LIMIT 0,1');
|
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice LIKE '.prepare(Util\Generator::complete($idintervento_template)).' ORDER BY codice DESC LIMIT 0,1');
|
||||||
$new_codice = Util\Generator::generate(setting('Formato codice intervento'), $rs[0]['codice']);
|
$new_codice = Util\Generator::generate(setting('Formato codice intervento'), $rs[0]['codice']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue