update export to lims

This commit is contained in:
Claudio 2025-10-11 20:19:43 +02:00
parent eef9ae8d36
commit 29e4b41874

View File

@ -33,11 +33,12 @@ try {
throw new Exception("Missing iddatadb");
}
// 🔹 STEP 1+2: Fetch Cliente ID + Schema ID
// 🔹 STEP 1+2: Fetch Cliente ID from datadb and Schema ID from excel_templates
$stmt = $pdo->prepare("
SELECT idclient AS clienteId, idschema AS schemaId
FROM datadb
WHERE iddatadb = :iddatadb
SELECT d.idclient AS clienteId, et.idschema AS schemaId
FROM datadb as d
INNER JOIN excel_templates as et ON d.templateid = et.id
WHERE d.iddatadb = :iddatadb
LIMIT 1
");
$stmt->execute(['iddatadb' => $iddatadb]);
@ -50,11 +51,11 @@ try {
$clienteId = (int) $result['clienteId'];
$schemaId = (int) $result['schemaId'];
// 🔹 STEP 3: Fetch Parts (including idmatrice and note)
// 🔹 STEP 3: Fetch Parts (including idmatrice)
$stmt = $pdo->prepare("
SELECT part_number, part_description, material, color, mix, idmatrice, note
FROM identification_parts
WHERE iddatadb = :iddatadb
SELECT part_number, part_description, material, color, mix, idmatrice
FROM identification_parts
WHERE iddatadb = :iddatadb
");
$stmt->execute(['iddatadb' => $iddatadb]);
$parts = $stmt->fetchAll(PDO::FETCH_ASSOC);
@ -134,7 +135,7 @@ try {
"Matrice" => $matriceId,
"SottoMatrice" => null,
"SchemaCustomField" => $schemaId,
"NoteWeb" => $part["note"] ?? "" // Modificato da part_description a note
"NoteWeb" => $part["part_description"] ?? ""
];
// Costruisci curl-like per questo campione