Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.

Mon, 02 Dec 2019 13:24:34 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 02 Dec 2019 13:24:34 +0100
changeset 554
c62ff53cfc3d
parent 553
481dbe0af222
child 555
7c4f34b7e16f

Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.

www/getyeastsources.php file | annotate | diff | comparison | revisions
www/includes/db_product.php file | annotate | diff | comparison | revisions
www/js/global.js file | annotate | diff | comparison | revisions
www/js/prod_edit.js file | annotate | diff | comparison | revisions
www/prod_checklist.php file | annotate | diff | comparison | revisions
--- a/www/getyeastsources.php	Sun Dec 01 17:37:22 2019 +0100
+++ b/www/getyeastsources.php	Mon Dec 02 13:24:34 2019 +0100
@@ -23,7 +23,14 @@
 		'cells' => $row['cells'],
 		'inventory' => $row['inventory'],
 		'cost' => $row['cost'],
-		'tolerance' => $row['tolerance']
+		'tolerance' => $row['tolerance'],
+		'sta1' => $row['sta1'],
+		'bacteria' => $row['bacteria'],
+		'harvest_top' => $row['harvest_top'],
+		'harvest_time' => $row['harvest_time'],
+		'pitch_temperature' => $row['pitch_temperature'],
+		'pofpos' => $row['pofpos'],
+		'zymocide' => $row['zymocide']
 	);
 }
 header("Content-type: application/json");
--- a/www/includes/db_product.php	Sun Dec 01 17:37:22 2019 +0100
+++ b/www/includes/db_product.php	Mon Dec 02 13:24:34 2019 +0100
@@ -437,6 +437,13 @@
 			$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);
 			$yeasts .= $yeast;
@@ -931,7 +938,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";
@@ -940,9 +948,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);
 				}
--- a/www/js/global.js	Sun Dec 01 17:37:22 2019 +0100
+++ b/www/js/global.js	Mon Dec 02 13:24:34 2019 +0100
@@ -653,7 +653,14 @@
   { name: 'cells', type: 'float' },
   { name: 'inventory', type: 'float' },
   { name: 'cost', type: 'float' },
-  { name: 'tolerance', type: 'float' }
+  { name: 'tolerance', type: 'float' },
+  { name: 'sta1', type: 'int' },
+  { name: 'bacteria', type: 'int' },
+  { name: 'harvest_top', type: 'int' },
+  { name: 'harvest_time', type: 'int' },
+  { name: 'pitch_temperature', type: 'float' },
+  { name: 'pofpos', type: 'int' },
+  { name: 'zymocide', type: 'int' }
  ],
  url: 'getyeastsources.php'
 },
--- a/www/js/prod_edit.js	Sun Dec 01 17:37:22 2019 +0100
+++ b/www/js/prod_edit.js	Mon Dec 02 13:24:34 2019 +0100
@@ -1280,6 +1280,13 @@
     { name: 'y_cells', type: 'float' },
     { name: 'y_tolerance', type: 'float' },
     { name: 'y_inventory', type: 'float' },
+    { name: 'y_sta1', type: 'int' },
+    { name: 'y_bacteria', type: 'int' },
+    { name: 'y_harvest_top', type: 'int' },
+    { name: 'y_harvest_time', type: 'int' },
+    { name: 'y_pitch_temperature', type: 'float' },
+    { name: 'y_pofpos', type: 'int' },
+    { name: 'y_zymocide', type: 'int' },
     { name: 'y_avail', type: 'int' }
    ],
    addrow: function(rowid, rowdata, position, commit) {
@@ -1347,6 +1354,13 @@
       row['y_cells'] = datarecord.cells;
       row['y_tolerance'] = datarecord.tolerance;
       row['y_inventory'] = datarecord.inventory;
+      row['y_sta1'] = datarecord.sta1;
+      row['y_bacteria'] = datarecord.bacteria;
+      row['y_harvest_top'] = datarecord.harvest_top;
+      row['y_harvest_time'] = datarecord.harvest_time;
+      row['y_pitch_temperature'] = datarecord.pitch_temperature;
+      row['y_pofpos'] = datarecord.pofpos;
+      row['y_zymocide'] = datarecord.zymocide;
       $('#yeastGrid').jqxGrid('addrow', null, row);
      }
      calcYeast();
@@ -5269,6 +5283,13 @@
    y_cells: yeastData.y_cells,
    y_tolerance: yeastData.y_tolerance,
    y_inventory: yeastData.y_inventory,
+   y_sta1: yeastData.y_sta1,
+   y_bacteria: yeastData.y_bacteria,
+   y_harvest_top: yeastData.y_harvest_top,
+   y_harvest_time: yeastData.y_harvest_time,
+   y_pitch_temperature: yeastData.y_pitch_temperature,
+   y_pofpos: yeastData.y_pofpos,
+   y_zymocide: yeastData.y_zymocide,
    y_avail: yeastData.y_avail
   };
   $('#yeastGrid').jqxGrid('updaterow', rowID, row);
@@ -5316,6 +5337,13 @@
    yeastData.y_attenuation = datarecord.attenuation;
    yeastData.y_cells = datarecord.cells;
    yeastData.y_inventory = datarecord.inventory;
+   yeastData.y_sta1 = datarecord.sta1;
+   yeastData,y_bacteria = datarecord.bacteria;
+   yeastData.y_harvest_top = datarecord.harvest_top;
+   yeastData.y_harvest_time = datarecord.harvest_time;
+   yeastData.y_pitch_temperature = datarecord.pitch_temperature;
+   yeastData.y_pofpos = datarecord.pofpos;
+   yeastData.y_zymocide = datarecord.zymocide;
    if (yeastData.y_form == 0) {
     $('#wy_pmpt_amount').html('Pak(ken):');
    } else if (yeastData.y_form == 1 || yeastData.y_form == 6) {
--- a/www/prod_checklist.php	Sun Dec 01 17:37:22 2019 +0100
+++ b/www/prod_checklist.php	Mon Dec 02 13:24:34 2019 +0100
@@ -338,6 +338,7 @@
 		else
 			$this->Ln(5);
 
+		$climate = $row['brew_cooling_to'];
 		$this->Checkheader('Gist enten');
 		$dry = 0;
 		foreach ($yeasts as $item) {
@@ -353,6 +354,11 @@
 					$s = sprintf("%.0f",$item['y_amount']*$factor*1000).' ml '.$item['y_product_id'].', '.$item['y_name'].' gist';
 					$this->Checkline($s);
 				}
+				if ($item['y_type'] == 6 && floatval($item['y_pitch_temperature']) > 0) {
+					$s = 'Gist enten bij ' . sprintf("%.1f",floatval($item['y_pitch_temperature'])) . DEG . 'C';
+					$this->Checkline($s);
+					$climate = $item['y_pitch_temperature'];
+				}
 			}
 		}
 		if ($dry > 0) {
@@ -381,7 +387,7 @@
 			$this->Ln(5);
 
 		$this->Checkheader('Vergisting starten');
-		$this->Checkline('klimaatkast instellen op '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C');
+		$this->Checkline('klimaatkast instellen op '.sprintf("%.1f",$climate).' '.DEG.'C');
 
 		/*
 		 * During primary fermentation: fermentables, misc
@@ -427,6 +433,8 @@
                 foreach ($yeasts as $item4) {
                         if ($item4['y_use'] == 1)
 				$lines++;
+			if ($item4['y_harvest_time'] > 0)
+				$lines++;
 		}
 		if ($lines) {
 			if ($this->GetY() > (270 - (5 * $lines)))
@@ -448,6 +456,14 @@
                                         $this->Checkline($s);
                                 }
 			}
+			if ($item4['y_harvest_time'] > 0) {
+				$s = 'Na ' . $item4['y_harvest_time'] . ' uur gist oogsten vanaf de ';
+				if ($item4['y_harvest_top'] > 0)
+					$s .= 'bovenzijde';
+				else
+					$s .= 'bodem';
+				$this->Checkline($s);
+			}
                 }
 		if ($this->Checksplit(5, $row))
 			$factor = 1;

mercurial