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:
xxfuma85xx 2019-01-04 23:26:38 +01:00 committed by GitHub
parent 0bfe9f8553
commit b3259ffb2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -11,13 +11,13 @@ unset($_SESSION['superselect']['non_fatturato']);
$idintervento_template = setting('Formato codice intervento');
$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'])) {
$new_codice = Util\Generator::generate(setting('Formato codice intervento'), $rs[0]['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']);
}