www/includes/db_inventory_yeasts.php

changeset 785
aa79acfdf8a9
parent 767
08c0343b622b
--- a/www/includes/db_inventory_yeasts.php	Sun Feb 06 20:06:46 2022 +0100
+++ b/www/includes/db_inventory_yeasts.php	Thu Feb 10 22:15:10 2022 +0100
@@ -25,7 +25,13 @@
 		$sql  = "UPDATE `inventory_yeasts` SET ";
 	}
 
-	$sql .= "name='" . mysqli_real_escape_string($connect, $_POST['name']);
+	if (isset($_POST['uuid']) && (strlen($_POST['uuid']) == 36)) {
+                $sql .= "uuid='" . $_POST['uuid'];
+        } else {
+                $uuid = str_replace("\n", "", file_get_contents('/proc/sys/kernel/random/uuid'));
+                $sql .= "uuid='" . $uuid;
+        }
+	$sql .= "', name='" . mysqli_real_escape_string($connect, $_POST['name']);
 	$sql .= "', type='" . array_search($_POST['type'], $yeasttype);
 	$sql .= "', form='" . array_search($_POST['form'], $yeastform);
 	$sql .= "', laboratory='" . mysqli_real_escape_string($connect, $_POST['laboratory']);
@@ -94,6 +100,7 @@
 		$yeasts[] = array(
 			'record' => $row['record'],
 			'name' => $row['name'],
+			'uuid' => $row['uuid'],
 			'type' => $yeasttype[$row['type']],
 			'form' => $yeastform[$row['form']],
 			'laboratory' => $row['laboratory'],

mercurial