mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-02 17:07:01 +01:00
Controllo su categoria doppia
This commit is contained in:
parent
6f90b2cbfe
commit
96acf7247d
@ -22,7 +22,10 @@ switch (filter('op')) {
|
||||
$nota = filter('nota');
|
||||
$colore = filter('colore');
|
||||
|
||||
$n = $dbo->fetchNum("SELECT * FROM `mg_categorie` WHERE `nome` LIKE ".prepare($nome));
|
||||
|
||||
if (isset($nome)) {
|
||||
if ($n==0) {
|
||||
$dbo->query('INSERT INTO `mg_categorie` (`nome`, `colore`, `nota`) VALUES ('.prepare($nome).', '.prepare($colore).', '.prepare($nota).')');
|
||||
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
@ -34,6 +37,9 @@ switch (filter('op')) {
|
||||
flash()->info(tr('Aggiunta nuova tipologia di _TYPE_', [
|
||||
'_TYPE_' => 'categoria',
|
||||
]));
|
||||
}else{
|
||||
flash()->error(tr('Esiste già una categoria con lo stesso nome!'));
|
||||
}
|
||||
} else {
|
||||
flash()->error(tr('Ci sono stati alcuni errori durante il salvataggio!'));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user