$value) { } } else { // Ci sono stati errori, ad esempio alcuni campi potrebbero essere vuoti // Puoi gestire gli errori qui, ad esempio stampandoli foreach ($errors as $key => $message) { echo "Errore nel campo $key: $message
"; } } } ?> $value) { // Escludi idtrftd dalla parte di aggiornamento della query if ($key !== 'idtrftd') { $updateParts[] = "$key = ?"; $queryParams[] = $value; } } // Controllo se ci sono campi da aggiornare if (count($updateParts) > 0) { $updateQuery .= join(', ', $updateParts) . " WHERE idtrf = ?"; $queryParams[] = $idtrftd; // Aggiungi l'ID alla fine dei parametri della query // Preparazione della query $stmt = $conn->prepare($updateQuery); // Costruzione del tipo di parametri (stringhe, in questo caso) $types = str_repeat('s', count($queryParams)); // Aggiunta dei parametri alla statement $stmt->bind_param($types, ...$queryParams); // Esecuzione della query if ($stmt->execute()) { } // Chiusura dello statement $stmt->close(); } } ?> prepare($checkQuery); $stmt->bind_param("i", $idtd); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); if ($row['count'] == 0) { // Non ci sono record, quindi procedi con l'inserimento dei dati da riskarea_td // Prendi tutti i record da riskarea_td $selectQuery = "SELECT * FROM riskarea_td"; $result = $conn->query($selectQuery); while ($riskRow = $result->fetch_assoc()) { // Prepara l'insert per ogni riga trovata in riskarea_td $insertQuery = "INSERT INTO fillrisk_td (idriskarea_td, applicable, idcompany, iddata_td, idtrf) VALUES (?, ?, ?, ?, ?)"; $stmt = $conn->prepare($insertQuery); // Converte il valore 'Y'/'N' della colonna default in un intero (1/0) $applicableValue = ($riskRow['default'] == 'Y') ? 1 : 0; $stmt->bind_param("iiiii", $riskRow['idriskarea_td'], $applicableValue, $idcompany, $idtd, $idtrftd); $stmt->execute(); } } // Chiudi lo statement e la connessione se non ti servono più $stmt->close(); $conn->close(); */ ?> prepare($sql); $stmt->bind_param("i", $idtd); // "i" indica che l'id è un intero $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); $stmt->close(); $conn->close(); ?> setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrftd'"); $tdquery->execute(); $description = $tdquery->getColumnVal("sample_description"); $trfn = $tdquery->getColumnVal("trfnumber"); $trfrev = $tdquery->getColumnVal("revtrf"); $trfnumb = $trfn . ' VER.' . $trfrev; $idart = $tdquery->getColumnVal("idarticletype"); ?> prepare($partquerylist); $partqueryliststmd->execute(); $resultpartquery = $partqueryliststmd->get_result(); // Copia i risultati in un array $partRows = []; while ($row = $resultpartquery->fetch_assoc()) { $partRows[] = $row; } $partqueryliststmd->close(); $conn->close(); // Aggiungi l'opzione specifica in base a $idart switch ($idart) { case 1: $partRows[] = [ 'partsnumber' => '99', 'partsnameita' => 'Calzatura completa' ]; break; case 2: $partRows[] = [ 'partsnumber' => '99', 'partsnameita' => 'Guanto Completo' ]; break; case 3: $partRows[] = [ 'partsnumber' => '99', 'partsnameita' => 'Semimaschera completa' ]; break; case 4: $partRows[] = [ 'partsnumber' => '99', 'partsnameita' => 'Indumento completo' ]; break; } ?> setQuery("SELECT * FROM `trf-details` LEFT JOIN auth_users ON `trf-details`.iduser=auth_users.id LEFT JOIN article_type ON `trf-details`.idarticletype=article_type.idarticletype LEFT JOIN certificationtype ON certificationtype.idcertificationtype=`trf-details`.idcertification WHERE `trf-details`.idcompany='$idcompany' AND `trf-details`.signedon <>'' ORDER BY `trf-details`.trfnumber"); $archivetrflist->execute(); ?> <?php echo $titlepage; ?>

- TRF:

hasRole('Admin') || Auth::user()->hasRole('CustomerService') || Auth::user()->hasRole('Superuser') || Auth::user()->hasRole('Certification'); ?>
setQuery("SELECT * FROM identificationparts WHERE identificationparts.idtrfdetails='$idtrftd'"); $partsquery->execute(); ?> atEnd()) { ?> " name="ididentificationparts"> moveNext(); ?> moveFirst(); // Se hai bisogno di riutilizzare i risultati ?>
List N.
" name="partsidnumber" > " name="description_identificationparts" > " name="article_identificationparts" > " name="color_identificationparts" > " name="material_identificationparts" > " name="cmcreportnumber_identificationparts"> " name="cmcreportdate_identificationparts">

Agenti Chimici

Aggiorna di seguito i livelli e percentuale di degradazione per agenti chimici

setQuery("SELECT * FROM trfchemicalagent LEFT JOIN chemicalagent ON trfchemicalagent.idchemicalagent=chemicalagent.idchemicalagent WHERE trfchemicalagent.idtrf='$idtrftd'"); $chemquery->execute(); ?> atEnd()) { ?> " name="idtrfchemicalagent"> moveNext(); ?> moveFirst(); // Se hai bisogno di riutilizzare i risultati ?>
Chemical Agent Livello Degradazione percentuale
getColumnVal("name_chemicalagent"); ?> " id="degradationpercentage_getColumnVal("idtrfchemicalagent"); ?>" name="degradationpercentage" maxlength="6" data-id="getColumnVal("idtrfchemicalagent"); ?>" onblur="updateField(this)">