From f97b52f1586d8e22d7711696c5cb327f84b84909 Mon Sep 17 00:00:00 2001 From: solocla Date: Wed, 13 May 2026 11:54:28 +0200 Subject: [PATCH] skip empty parts during clone and LIMS export --- public/userarea/clone_parts_to_visible.php | 12 +++++++----- public/userarea/export_to_lims.php | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/public/userarea/clone_parts_to_visible.php b/public/userarea/clone_parts_to_visible.php index b3fa6a0..6c8eb27 100644 --- a/public/userarea/clone_parts_to_visible.php +++ b/public/userarea/clone_parts_to_visible.php @@ -28,11 +28,13 @@ try { // 1. Load source parts $stmtParts = $pdo->prepare(" - SELECT id, part_number, part_description, mix, idmatrice, note, dateexpiry - FROM identification_parts - WHERE iddatadb = ? - ORDER BY part_number ASC, id ASC - "); + SELECT id, part_number, part_description, mix, idmatrice, note, dateexpiry + FROM identification_parts + WHERE iddatadb = ? + AND part_description IS NOT NULL + AND TRIM(part_description) <> '' + ORDER BY part_number ASC, id ASC + "); $stmtParts->execute([$sourceIddatadb]); $sourceParts = $stmtParts->fetchAll(PDO::FETCH_ASSOC); diff --git a/public/userarea/export_to_lims.php b/public/userarea/export_to_lims.php index 507a387..4102b5b 100644 --- a/public/userarea/export_to_lims.php +++ b/public/userarea/export_to_lims.php @@ -107,11 +107,13 @@ try { // 🔹 STEP 3: Fetch Parts (including idmatrice and part id for custom fields) $stmt = $pdo->prepare(" - SELECT id AS part_id, part_number, part_description, material, color, mix, idmatrice, dateexpiry - FROM identification_parts - WHERE iddatadb = :iddatadb - ORDER BY CAST(part_number AS UNSIGNED) ASC, part_number ASC - "); + SELECT id AS part_id, part_number, part_description, material, color, mix, idmatrice, dateexpiry + FROM identification_parts + WHERE iddatadb = :iddatadb + AND part_description IS NOT NULL + AND TRIM(part_description) <> '' + ORDER BY CAST(part_number AS UNSIGNED) ASC, part_number ASC + "); $stmt->execute(['iddatadb' => $iddatadb]); $parts = $stmt->fetchAll(PDO::FETCH_ASSOC);