update dossier chekcqual

This commit is contained in:
2025-05-16 18:46:16 +02:00
parent c53c298401
commit fa44531778
405 changed files with 89887 additions and 833 deletions
+84 -68
View File
@@ -223,10 +223,10 @@ $drafttrf->execute();
<tr>
<th>TRF N.</th>
<th>REV</th>
<th>Description</th>
<th>Cert Type</th>
<th>Article type</th>
<th>To be Sign</th>
<th><?= htmlspecialchars($descriptionarchive, ENT_QUOTES, 'UTF-8'); ?></th>
<th><?= htmlspecialchars($certarchive, ENT_QUOTES, 'UTF-8'); ?></th>
<th><?= htmlspecialchars($artarchive, ENT_QUOTES, 'UTF-8'); ?></th>
<th><?= htmlspecialchars($tobesignarchive, ENT_QUOTES, 'UTF-8'); ?></th>
<th><?php echo $action; ?></th>
<th></th>
</tr>
@@ -245,7 +245,14 @@ $drafttrf->execute();
} ?></td>
<td><?php echo ($drafttrf->getColumnVal("sample_description")); ?></td>
<td><?php echo ($drafttrf->getColumnVal("name_certification")); ?></td>
<td>
<?php
$lang = isset($_SESSION['langselect']) ? $_SESSION['langselect'] : 'it';
$columnName = ($lang === 'en') ? "showtablename_en" : "showtablename_it";
echo $drafttrf->getColumnVal($columnName);
?>
</td>
<td>
<?php
// Assuming session_start() has been called previously if needed.
@@ -257,7 +264,7 @@ $drafttrf->execute();
$revcs = $drafttrf->getColumnVal("revcs");
if ($revcs == 's') { ?>
<a href="declaration.php?idtrf=<?php echo $idtrf; ?>"><button type="button" class="btn btn-success waves-effect waves-light">SIGN</button></a>
<a href="declaration.php?idtrf=<?php echo $idtrf; ?>"><button type="button" class="btn btn-success waves-effect waves-light"><?= htmlspecialchars($signarchive, ENT_QUOTES, 'UTF-8'); ?></button></a>
</td>
<td></td><?php } ?>
@@ -356,15 +363,15 @@ $drafttrf->execute();
<tr>
<th>TRF N.</th>
<th>REV</th>
<th>Signed On</th>
<th>Description</th>
<th>Cert Type</th>
<th>Article type</th>
<th>Insert by</th>
<th>PDF1</th>
<th>PDF2</th>
<th><?= htmlspecialchars($signedonarchive, ENT_QUOTES, 'UTF-8'); ?></th>
<th><?= htmlspecialchars($descriptionarchive, ENT_QUOTES, 'UTF-8'); ?></th>
<th><?= htmlspecialchars($certarchive, ENT_QUOTES, 'UTF-8'); ?></th>
<th><?= htmlspecialchars($artarchive, ENT_QUOTES, 'UTF-8'); ?></th>
<th><?= htmlspecialchars($insertbyarchive, ENT_QUOTES, 'UTF-8'); ?></th>
<th></th>
<th></th>
<th>ZIP</th>
<th>ACTION</th>
<th><?= htmlspecialchars($action, ENT_QUOTES, 'UTF-8'); ?></th>
</tr>
</thead>
@@ -406,7 +413,17 @@ $drafttrf->execute();
<td><?php echo ($archivetrflist->getColumnVal("sample_description"));
?></td>
<td><?php echo ($archivetrflist->getColumnVal("name_certification")); ?></td>
<td>
<?php
$lang = isset($_SESSION['langselect']) ? $_SESSION['langselect'] : 'it';
$columnName = ($lang === 'en') ? "showtablename_en" : "showtablename_it";
$value = $archivetrflist->getColumnVal($columnName);
// Fallback: se il valore è vuoto, usa name_certification
echo !empty($value) ? $value : $archivetrflist->getColumnVal("name_certification");
?>
</td>
<td>
<?php
// Assuming session_start() has been called previously if needed.
@@ -457,63 +474,62 @@ $drafttrf->execute();
Rev
</button>
<?php if ((Auth::user()->hasRole('Admin')) || (Auth::user()->hasRole('CustomerService')) || (Auth::user()->hasRole('Superuser')) || (Auth::user()->hasRole('Certification')) || (Auth::user()->id == 178)) : ?>
<?php
if (!in_array($idcertfortd, [5, 6, 10])) {
$idtrfdetailschk = $archivetrflist->getColumnVal('idtrfdetails');
$ntrfdetailschk = $archivetrflist->getColumnVal('trfnumber');
<?php
if (!in_array($idcertfortd, [5, 6, 10])) {
$idtrfdetailschk = $archivetrflist->getColumnVal('idtrfdetails');
$ntrfdetailschk = $archivetrflist->getColumnVal('trfnumber');
$conn = new mysqli($servername, $username, $password, $dbname);
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connessione fallita: " . $conn->connect_error);
}
$query = "SELECT COUNT(*) AS count FROM data_td WHERE idtrf = ?";
$stmt = $conn->prepare($query);
if ($stmt === false) {
die("Errore nella preparazione della query: " . $conn->error);
}
$stmt->bind_param("i", $idtrfdetailschk);
$stmt->execute();
$result = $stmt->get_result();
$rowcheck = $result->fetch_assoc();
if ($rowcheck['count'] < 1) {
$buttonColor = '#ff9800';
$onClick = "Swal.fire({
title: 'Sei sicuro di voler creare il Fascicolo Tecnico per il TRF N. " . $ntrfdetailschk . "?',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sì, procedi!',
cancelButtonText: 'No, chiudi!'
}).then((result) => {
if (result.isConfirmed) {
window.location.href='techdossier_start.php?idtrftd=" . $idtrfdetailschk . "';
}
});";
} else {
$buttonColor = '#4CAF50';
$onClick = "window.location.href='archivetd.php';";
}
$stmt->close();
$conn->close();
?>
<button type="button" onclick="<?php echo $onClick; ?>" class="btn <?php echo ($maxrevtrf > $currentrevtrf) ? 'btn-inactive' : ''; ?>" style="border: 1px solid; color: white; background-color: <?php echo $buttonColor; ?>;" <?php echo ($maxrevtrf > $currentrevtrf) ? 'disabled' : ''; ?>>
TF
</button>
<?php
if ($conn->connect_error) {
die("Connessione fallita: " . $conn->connect_error);
}
?>
<?php endif; ?>
$query = "SELECT COUNT(*) AS count FROM data_td WHERE idtrf = ?";
$stmt = $conn->prepare($query);
if ($stmt === false) {
die("Errore nella preparazione della query: " . $conn->error);
}
$stmt->bind_param("i", $idtrfdetailschk);
$stmt->execute();
$result = $stmt->get_result();
$rowcheck = $result->fetch_assoc();
if ($rowcheck['count'] < 1) {
$buttonColor = '#ff9800';
$onClick = "Swal.fire({
title: 'Sei sicuro di voler creare il Fascicolo Tecnico per il TRF N. " . $ntrfdetailschk . "?',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sì, procedi!',
cancelButtonText: 'No, chiudi!'
}).then((result) => {
if (result.isConfirmed) {
window.location.href='techdossier_start.php?idtrftd=" . $idtrfdetailschk . "';
}
});";
} else {
$buttonColor = '#4CAF50';
$onClick = "window.location.href='archivetd.php';";
}
$stmt->close();
$conn->close();
?>
<button type="button" onclick="<?php echo $onClick; ?>" class="btn <?php echo ($maxrevtrf > $currentrevtrf) ? 'btn-inactive' : ''; ?>" style="border: 1px solid; color: white; background-color: <?php echo $buttonColor; ?>;" <?php echo ($maxrevtrf > $currentrevtrf) ? 'disabled' : ''; ?>>
TF
</button>
<?php
}
?>
<button type="button" onclick="
Swal.fire({