www/includes/db_product.php

changeset 411
077ada2dda9b
parent 408
a93c9473a7c3
child 419
99a7f2a6976e
--- 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'];

mercurial