Merge pull request #413 from xxfuma85xx/xxfuma85xx-patch-codice-interventi

Xxfuma85xx patch codice interventi
This commit is contained in:
loviuz 2019-01-05 13:51:00 +01:00 committed by GitHub
commit b2f6e802fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 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']);
}

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']);
}