218 $yeast .= ',"y_attenuation":' . $item['y_attenuation']; |
218 $yeast .= ',"y_attenuation":' . $item['y_attenuation']; |
219 $yeast .= ',"y_cells":' . $item['y_cells']; |
219 $yeast .= ',"y_cells":' . $item['y_cells']; |
220 $yeast .= ',"y_inventory":' . $item['y_inventory']; |
220 $yeast .= ',"y_inventory":' . $item['y_inventory']; |
221 $yeast .= ',"y_use":' . $item['y_use']; |
221 $yeast .= ',"y_use":' . $item['y_use']; |
222 $yeast .= ',"y_cost":' . $item['y_cost'] . '}'; |
222 $yeast .= ',"y_cost":' . $item['y_cost'] . '}'; |
223 syslog(LOG_NOTICE, $yeast); |
223 //syslog(LOG_NOTICE, $yeast); |
224 $yeasts .= $yeast; |
224 $yeasts .= $yeast; |
225 } |
225 } |
226 } |
226 } |
227 $yeasts .= ']'; |
227 $yeasts .= ']'; |
228 $sql .= "', json_yeasts='" . $yeasts; |
228 $sql .= "', json_yeasts='" . $yeasts; |
243 $mash .= ',"step_infuse_amount":0'; |
243 $mash .= ',"step_infuse_amount":0'; |
244 $mash .= ',"step_temp":' . $item['step_temp']; |
244 $mash .= ',"step_temp":' . $item['step_temp']; |
245 $mash .= ',"step_time":' . $item['step_time']; |
245 $mash .= ',"step_time":' . $item['step_time']; |
246 $mash .= ',"ramp_time":' . $item['ramp_time']; |
246 $mash .= ',"ramp_time":' . $item['ramp_time']; |
247 $mash .= ',"end_temp":' . $item['end_temp'] . '}'; |
247 $mash .= ',"end_temp":' . $item['end_temp'] . '}'; |
248 syslog(LOG_NOTICE, $mash); |
248 //syslog(LOG_NOTICE, $mash); |
249 $mashs .= $mash; |
249 $mashs .= $mash; |
250 } |
250 } |
251 } |
251 } |
252 $mashs .= ']'; |
252 $mashs .= ']'; |
253 $sql .= "', json_mashs='" . $mashs; |
253 $sql .= "', json_mashs='" . $mashs; |
403 $hops[$i]['h_avail'] = 1; |
403 $hops[$i]['h_avail'] = 1; |
404 } |
404 } |
405 mysqli_free_result($result2); |
405 mysqli_free_result($result2); |
406 } |
406 } |
407 } |
407 } |
408 // syslog(LOG_NOTICE, json_encode($hops, JSON_UNESCAPED_UNICODE)); |
|
409 $recipes .= ',"hops":' . json_encode($hops, JSON_UNESCAPED_UNICODE); |
408 $recipes .= ',"hops":' . json_encode($hops, JSON_UNESCAPED_UNICODE); |
410 |
409 |
411 $miscs = json_decode($row['json_miscs'], true); |
410 $miscs = json_decode($row['json_miscs'], true); |
412 for ($i = 0; $i < count($miscs); $i++) { |
411 for ($i = 0; $i < count($miscs); $i++) { |
413 $miscs[$i]['m_inventory'] = 0; // Not in stock |
412 $miscs[$i]['m_inventory'] = 0; // Not in stock |
421 $miscs[$i]['m_avail'] = 1; |
420 $miscs[$i]['m_avail'] = 1; |
422 } |
421 } |
423 mysqli_free_result($result2); |
422 mysqli_free_result($result2); |
424 } |
423 } |
425 } |
424 } |
426 // syslog(LOG_NOTICE, json_encode($miscs, JSON_UNESCAPED_UNICODE)); |
|
427 $recipes .= ',"miscs":' . json_encode($miscs, JSON_UNESCAPED_UNICODE); |
425 $recipes .= ',"miscs":' . json_encode($miscs, JSON_UNESCAPED_UNICODE); |
428 |
426 |
429 $yeasts = json_decode($row['json_yeasts'], true); |
427 $yeasts = json_decode($row['json_yeasts'], true); |
430 for ($i = 0; $i < count($yeasts); $i++) { |
428 for ($i = 0; $i < count($yeasts); $i++) { |
431 $yeasts[$i]['y_inventory'] = 0; // Not in stock |
429 $yeasts[$i]['y_inventory'] = 0; // Not in stock |
433 $sql2 = "SELECT inventory FROM inventory_yeasts "; |
431 $sql2 = "SELECT inventory FROM inventory_yeasts "; |
434 $sql2 .= "WHERE name='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_name'])."' AND"; |
432 $sql2 .= "WHERE name='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_name'])."' AND"; |
435 $sql2 .= " form='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_form'])."' AND"; |
433 $sql2 .= " form='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_form'])."' AND"; |
436 $sql2 .= " laboratory='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_laboratory'])."' AND"; |
434 $sql2 .= " laboratory='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_laboratory'])."' AND"; |
437 $sql2 .= " product_id='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_product_id'])."'"; |
435 $sql2 .= " product_id='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_product_id'])."'"; |
438 // syslog(LOG_NOTICE, $sql2); |
|
439 if ($result2 = mysqli_query($connect, $sql2)) { |
436 if ($result2 = mysqli_query($connect, $sql2)) { |
440 if ($obj = mysqli_fetch_object($result2)) { |
437 if ($obj = mysqli_fetch_object($result2)) { |
441 $yeasts[$i]['y_inventory'] = floatval($obj->inventory); |
438 $yeasts[$i]['y_inventory'] = floatval($obj->inventory); |
442 $yeasts[$i]['y_avail'] = 1; |
439 $yeasts[$i]['y_avail'] = 1; |
443 } |
440 } |
444 mysqli_free_result($result2); |
441 mysqli_free_result($result2); |
445 } |
442 } |
446 } |
443 } |
447 // syslog(LOG_NOTICE, json_encode($yeasts, JSON_UNESCAPED_UNICODE)); |
|
448 $recipes .= ',"yeasts":' . json_encode($yeasts, JSON_UNESCAPED_UNICODE); |
444 $recipes .= ',"yeasts":' . json_encode($yeasts, JSON_UNESCAPED_UNICODE); |
449 } else { |
445 } else { |
450 // Just leave it. |
446 // Just leave it. |
451 $recipes .= ',"fermentables":' . $row['json_fermentables']; |
447 $recipes .= ',"fermentables":' . $row['json_fermentables']; |
452 $recipes .= ',"hops":' . $row['json_hops']; |
448 $recipes .= ',"hops":' . $row['json_hops']; |