Fix - Eliminazione porti
This commit is contained in:
parent
d4620a6a9c
commit
6c6576bcf7
|
@ -44,17 +44,20 @@ switch (filter('op')) {
|
|||
break;
|
||||
|
||||
case 'delete':
|
||||
$documenti = $dbo->fetchArray('SELECT id FROM dt_ddt WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_documenti WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_preventivi WHERE idporto='.prepare($id_record));
|
||||
|
||||
if (isset($id_record) && !empty($documenti)) {
|
||||
$documenti = $dbo->fetchNum('SELECT id FROM dt_ddt WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_documenti WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_preventivi WHERE idporto='.prepare($id_record));
|
||||
|
||||
if (isset($id_record) && empty($documenti)) {
|
||||
$dbo->query('DELETE FROM `dt_porto` WHERE `id`='.prepare($id_record));
|
||||
$_SESSION['infos'][] = tr('Tipologia di _TYPE_ eliminata con successo!', [
|
||||
'_TYPE_' => 'porto',
|
||||
]);
|
||||
} else {
|
||||
|
||||
$_SESSION['errors'][] = tr('Sono presenti dei documenti collegati a questo porto!');
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -23,17 +23,18 @@ include_once __DIR__.'/../../core.php';
|
|||
</form>
|
||||
|
||||
<?php
|
||||
$documenti = $dbo->fetchArray('SELECT id FROM dt_ddt WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_documenti WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_preventivi WHERE idporto='.prepare($id_record));
|
||||
$documenti = $dbo->fetchNum('SELECT id FROM dt_ddt WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_documenti WHERE idporto='.prepare($id_record).'
|
||||
UNION SELECT id FROM co_preventivi WHERE idporto='.prepare($id_record));
|
||||
|
||||
if (!empty($documenti)){
|
||||
echo '
|
||||
<div class="alert alert-danger">
|
||||
'.tr('Ci sono _NUM_ documenti collegati', [
|
||||
'_NUM_' => count($documenti),
|
||||
]).'.
|
||||
</div>';
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
|
|
Loading…
Reference in New Issue