Compare commits

1 Commits
Author SHA1 Message Date
solocla b82e3b95ee fixed routines varie 2026-09-11 14:51:16 +02:00
5 changed files with 1508 additions and 820 deletions
+1
View File
@@ -25,3 +25,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=''");
+66 -8
View File
@@ -3,10 +3,10 @@
require_once __DIR__ . '/../../vendor/autoload.php'; require_once __DIR__ . '/../../vendor/autoload.php';
if (!isset($_ENV['DB_HOST'])) { 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;
}
}
+284 -134
View File
@@ -1,134 +1,284 @@
<?php␍ <?php
include('include/headscript.php'); ?>␍
<?php ␍ include('include/headscript.php'); ?>
// pickup the get variable␍
if (isset($_GET["idcertificate"])) {␍ <?php
$certtype=$_GET["idcertificate"]; ␍ ini_set('display_errors', 1);
$idcertificate=$certtype;␍ ini_set('display_startup_errors', 1);
}␍ error_reporting(E_ALL);
if (isset($_GET["tempcode"])) {␍ // pickup the get variable
$tempcode=$_GET["tempcode"]; }␍
if (isset($_GET["previousrepnumber"])) {␍ if (isset($_GET["idcertificate"])) {
$previousrepnumber=$_GET["previousrepnumber"]; }␍
else {␍ $certtype = $_GET["idcertificate"];
$previousrepnumber=""; }␍
if (isset($_GET["idtrf"])) {␍ $idcertificate = $certtype;
$idtrf=$_GET["idtrf"]; }␍ }
if (isset($_GET["issuebycimac"])) {␍
$issuebycimac=$_GET["issuebycimac"]; }␍ if (isset($_GET["tempcode"])) {
else {␍
$issuebycimac=""; }␍ $tempcode = $_GET["tempcode"];
if (isset($_GET["samplestore"])) {␍ }
$samplestore=$_GET["samplestore"]; }␍
else {␍ if (isset($_GET["previousrepnumber"])) {
$samplestore=""; }␍
if (isset($_GET["notificatedorganismname"])) {␍ $previousrepnumber = $_GET["previousrepnumber"];
$notificatedorganismname=$_GET["notificatedorganismname"]; }␍ } else {
else {␍
$notificatedorganismname=""; }␍ $previousrepnumber = "";
␍ }
if ($certtype==7) { ␍
$certtype=1;␍ if (isset($_GET["idtrf"])) {
$idcertificate=1;␍
}␍ $idtrf = $_GET["idtrf"];
?>␍ }
<?php␍
//calculate next trf number available␍ if (isset($_GET["issuebycimac"])) {
$lasttrfnumber = new WA_MySQLi_RS("lasttrfnumber",$cmctrfdb,1);␍
$lasttrfnumber->setQuery("SELECT * FROM `trf-details` ORDER BY `trf-details`.trfnumber DESC LIMIT 1");␍ $issuebycimac = $_GET["issuebycimac"];
$lasttrfnumber->execute();?>␍ } else {
<?php␍
$lastnumber=$lasttrfnumber->getColumnVal("trfnumber");␍ $issuebycimac = "";
$nextnumber=$lastnumber+1;␍ }
?>␍
␍ if (isset($_GET["samplestore"])) {
<?php␍
if (!isset($_GET["idtrf"])) {␍ $samplestore = $_GET["samplestore"];
//check if the tempcode already exist␍ } else {
$tempcodesearch = new WA_MySQLi_RS("tempcodesearch",$cmctrfdb,1);␍
$tempcodesearch->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.tempcode='$tempcode'");␍ $samplestore = "";
$tempcodesearch->execute();␍ }
}␍
?>␍ if (isset($_GET["notificatedorganismname"])) {
<?php␍
// insert the new TRF into the table␍ $notificatedorganismname = $_GET["notificatedorganismname"];
if (!isset($_GET["idtrf"])) {␍ } else {
if (empty($tempcodesearch->getColumnVal("idtrfdetails"))) {␍
$dateintrf=date('Y-m-d');␍ $notificatedorganismname = "";
$cother=$_SESSION["certotherclientsession"];␍ }
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);␍
$InsertQuery->Action = "insert";␍
$InsertQuery->Table = "`trf-details`";␍
$InsertQuery->bindColumn("trfnumber", "i", "$nextnumber", "WA_DEFAULT");␍ if ($certtype == 7) {
$InsertQuery->bindColumn("idcompany", "i", "$idcompany", "WA_DEFAULT");␍
$InsertQuery->bindColumn("iduser", "i", "$iduserlogin", "WA_DEFAULT");␍ $certtype = 1;
$InsertQuery->bindColumn("idcertification", "i", "$certtype", "WA_DEFAULT");␍
$InsertQuery->bindColumn("previousreportnumber", "s", "$previousrepnumber", "WA_DEFAULT");␍ $idcertificate = 1;
$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("");␍ <?php
$InsertQuery->execute();␍
$InsertGoTo = "";␍ //calculate next trf number available
␍
$InsertQuery->redirect($InsertGoTo);␍ $lasttrfnumber = new WA_MySQLi_RS("lasttrfnumber", $cmctrfdb, 1);
␍
$tempcodesearch2 = new WA_MySQLi_RS("tempcodesearch",$cmctrfdb,1);␍ $lasttrfnumber->setQuery("SELECT * FROM `trf-details` ORDER BY `trf-details`.trfnumber DESC LIMIT 1");
$tempcodesearch2->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.tempcode='$tempcode'");␍
$tempcodesearch2->execute();␍ $lasttrfnumber->execute();
␍ echo "Q1: [" . mysqli_error($cmctrfdb) . "]<br>";
$idtrf=$tempcodesearch2->getColumnVal("idtrfdetails");␍ ?>
␍
$code="1";␍ <?php
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);␍
$InsertQuery->Action = "insert";␍ $lastnumber = $lasttrfnumber->getColumnVal("trfnumber");
$InsertQuery->Table = "wheretrfstep";␍
$InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");␍ $nextnumber = $lastnumber + 1;
$InsertQuery->bindColumn("code", "i", "$code", "WA_DEFAULT");␍
$InsertQuery->saveInSession("");␍ ?>
$InsertQuery->execute();␍
$InsertGoTo = "";␍
␍
$InsertQuery->redirect($InsertGoTo);␍ <?php
␍
$code="2";␍ if (!isset($_GET["idtrf"])) {
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);␍
$InsertQuery->Action = "insert";␍ //check if the tempcode already exist
$InsertQuery->Table = "wheretrfstep";␍
$InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");␍ $tempcodesearch = new WA_MySQLi_RS("tempcodesearch", $cmctrfdb, 1);
$InsertQuery->bindColumn("code", "i", "$code", "WA_DEFAULT");␍
$InsertQuery->saveInSession("");␍ $tempcodesearch->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.tempcode='$tempcode'");
$InsertQuery->execute();␍
$InsertGoTo = "";␍ $tempcodesearch->execute();
␍ echo "Q2: [" . mysqli_error($cmctrfdb) . "]<br>";
$InsertQuery->redirect($InsertGoTo);␍ }
}}␍
?>␍ ?>
<?php␍
if (!isset($_GET["idtrf"])) {␍ <?php
␍
$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal",$cmctrfdb,1);␍ // insert the new TRF into the table
$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.tempcode='$tempcode'");␍
$trfnumberfinal->execute();␍ if (!isset($_GET["idtrf"])) {
$idtrf=$trfnumberfinal->getColumnVal("idtrfdetails");␍
$idcertn=$trfnumberfinal->getColumnVal("idcertification");␍ if (empty($tempcodesearch->getColumnVal("idtrfdetails"))) {
} else {␍
$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal",$cmctrfdb,1);␍ $dateintrf = date('Y-m-d');
$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");␍
$trfnumberfinal->execute();␍ $cother = $_SESSION["certotherclientsession"];
$idcertn=$trfnumberfinal->getColumnVal("idcertification");␍
}␍ $InsertQuery = new WA_MySQLi_Query($cmctrfdb);
?>␍
␍ $InsertQuery->Action = "insert";
␍
<?php //redirect based on certificate␍ $InsertQuery->Table = "`trf-details`";
if ($idcertificate==1) { header("location: trfdetails.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍
if ($idcertificate==2) { header("location: typeofcertificate2.php?certtype=$idcertificate&idtrf=$idtrf"); } ␍ $InsertQuery->bindColumn("trfnumber", "i", "$nextnumber", "WA_DEFAULT");
if ($idcertificate==3 || $idcertificate==8) { header("location: typeofcertificate3.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍
if ($idcertificate==4) { header("location: typeofcertificate4.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍ $InsertQuery->bindColumn("idcompany", "i", "$idcompany", "WA_DEFAULT");
if ($idcertificate==5) { header("location: typeofcertificate5.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍
if ($idcertificate==6) { header("location: typeofcertificate6.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍ $InsertQuery->bindColumn("iduser", "i", "$iduserlogin", "WA_DEFAULT");
if ($idcertificate==7) { header("location: typeofcertificate7.php?idcertificate=$idcertificate&idtrf=$idtrf"); } ␍
␍ $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
if ($idcertificate == 1) {
header("location: trfdetails.php?idcertificate=$idcertificate&idtrf=$idtrf");
}
if ($idcertificate == 2) {
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");
}
?>
+1156 -678
View File
File diff suppressed because it is too large Load Diff
+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>