www/includes/db_recipes.php

changeset 559
10cc2400b5d5
parent 394
ccd85f0ed96c
child 565
dfc850e6ee1f
--- a/www/includes/db_recipes.php	Mon Dec 02 20:56:01 2019 +0100
+++ b/www/includes/db_recipes.php	Tue Dec 03 13:36:24 2019 +0100
@@ -285,8 +285,15 @@
 			$yeast .= ',"y_tolerance":' . $item['y_tolerance'];
 			$yeast .= ',"y_inventory":' . $item['y_inventory'];
 			$yeast .= ',"y_use":' . $item['y_use'];
+			$yeast .= ',"y_sta1":' . $item['y_sta1'];
+                        $yeast .= ',"y_bacteria":' . $item['y_bacteria'];
+                        $yeast .= ',"y_harvest_top":' . $item['y_harvest_top'];
+                        $yeast .= ',"y_harvest_time":' . $item['y_harvest_time'];
+                        $yeast .= ',"y_pitch_temperature":' . $item['y_pitch_temperature'];
+                        $yeast .= ',"y_pofpos":' . $item['y_pofpos'];
+                        $yeast .= ',"y_zymocide":' . $item['y_zymocide'];
 			$yeast .= ',"y_cost":' . $item['y_cost'] . '}';
-			syslog(LOG_NOTICE, $yeast);
+			//syslog(LOG_NOTICE, $yeast);
 			$yeasts .= $yeast;
 		}
 	}
@@ -518,7 +525,8 @@
 				$yeasts[$i]['y_avail'] = 0;       // Ingredient not in db
 				if (! isset($yeasts[$i]['y_tolerance']))
 					$yeasts[$i]['y_tolerance'] = 0;
-				$sql2 = "SELECT inventory,tolerance FROM inventory_yeasts ";
+				$sql2 = "SELECT inventory,tolerance,sta1,bacteria,harvest_top,harvest_time,pitch_temperature,pofpos,zymocide ";
+				$sql2 .= "FROM inventory_yeasts ";
 				$sql2 .= "WHERE name='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_name'])."' AND";
 			       	$sql2 .= " form='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_form'])."' AND";
 				$sql2 .= " laboratory='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_laboratory'])."' AND";
@@ -527,9 +535,23 @@
 					if ($obj = mysqli_fetch_object($result2)) {
 						$yeasts[$i]['y_inventory'] = floatval($obj->inventory);
 						$yeasts[$i]['y_avail'] = 1;
-						if ($yeasts[$i]['y_tolerance'] == 0) {
+						if ($yeasts[$i]['y_tolerance'] == 0)
 							$yeasts[$i]['y_tolerance'] = floatval($obj->tolerance); // Upgrade alcohol tolerance
-						}
+						// Upgrade new fields
+                                                if (! isset($yeasts[$i]['y_sta1']))
+                                                        $yeasts[$i]['y_sta1'] = intval($obj->sta1);
+                                                if (! isset($yeasts[$i]['y_bacteria']))
+                                                        $yeasts[$i]['y_bacteria'] = intval($obj->bacteria);
+                                                if (! isset($yeasts[$i]['y_harvest_top']))
+                                                        $yeasts[$i]['y_harvest_top'] = intval($obj->harvest_top);
+                                                if (! isset($yeasts[$i]['y_harvest_time']))
+                                                        $yeasts[$i]['y_harvest_time'] = intval($obj->harvest_time);
+                                                if (! isset($yeasts[$i]['y_pitch_temperature']))
+                                                        $yeasts[$i]['y_pitch_temperature'] = floatval($obj->pitch_temperature);
+                                                if (! isset($yeasts[$i]['y_pofpos']))
+                                                        $yeasts[$i]['y_pofpos'] = intval($obj->pofpos);
+                                                if (! isset($yeasts[$i]['y_zymocide']))
+                                                        $yeasts[$i]['y_zymocide'] = intval($obj->zymocide);
 					}
 					mysqli_free_result($result2);
 				}

mercurial