www/getfermentablesources.php

Tue, 31 Aug 2021 20:48:37 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 31 Aug 2021 20:48:37 +0200
changeset 774
92e1e8f175a2
parent 771
9856238e9217
permissions
-rw-r--r--

Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.

57
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 <?php
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 require_once('config.php');
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3
771
9856238e9217 More efficient code for get*sources.php form dropdown lists.
Michiel Broek <mbroek@mbse.eu>
parents: 705
diff changeset
4 $query = "SELECT record,name,type,yield,color,add_after_boil,origin,supplier,coarse_fine_diff,moisture,diastatic_power,protein,dissolved_protein,max_in_batch,recommend_mash,graintype,di_ph,acid_to_ph_57,inventory,cost FROM inventory_fermentables ORDER BY supplier,name";
57
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 $connect = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 if (! $connect) {
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 echo "[]";
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 return;
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 }
705
d77b723f7b35 Make sure enumerated values are not empty in database updates. On several data queries set the database connection to UTF-8.
Michiel Broek <mbroek@mbse.eu>
parents: 296
diff changeset
10 mysqli_set_charset($connect, "utf8");
57
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 $result = mysqli_query($connect, $query);
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
771
9856238e9217 More efficient code for get*sources.php form dropdown lists.
Michiel Broek <mbroek@mbse.eu>
parents: 705
diff changeset
13 $fermentables[] = $row;
57
bb9a06aa9acd Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 }
296
69fadd1aded2 Updated design document. Add content header application/json to all scripts that produce json output. Chart prints show the beer code and name in the header. Charts don't display the menu anymore.
Michiel Broek <mbroek@mbse.eu>
parents: 221
diff changeset
15 header("Content-type: application/json");
221
a8aabb63fbcc Added two missing fields in getfermentablesources.php. When getting a single recipe from the database, update the fermentables json data with available inventory and ingredient. Added inventory column in the fermentable grid. Added ingredient selection in the fermentable popup window to replace ingredient.
Michiel Broek <mbroek@mbse.eu>
parents: 65
diff changeset
16 echo json_encode($fermentables, JSON_UNESCAPED_UNICODE);

mercurial