www/includes/db_recipes.php

changeset 226
40e68b18b50d
parent 225
ad2e1e3ccaca
child 228
98536f6539ee
--- a/www/includes/db_recipes.php	Thu Jan 31 17:16:51 2019 +0100
+++ b/www/includes/db_recipes.php	Thu Jan 31 22:39:36 2019 +0100
@@ -191,23 +191,41 @@
 			$misc .= ',"m_time":' . $item['m_time'];
 			$misc .= ',"m_amount_is_weight":' . $item['m_amount_is_weight'];
 			$misc .= ',"m_cost":' . $item['m_cost'] . '}';
-			syslog(LOG_NOTICE, $misc);
+			//syslog(LOG_NOTICE, $misc);
 			$miscs .= $misc;
 		}
 	}
 	$miscs .= ']';
 	$sql .= "', json_miscs='" . $miscs;
 
+	$yeasts = '[';
+	$comma = FALSE;
 	if (isset($_POST['yeasts'])) {
 		$array = $_POST['yeasts'];
-		foreach($array as $key => $item){
-			foreach ($disallowed as $disallowed_key) {
-				unset($array[$key]["$disallowed_key"]);
-			}
+		foreach($array as $key => $item) {
+			if ($comma)
+				$yeasts .= ',';
+			$comma = TRUE;
+			$yeast  = '{"y_name":"' . str_replace($rescapers,$rreplacements,$item['y_name']);
+			$yeast .= '","y_laboratory":"' . str_replace($rescapers,$rreplacements,$item['y_laboratory']);
+			$yeast .= '","y_product_id":"' . str_replace($rescapers,$rreplacements,$item['y_product_id']);
+			$yeast .= '","y_amount":' . $item['y_amount'];
+			$yeast .= ',"y_type":' . $item['y_type'];
+			$yeast .= ',"y_form":' . $item['y_form'];
+			$yeast .= ',"y_min_temperature":' . $item['y_min_temperature'];
+			$yeast .= ',"y_max_temperature":' . $item['y_max_temperature'];
+			$yeast .= ',"y_flocculation":' . $item['y_flocculation'];
+			$yeast .= ',"y_attenuation":' . $item['y_attenuation'];
+			$yeast .= ',"y_cells":' . $item['y_cells'];
+			$yeast .= ',"y_inventory":' . $item['y_inventory'];
+			$yeast .= ',"y_use":' . $item['y_use'];
+			$yeast .= ',"y_cost":' . $item['y_cost'] . '}';
+			syslog(LOG_NOTICE, $yeast);
+			$yeasts .= $yeast;
 		}
-		syslog(LOG_NOTICE, "json_yeasts: ". str_replace($rescapers,$rreplacements,json_encode($array)));
-		$sql .= "', json_yeasts='" . str_replace($rescapers,$rreplacements,json_encode($array));
 	}
+	$yeasts .= ']';
+	$sql .= "', json_yeasts='" . $yeasts;
 
 	if (isset($_POST['mashs'])) {
 		$array = $_POST['mashs'];

mercurial