Added CO2 carbonation log to the products database. Added button in the packaging tab.

Sun, 01 Mar 2020 11:23:22 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 01 Mar 2020 11:23:22 +0100
changeset 615
9034e65b0d7a
parent 614
f51754bce08e
child 616
2cbf21bb9bdc

Added CO2 carbonation log to the products database. Added button in the packaging tab.

www/crontasks.php file | annotate | diff | comparison | revisions
www/includes/db_divides.php file | annotate | diff | comparison | revisions
www/includes/db_product.php file | annotate | diff | comparison | revisions
www/js/prod_divide.js file | annotate | diff | comparison | revisions
www/js/prod_edit.js file | annotate | diff | comparison | revisions
www/js/prod_new.js file | annotate | diff | comparison | revisions
www/prod_duplicate.php file | annotate | diff | comparison | revisions
www/prod_edit.php file | annotate | diff | comparison | revisions
www/rec_toproduct.php file | annotate | diff | comparison | revisions
--- a/www/crontasks.php	Sat Feb 29 15:42:12 2020 +0100
+++ b/www/crontasks.php	Sun Mar 01 11:23:22 2020 +0100
@@ -74,9 +74,9 @@
 
 
 /*
- * Check fementation logs.
+ * Check several logs.
  */
-$query = "SELECT record,code,name,log_brew,log_fermentation,log_ispindel FROM products;";
+$query = "SELECT record,code,name,log_brew,log_fermentation,log_ispindel,log_co2pressure FROM products;";
 $result = mysqli_query($connect, $query);
 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
 	$logfile = "log/fermentation/" . $row['code'] . " " . $row['name'] . ".log";
@@ -99,6 +99,16 @@
                 syslog(LOG_NOTICE, $query);
                 $result1 = mysqli_query($connect, $query);
         }
+	$logfile = "log/co2pressure/" . $row['code'] . " " . $row['name'] . ".log";
+        if (file_exists($logfile))
+                $ok = 1;
+        else
+                $ok = 0;
+        if ($ok != $row['log_co2pressure']) {
+                $query = "UPDATE products SET log_co2pressure='" . $ok . "' WHERE record='" . $row['record'] . "';";
+                syslog(LOG_NOTICE, $query);
+                $result1 = mysqli_query($connect, $query);
+        }
 }
 
 
--- a/www/includes/db_divides.php	Sat Feb 29 15:42:12 2020 +0100
+++ b/www/includes/db_divides.php	Sun Mar 01 11:23:22 2020 +0100
@@ -102,6 +102,7 @@
 	    $sql .= "', log_brew='" . $row['log_brew'];
 	    $sql .= "', log_fermentation='" . $row['log_fermentation'];
 	    $sql .= "', log_ispindel='" . $row['log_ispindel'];
+	    $sql .= "', log_co2pressure='" . $row['log_co2pressure'];
 	    $sql .= "', inventory_reduced='" . $row['inventory_reduced'];;
 	    $sql .= "', locked='" . $row['locked'];;
 	    // Equipment
--- a/www/includes/db_product.php	Sat Feb 29 15:42:12 2020 +0100
+++ b/www/includes/db_product.php	Sun Mar 01 11:23:22 2020 +0100
@@ -41,6 +41,7 @@
 	$sql .= "', log_brew='" . $_POST['log_brew'];
 	$sql .= "', log_fermentation='" . $_POST['log_fermentation'];
 	$sql .= "', log_ispindel='" . $_POST['log_ispindel'];
+	$sql .= "', log_co2pressure='" . $_POST['log_co2pressure'];
 	$sql .= "', inventory_reduced='" . $_POST['inventory_reduced'];
 	$sql .= "', locked='" . $_POST['locked'];
 	// Equipment
@@ -683,6 +684,7 @@
 		$brew .= '","log_brew":' . $row['log_brew'];
 		$brew .= ',"log_fermentation":' . $row['log_fermentation'];
 		$brew .= ',"log_ispindel":' . $row['log_ispindel'];
+		$brew .= ',"log_co2pressure":' . $row['log_co2pressure'];
 		$brew .= ',"inventory_reduced":' . $row['inventory_reduced'];
 		$brew .= ',"locked":' . $row['locked'];
 		$brew .= ',"eq_name":"' . str_replace($escapers, $replacements, $row['eq_name']);
--- a/www/js/prod_divide.js	Sat Feb 29 15:42:12 2020 +0100
+++ b/www/js/prod_divide.js	Sun Mar 01 11:23:22 2020 +0100
@@ -84,6 +84,7 @@
    { name: 'log_brew', type: 'int' },
    { name: 'log_fermentation', type: 'int' },
    { name: 'log_ispindel', type: 'int' },
+   { name: 'log_co2pressure', type: 'int' },
    { name: 'inventory_reduced', type: 'int' },
    { name: 'locked', type: 'int' },
    { name: 'eq_name', type: 'string' },
--- a/www/js/prod_edit.js	Sat Feb 29 15:42:12 2020 +0100
+++ b/www/js/prod_edit.js	Sun Mar 01 11:23:22 2020 +0100
@@ -118,6 +118,7 @@
    { name: 'log_brew', type: 'int' },
    { name: 'log_fermentation', type: 'int' },
    { name: 'log_ispindel', type: 'int' },
+   { name: 'log_co2pressure', type: 'int' },
    { name: 'inventory_reduced', type: 'int' },
    { name: 'locked', type: 'int' },
    { name: 'eq_name', type: 'string' },
@@ -4125,6 +4126,7 @@
   $('#BLog').jqxButton({ disabled: (dataRecord.log_brew) ? false : true});
   $('#FLog').jqxButton({ disabled: (dataRecord.log_fermentation) ? false : true});
   $('#ILog').jqxButton({ disabled: (dataRecord.log_ispindel) ? false : true});
+  $('#CLog').jqxButton({ disabled: (dataRecord.log_co2pressure) ? false : true});
  }
 
  $('#styleSelect').jqxDropDownList({
@@ -4251,6 +4253,7 @@
    log_brew: dataRecord.log_brew,
    log_fermentation: dataRecord.log_fermentation,
    log_ispindel: dataRecord.log_ispindel,
+   log_co2pressure: dataRecord.log_co2pressure,
    inventory_reduced: dataRecord.inventory_reduced,
    locked: dataRecord.locked,
    eq_name: $('#eq_name').val(),
@@ -5993,6 +5996,11 @@
  $('#bottle_priming_amount,#keg_priming_amount,#bottle_priming_total,#bottle_pressure,#keg_priming_total,#keg_pressure').jqxNumberInput(Show1dec);
  $('#bottle_abv,#keg_abv').jqxNumberInput(Show2dec);
  $('#bottle_carbonation_temp,#keg_carbonation_temp').jqxNumberInput(YeastT);
+ $('#CLog').jqxButton({ template: 'info', width: '150px', theme: theme });
+ $('#CLog').click(function() {
+  // Open log in a new tab.
+  window.open('log_co2pressure.php?code=' + dataRecord.code + '&name=' + dataRecord.name);
+ });
 
  // Tab 12, Tasting
  $('#taste_date').jqxTooltip({ content: 'De proef datum van dit bier.' });
--- a/www/js/prod_new.js	Sat Feb 29 15:42:12 2020 +0100
+++ b/www/js/prod_new.js	Sun Mar 01 11:23:22 2020 +0100
@@ -257,6 +257,7 @@
      log_brew: 0,
      log_fermentation: 0,
      log_ispindel: 0,
+     log_co2pressure: 0,
      inventory_reduced: 0,
      locked: 0,
      eq_name: $('#eq_name').val(),
--- a/www/prod_duplicate.php	Sat Feb 29 15:42:12 2020 +0100
+++ b/www/prod_duplicate.php	Sun Mar 01 11:23:22 2020 +0100
@@ -34,6 +34,7 @@
 $sql .= "', log_brew='0";
 $sql .= "', log_fermentation='0";
 $sql .= "', log_ispindel='0";
+$sql .= "', log_co2pressure='0";
 $sql .= "', inventory_reduced='0";
 $sql .= "', locked='0";
 // Equipment
--- a/www/prod_edit.php	Sat Feb 29 15:42:12 2020 +0100
+++ b/www/prod_edit.php	Sun Mar 01 11:23:22 2020 +0100
@@ -844,6 +844,9 @@
         <td align="left" style="vertical-align: top;"><div id="keg_carbonation_temp"></div></td>
        </tr>
       </table>
+      <div style="float: right; margin-top: 20px; margin-bottom: 5px;">
+       <input style="margin-right: 575px;" type="button" id="CLog" value="Hergisting log" />
+      </div>
      </div>
     </div> <!-- Verpakken -->
 
--- a/www/rec_toproduct.php	Sat Feb 29 15:42:12 2020 +0100
+++ b/www/rec_toproduct.php	Sun Mar 01 11:23:22 2020 +0100
@@ -33,7 +33,7 @@
 $sql .= "', birth='" . date("Y-m-d");
 $sql .= "', stage='1";
 $sql .= "', notes='" . mysqli_real_escape_string($link, $row['notes']);
-$sql .= "', log_brew='0', log_fermentation='0', log_ispindel='0', inventory_reduced='0', locked='0";
+$sql .= "', log_brew='0', log_fermentation='0', log_ispindel='0', log_co2pressure='0', inventory_reduced='0', locked='0";
 // Equipment
 $sql .= "', eq_name='Kies zelf een installatie!";
 $sql .= "', eq_boil_size='" . $row['boil_size'];

mercurial