Reduce fermentables after packaging. Always enable the packaging tab but only enable the packaging date in the lagering state. This allows early priming sugar settings.

Fri, 14 Jun 2019 20:19:04 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 14 Jun 2019 20:19:04 +0200
changeset 411
077ada2dda9b
parent 410
72ba4a5e8ebc
child 412
def3900207cc

Reduce fermentables after packaging. Always enable the packaging tab but only enable the packaging date in the lagering state. This allows early priming sugar settings.

www/includes/db_product.php file | annotate | diff | comparison | revisions
www/js/prod_edit.js file | annotate | diff | comparison | revisions
--- a/www/includes/db_product.php	Fri Jun 14 17:08:05 2019 +0200
+++ b/www/includes/db_product.php	Fri Jun 14 20:19:04 2019 +0200
@@ -1054,7 +1054,7 @@
  *  Stage 4+, after primary, reduce sugars(2-fermention), yeasts(0-Primary), miscs(3-primary)
  *  Stage 5+, after secondary, reduce yeasts(1-Secondary)
  *  Stage 6+, after tertiary, reduce sugars(3-lagering), hops(5-dry-hop), yeasts(2-Tertiary), miscs(4-secondary)
- *  Stage 7+, after packaging, reduce sugars(4-bottle), yeasts(3-Bottle), miscs(5-bottling)
+ *  Stage 7+, after packaging, reduce sugars(4-bottle, 5-kegs), yeasts(3-Bottle), miscs(5-bottling)
  */
 function inventory_reduce() {
 
@@ -1254,12 +1254,19 @@
 
     /*
      * After packaging
-     *  reduce sugars(4-bottle), yeasts(3-Bottle), miscs(5-bottling)
+     *  reduce sugars(4/5-bottle), yeasts(3-Bottle), miscs(5-bottling)
      */
     if (($stage >= 6) && ($inventory_reduced < 7)) {
         syslog(LOG_NOTICE, "Reduce Packaging inventory from " . $_POST['code'] . " " . $_POST['name']);
 
-	// Bottle sugar, how?
+	if (isset($_POST['fermentables'])) {
+            $array = $_POST['fermentables'];
+            foreach($array as $key => $item) {
+                if ($item['f_added'] >= 4) {    // Bottling or Kegging
+                    reduce_fermentables($item);
+                }
+            }
+        }
 
 	if (isset($_POST['yeasts'])) {
             $array = $_POST['yeasts'];
--- a/www/js/prod_edit.js	Fri Jun 14 17:08:05 2019 +0200
+++ b/www/js/prod_edit.js	Fri Jun 14 20:19:04 2019 +0200
@@ -2000,10 +2000,11 @@
 			$("#brew_fermenter_extrawater").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
 			$("#brew_aeration_speed").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
 		}
-		if (dataRecord.stage < 5) { // At least secondary
-			$('#jqxTabs').jqxTabs('disableAt', 10);	// Packaging tab
-		} else {
-			$('#jqxTabs').jqxTabs('enableAt', 10);
+		if (dataRecord.stage == 5) // Lagering, allow packaging
+			$("#package_date").jqxDateTimeInput({ disabled: false });
+		else
+			$("#package_date").jqxDateTimeInput({ disabled: true });
+		if (dataRecord.stage >= 5) { // At least secondary
 			$("#primary_start_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
 			$("#primary_max_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
 			$("#primary_end_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });

mercurial