Compare commits

5 Commits
Author SHA1 Message Date
solocla af73cf5c30 techdossier fix 3 2026-09-11 16:27:45 +02:00
solocla f698c271d4 fix2 summary preview 2026-09-11 16:25:40 +02:00
solocla 664f53e3f3 techdossier fixing 2026-09-11 16:23:52 +02:00
solocla b1f48306b7 fixed dmdtrfdb 2026-09-11 14:59:59 +02:00
solocla 6949a01ad8 fixed routines varie 2026-09-11 14:55:20 +02:00
7 changed files with 1516 additions and 830 deletions
+7 -8
View File
@@ -5,15 +5,13 @@
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
if (!isset($_ENV['DB_HOST'])) { $dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/../');
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/../'); $dotenv->safeLoad();
$dotenv->safeLoad();
}
$hostname_cmctrfdb = $_ENV['DB_HOST'] ?? 'localhost'; $hostname_cmctrfdb = $_ENV['DB_HOST'] ?? $_SERVER['DB_HOST'] ?? getenv('DB_HOST') ?: 'localhost';
$database_cmctrfdb = $_ENV['DB_DATABASE'] ?? ''; $database_cmctrfdb = $_ENV['DB_DATABASE'] ?? $_SERVER['DB_DATABASE'] ?? getenv('DB_DATABASE') ?: '';
$username_cmctrfdb = $_ENV['DB_USERNAME'] ?? ''; $username_cmctrfdb = $_ENV['DB_USERNAME'] ?? $_SERVER['DB_USERNAME'] ?? getenv('DB_USERNAME') ?: '';
$password_cmctrfdb = $_ENV['DB_PASSWORD'] ?? ''; $password_cmctrfdb = $_ENV['DB_PASSWORD'] ?? $_SERVER['DB_PASSWORD'] ?? getenv('DB_PASSWORD') ?: '';
$servername = $hostname_cmctrfdb; $servername = $hostname_cmctrfdb;
$username = $username_cmctrfdb; $username = $username_cmctrfdb;
@@ -25,3 +23,4 @@ $dbname = $database_cmctrfdb;
$cmctrfdb = mysqli_init(); $cmctrfdb = mysqli_init();
if (defined("MYSQLI_OPT_INT_AND_FLOAT_NATIVE")) $cmctrfdb->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, TRUE); if (defined("MYSQLI_OPT_INT_AND_FLOAT_NATIVE")) $cmctrfdb->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, TRUE);
$cmctrfdb->real_connect($hostname_cmctrfdb, $username_cmctrfdb, $password_cmctrfdb, $database_cmctrfdb) or die("Connect Error: " . mysqli_connect_error()); $cmctrfdb->real_connect($hostname_cmctrfdb, $username_cmctrfdb, $password_cmctrfdb, $database_cmctrfdb) or die("Connect Error: " . mysqli_connect_error());
$cmctrfdb->query("SET SESSION sql_mode=''");
+64 -6
View File
@@ -6,7 +6,7 @@ if (!isset($_ENV['DB_HOST'])) {
Dotenv\Dotenv::createImmutable(__DIR__ . '/../../')->safeLoad(); Dotenv\Dotenv::createImmutable(__DIR__ . '/../../')->safeLoad();
} }
Class Dropdown class Dropdown
{ {
private $host; private $host;
private $username; private $username;
@@ -22,12 +22,70 @@ Class Dropdown
$this->password = $_ENV['DB_PASSWORD'] ?? ''; $this->password = $_ENV['DB_PASSWORD'] ?? '';
$this->dbname = $_ENV['DB_DATABASE'] ?? ''; $this->dbname = $_ENV['DB_DATABASE'] ?? '';
try try {
{
$this->connection = new mysqli($this->host, $this->username, $this->password, $this->dbname); $this->connection = new mysqli($this->host, $this->username, $this->password, $this->dbname);
} } catch (Exception $e) {
catch (Exception $e)
{
echo "Connection error " . $e->getMessage(); echo "Connection error " . $e->getMessage();
} }
} }
//fetch all country records from database
public function fetchCountry()
{
$data = null;
$query = "SELECT * FROM article_type ORDER BY article_type.name_articletype";
if ($sql = $this->connection->query($query)) {
while ($rows = mysqli_fetch_assoc($sql)) {
$data[] = $rows;
}
}
return $data;
}
//fetch model records from database depend upon country id
public function fetchModel($idarticletype)
{
$data = null;
$query = "SELECT * FROM modelarticle WHERE idarticletype='" . $idarticletype . "' ";
if ($sql = $this->connection->query($query)) {
while ($rows = mysqli_fetch_assoc($sql)) {
$data[] = $rows;
}
}
return $data;
}
//fetch Charact records from database depend on article type
public function fetchCharact($idarticletype)
{
$data = null;
$idarticletype = (int)$idarticletype;
$query = "
SELECT DISTINCT
ac.*
FROM article_characteristic ac
INNER JOIN standards s
ON s.idarticlecharacteristic = ac.idarticlecharacteristic
AND s.idarticletype = ac.idarticletype
WHERE ac.idarticletype = $idarticletype
AND s.active = 'Y'
ORDER BY ac.name_articlecharacteristic
";
if ($sql = $this->connection->query($query)) {
while ($rows = mysqli_fetch_assoc($sql)) {
$data[] = $rows;
}
}
return $data;
}
}
+269 -119
View File
@@ -1,134 +1,284 @@
<?php <?php
include('include/headscript.php'); ?>␍
include('include/headscript.php'); ?>
<?php <?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// pickup the get variable // pickup the get variable
if (isset($_GET["idcertificate"])) { if (isset($_GET["idcertificate"])) {
$certtype=$_GET["idcertificate"]; ␍
$idcertificate=$certtype;␍ $certtype = $_GET["idcertificate"];
}␍
$idcertificate = $certtype;
}
if (isset($_GET["tempcode"])) { if (isset($_GET["tempcode"])) {
$tempcode=$_GET["tempcode"]; }␍
$tempcode = $_GET["tempcode"];
}
if (isset($_GET["previousrepnumber"])) { if (isset($_GET["previousrepnumber"])) {
$previousrepnumber=$_GET["previousrepnumber"]; }␍
else {␍
$previousrepnumber=""; }␍
if (isset($_GET["idtrf"])) {␍
$idtrf=$_GET["idtrf"]; }␍
if (isset($_GET["issuebycimac"])) {␍
$issuebycimac=$_GET["issuebycimac"]; }␍
else {␍
$issuebycimac=""; }␍
if (isset($_GET["samplestore"])) {␍
$samplestore=$_GET["samplestore"]; }␍
else {␍
$samplestore=""; }␍
if (isset($_GET["notificatedorganismname"])) {␍
$notificatedorganismname=$_GET["notificatedorganismname"]; }␍
else {␍
$notificatedorganismname=""; }␍
if ($certtype==7) { ␍ $previousrepnumber = $_GET["previousrepnumber"];
$certtype=1;␍
$idcertificate=1;␍
}␍
?>␍
<?php␍
//calculate next trf number available␍
$lasttrfnumber = new WA_MySQLi_RS("lasttrfnumber",$cmctrfdb,1);␍
$lasttrfnumber->setQuery("SELECT * FROM `trf-details` ORDER BY `trf-details`.trfnumber DESC LIMIT 1");␍
$lasttrfnumber->execute();?>␍
<?php␍
$lastnumber=$lasttrfnumber->getColumnVal("trfnumber");␍
$nextnumber=$lastnumber+1;␍
?>␍
␍
<?php␍
if (!isset($_GET["idtrf"])) {␍
//check if the tempcode already exist␍
$tempcodesearch = new WA_MySQLi_RS("tempcodesearch",$cmctrfdb,1);␍
$tempcodesearch->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.tempcode='$tempcode'");␍
$tempcodesearch->execute();␍
}␍
?>␍
<?php␍
// insert the new TRF into the table␍
if (!isset($_GET["idtrf"])) {␍
if (empty($tempcodesearch->getColumnVal("idtrfdetails"))) {␍
$dateintrf=date('Y-m-d');␍
$cother=$_SESSION["certotherclientsession"];␍
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);␍
$InsertQuery->Action = "insert";␍
$InsertQuery->Table = "`trf-details`";␍
$InsertQuery->bindColumn("trfnumber", "i", "$nextnumber", "WA_DEFAULT");␍
$InsertQuery->bindColumn("idcompany", "i", "$idcompany", "WA_DEFAULT");␍
$InsertQuery->bindColumn("iduser", "i", "$iduserlogin", "WA_DEFAULT");␍
$InsertQuery->bindColumn("idcertification", "i", "$certtype", "WA_DEFAULT");␍
$InsertQuery->bindColumn("previousreportnumber", "s", "$previousrepnumber", "WA_DEFAULT");␍
$InsertQuery->bindColumn("tempcode", "s", "$tempcode", "WA_DEFAULT");␍
$InsertQuery->bindColumn("notificatedorganismname", "s", "$notificatedorganismname", "WA_DEFAULT");␍
$InsertQuery->bindColumn("dateintrf", "s", "$dateintrf", "WA_DEFAULT");␍
$InsertQuery->bindColumn("otherclient", "s", "$cother", "WA_DEFAULT");␍
$InsertQuery->saveInSession("");␍
$InsertQuery->execute();␍
$InsertGoTo = "";␍
␍
$InsertQuery->redirect($InsertGoTo);␍
␍
$tempcodesearch2 = new WA_MySQLi_RS("tempcodesearch",$cmctrfdb,1);␍
$tempcodesearch2->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.tempcode='$tempcode'");␍
$tempcodesearch2->execute();␍
␍
$idtrf=$tempcodesearch2->getColumnVal("idtrfdetails");␍
␍
$code="1";␍
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);␍
$InsertQuery->Action = "insert";␍
$InsertQuery->Table = "wheretrfstep";␍
$InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");␍
$InsertQuery->bindColumn("code", "i", "$code", "WA_DEFAULT");␍
$InsertQuery->saveInSession("");␍
$InsertQuery->execute();␍
$InsertGoTo = "";␍
␍
$InsertQuery->redirect($InsertGoTo);␍
␍
$code="2";␍
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);␍
$InsertQuery->Action = "insert";␍
$InsertQuery->Table = "wheretrfstep";␍
$InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");␍
$InsertQuery->bindColumn("code", "i", "$code", "WA_DEFAULT");␍
$InsertQuery->saveInSession("");␍
$InsertQuery->execute();␍
$InsertGoTo = "";␍
␍
$InsertQuery->redirect($InsertGoTo);␍
}}␍
?>␍
<?php␍
if (!isset($_GET["idtrf"])) {␍
␍
$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal",$cmctrfdb,1);␍
$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.tempcode='$tempcode'");␍
$trfnumberfinal->execute();␍
$idtrf=$trfnumberfinal->getColumnVal("idtrfdetails");␍
$idcertn=$trfnumberfinal->getColumnVal("idcertification");␍
} else { } else {
$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal",$cmctrfdb,1);␍
$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");␍ $previousrepnumber = "";
$trfnumberfinal->execute();␍
$idcertn=$trfnumberfinal->getColumnVal("idcertification");␍
} }
if (isset($_GET["idtrf"])) {
$idtrf = $_GET["idtrf"];
}
if (isset($_GET["issuebycimac"])) {
$issuebycimac = $_GET["issuebycimac"];
} else {
$issuebycimac = "";
}
if (isset($_GET["samplestore"])) {
$samplestore = $_GET["samplestore"];
} else {
$samplestore = "";
}
if (isset($_GET["notificatedorganismname"])) {
$notificatedorganismname = $_GET["notificatedorganismname"];
} else {
$notificatedorganismname = "";
}
if ($certtype == 7) {
$certtype = 1;
$idcertificate = 1;
}
?> ?>
<?php
//calculate next trf number available
$lasttrfnumber = new WA_MySQLi_RS("lasttrfnumber", $cmctrfdb, 1);
$lasttrfnumber->setQuery("SELECT * FROM `trf-details` ORDER BY `trf-details`.trfnumber DESC LIMIT 1");
$lasttrfnumber->execute();
echo "Q1: [" . mysqli_error($cmctrfdb) . "]<br>";
?>
<?php
$lastnumber = $lasttrfnumber->getColumnVal("trfnumber");
$nextnumber = $lastnumber + 1;
?>
<?php
if (!isset($_GET["idtrf"])) {
//check if the tempcode already exist
$tempcodesearch = new WA_MySQLi_RS("tempcodesearch", $cmctrfdb, 1);
$tempcodesearch->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.tempcode='$tempcode'");
$tempcodesearch->execute();
echo "Q2: [" . mysqli_error($cmctrfdb) . "]<br>";
}
?>
<?php
// insert the new TRF into the table
if (!isset($_GET["idtrf"])) {
if (empty($tempcodesearch->getColumnVal("idtrfdetails"))) {
$dateintrf = date('Y-m-d');
$cother = $_SESSION["certotherclientsession"];
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "`trf-details`";
$InsertQuery->bindColumn("trfnumber", "i", "$nextnumber", "WA_DEFAULT");
$InsertQuery->bindColumn("idcompany", "i", "$idcompany", "WA_DEFAULT");
$InsertQuery->bindColumn("iduser", "i", "$iduserlogin", "WA_DEFAULT");
$InsertQuery->bindColumn("idcertification", "i", "$certtype", "WA_DEFAULT");
$InsertQuery->bindColumn("previousreportnumber", "s", "$previousrepnumber", "WA_DEFAULT");
$InsertQuery->bindColumn("tempcode", "s", "$tempcode", "WA_DEFAULT");
$InsertQuery->bindColumn("notificatedorganismname", "s", "$notificatedorganismname", "WA_DEFAULT");
$InsertQuery->bindColumn("dateintrf", "s", "$dateintrf", "WA_DEFAULT");
$InsertQuery->bindColumn("otherclient", "s", "$cother", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
$InsertQuery->redirect($InsertGoTo);
$tempcodesearch2 = new WA_MySQLi_RS("tempcodesearch", $cmctrfdb, 1);
$tempcodesearch2->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.tempcode='$tempcode'");
$tempcodesearch2->execute();
$idtrf = $tempcodesearch2->getColumnVal("idtrfdetails");
$code = "1";
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "wheretrfstep";
$InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery->bindColumn("code", "i", "$code", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
$InsertQuery->redirect($InsertGoTo);
$code = "2";
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "wheretrfstep";
$InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery->bindColumn("code", "i", "$code", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
$InsertQuery->redirect($InsertGoTo);
}
}
?>
<?php
if (!isset($_GET["idtrf"])) {
$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal", $cmctrfdb, 1);
$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.tempcode='$tempcode'");
$trfnumberfinal->execute();
$idtrf = $trfnumberfinal->getColumnVal("idtrfdetails");
$idcertn = $trfnumberfinal->getColumnVal("idcertification");
} else {
$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal", $cmctrfdb, 1);
$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");
$trfnumberfinal->execute();
$idcertn = $trfnumberfinal->getColumnVal("idcertification");
}
?>
<?php //redirect based on certificate <?php //redirect based on certificate
if ($idcertificate==1) { header("location: trfdetails.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍
if ($idcertificate==2) { header("location: typeofcertificate2.php?certtype=$idcertificate&idtrf=$idtrf"); } ␍ if ($idcertificate == 1) {
if ($idcertificate==3 || $idcertificate==8) { header("location: typeofcertificate3.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍ header("location: trfdetails.php?idcertificate=$idcertificate&idtrf=$idtrf");
if ($idcertificate==4) { header("location: typeofcertificate4.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍ }
if ($idcertificate==5) { header("location: typeofcertificate5.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍
if ($idcertificate==6) { header("location: typeofcertificate6.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍ if ($idcertificate == 2) {
if ($idcertificate==7) { header("location: typeofcertificate7.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍ header("location: typeofcertificate2.php?certtype=$idcertificate&idtrf=$idtrf");
}
if ($idcertificate == 3 || $idcertificate == 8) {
header("location: typeofcertificate3.php?idcertificate=$idcertificate&idtrf=$idtrf");
}
if ($idcertificate == 4) {
header("location: typeofcertificate4.php?idcertificate=$idcertificate&idtrf=$idtrf");
}
if ($idcertificate == 5) {
header("location: typeofcertificate5.php?idcertificate=$idcertificate&idtrf=$idtrf");
}
if ($idcertificate == 6) {
header("location: typeofcertificate6.php?idcertificate=$idcertificate&idtrf=$idtrf");
}
if ($idcertificate == 7) {
header("location: typeofcertificate7.php?idcertificate=$idcertificate&idtrf=$idtrf");
}
?> ?>
+718 -240
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -30,7 +30,7 @@ if (isset($_POST['articlepartvalue'])) {
MAX(identificationparts.partsidnumber) AS partsidnumber, MAX(identificationparts.partsidnumber) AS partsidnumber,
MAX(identificationparts.arttypeid) AS arttypeid, MAX(identificationparts.arttypeid) AS arttypeid,
MAX(`trf-details`.idtrfdetails) AS idtrfdetails, MAX(`trf-details`.idtrfdetails) AS idtrfdetails,
`trf-details`.idcompany ANY_VALUE(`trf-details`.idcompany) AS idcompany
FROM FROM
identificationparts identificationparts
LEFT JOIN LEFT JOIN
+1
View File
@@ -289,6 +289,7 @@ while ($iddpicategoryrow = mysqli_fetch_assoc($dpicategroylist)) {
$iddpicategorylistRecord[$iddpicategoryrow['idstandards']][$iddpicategoryrow['iddpicategory']] = utf8_encode(htmlspecialchars($iddpicategoryrow['value_dpicategory'], ENT_QUOTES)); $iddpicategorylistRecord[$iddpicategoryrow['idstandards']][$iddpicategoryrow['iddpicategory']] = utf8_encode(htmlspecialchars($iddpicategoryrow['value_dpicategory'], ENT_QUOTES));
} }
$iddpicategoryperStdJson = json_encode($iddpicategorylistRecord); $iddpicategoryperStdJson = json_encode($iddpicategorylistRecord);
echo "<!-- DEBUG con: " . (mysqli_connect_errno() ? 'KO' : 'OK') . " | prot JSON: " . $idprotectioncategoryperStdJson . " | dpi JSON: " . $iddpicategoryperStdJson . " -->";
/* END GET OPTIONS FOR Categoria DPI per standard */ /* END GET OPTIONS FOR Categoria DPI per standard */
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
+1 -1
View File
@@ -537,7 +537,7 @@ $archivetrflist->execute(); ?>
let params = getParamsFromPage(); let params = getParamsFromPage();
let previewContainer = document.getElementById('documentPreview'); let previewContainer = document.getElementById('documentPreview');
let preloader = document.getElementById('preloader'); let preloader = document.getElementById('preloader');
let baseURL = 'https://www.cimac.it/modulo_certificazione/public/techdossier_stepsummarypreview.php'; let baseURL = 'techdossier_stepsummarypreview.php';
let url = `${baseURL}?idtd=${params.idtd}&idtrftd=${params.idtrftd}`; let url = `${baseURL}?idtd=${params.idtd}&idtrftd=${params.idtrftd}`;
// Mostra il preloader (già presente nell'HTML) // Mostra il preloader (già presente nell'HTML)