Correzione codice intervento

Il codice non veniva trovato se presentava nel formato uno dei modificatori come 'yy' perché mancava la conversione di questi modificatori nel template da cercare
This commit is contained in:
xxfuma85xx 2019-01-04 23:21:58 +01:00 committed by GitHub
parent 360983abd6
commit 0bfe9f8553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -103,13 +103,13 @@ switch (post('op')) {
$formato = setting('Formato codice intervento');
$template = str_replace('#', '%', $formato);
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice=(SELECT MAX(CAST(codice AS SIGNED)) FROM in_interventi) AND codice LIKE '.prepare($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($template)).' ORDER BY codice DESC LIMIT 0,1');
if (!empty($rs[0]['codice'])) {
$codice = Util\Generator::generate($formato, $rs[0]['codice']);
}
if (empty($codice)) {
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice LIKE '.prepare($template).' ORDER BY codice DESC LIMIT 0,1');
$rs = $dbo->fetchArray('SELECT codice FROM in_interventi WHERE codice LIKE '.prepare(Util\Generator::complete($template)).' ORDER BY codice DESC LIMIT 0,1');
$codice = Util\Generator::generate($formato, $rs[0]['codice']);
}