fix: controlli database

This commit is contained in:
valentina 2024-11-05 16:54:48 +01:00
parent 467ebaea56
commit 1c74007dc4
1 changed files with 125 additions and 122 deletions

View File

@ -77,7 +77,6 @@ $effettua_controllo = filter('effettua_controllo');
if (empty($effettua_controllo)) {
echo '
<div id="righe_controlli">
</div>
<div class="alert alert-info" id="card-loading">
@ -143,7 +142,7 @@ $results_settings_added = settings_diff($settings, $data_settings);
// Schermata di visualizzazione degli errori
if (!empty($results) || !empty($results_added) || !empty($results_settings) || !empty($results_settings_added)) {
if (!empty($results)) {
if ($results) {
echo '
<p>'.tr("Segue l'elenco delle tabelle del database che presentano una struttura diversa rispetto a quella prevista nella versione ufficiale del gestionale").'.</p>
<div class="alert alert-warning">
@ -161,7 +160,8 @@ if (!empty($results) || !empty($results_added) || !empty($results_settings) || !
if (array_key_exists('current', $errors) && $errors['current'] == null) {
echo '
<div class="alert alert-danger" ><i class="fa fa-times"></i> '.tr('Tabella assente').'</div>';
<div class="alert alert-danger" ><i class="fa fa-times"></i> '.tr('Tabella assente').'
</div>';
continue;
}
@ -249,15 +249,16 @@ if (!empty($results) || !empty($results_added) || !empty($results_settings) || !
}
}
if (!empty($results_added)) {
if ($results_added) {
foreach ($results_added as $table => $errors) {
if ($results[$table] && array_keys($results[$table]) != array_keys($errors)) {
if (($results[$table] && array_keys($results[$table]) != array_keys($errors)) || (empty($results[$table]) && !empty($errors))) {
echo '
<h3>'.$table.'</h3>';
if (array_key_exists('current', $errors) && $errors['current'] == null) {
echo '
<div class="alert alert-danger" ><i class="fa fa-times"></i> '.tr('Tabella assente').'</div>';
<div class="alert alert-danger" ><i class="fa fa-times"></i> '.tr('Tabella assente').'
</div>';
continue;
}
@ -337,7 +338,7 @@ if (!empty($results) || !empty($results_added) || !empty($results_settings) || !
}
}
if (!empty($results_settings)) {
if ($results_settings) {
echo '
<table class="table table-bordered">
<thead>
@ -348,6 +349,7 @@ if (!empty($results) || !empty($results_added) || !empty($results_settings) || !
<th>'.tr('Valore atteso').'</th>
</tr>
</thead>
<tbody>';
foreach ($results_settings as $key => $setting) {
if (!$setting['current']) {
@ -372,7 +374,8 @@ if (!empty($results) || !empty($results_added) || !empty($results_settings) || !
</tbody>
</table>';
}
if (!empty($results_settings_added)) {
if ($results_settings_added) {
echo '
<table class="table table-bordered">
<thead>