www/includes/db_product.php

changeset 359
98354ef399cd
parent 332
f0ca77097236
child 375
7f5455806f20
equal deleted inserted replaced
358:3be8c2278fd7 359:98354ef399cd
686 $brew .= ',"sparge_volume":' . floatval($row['sparge_volume']); 686 $brew .= ',"sparge_volume":' . floatval($row['sparge_volume']);
687 $brew .= ',"sparge_source":' . $row['sparge_source']; 687 $brew .= ',"sparge_source":' . $row['sparge_source'];
688 $brew .= ',"sparge_acid_type":' . $row['sparge_acid_type']; 688 $brew .= ',"sparge_acid_type":' . $row['sparge_acid_type'];
689 $brew .= ',"sparge_acid_perc":' . floatval($row['sparge_acid_perc']); 689 $brew .= ',"sparge_acid_perc":' . floatval($row['sparge_acid_perc']);
690 $brew .= ',"sparge_acid_amount":' . floatval($row['sparge_acid_amount']); 690 $brew .= ',"sparge_acid_amount":' . floatval($row['sparge_acid_amount']);
691 $brew .= ',"mash_ph":' . $row['mash_ph']; 691 $brew .= ',"mash_ph":' . floatval($row['mash_ph']);
692 $brew .= ',"mash_name":"' . $row['mash_name']; 692 $brew .= ',"mash_name":"' . str_replace($escapers, $replacements, $row['mash_name']);
693 $brew .= '","calc_acid":' . $row['calc_acid']; 693 $brew .= '","calc_acid":' . $row['calc_acid'];
694 $brew .= ',"w1_name":"' . str_replace($escapers, $replacements, $row['w1_name']); 694 $brew .= ',"w1_name":"' . str_replace($escapers, $replacements, $row['w1_name']);
695 $brew .= '","w1_amount":' . $row['w1_amount']; 695 $brew .= '","w1_amount":' . floatval($row['w1_amount']);
696 $brew .= ',"w1_calcium":' . $row['w1_calcium']; 696 $brew .= ',"w1_calcium":' . floatval($row['w1_calcium']);
697 $brew .= ',"w1_sulfate":' . $row['w1_sulfate']; 697 $brew .= ',"w1_sulfate":' . floatval($row['w1_sulfate']);
698 $brew .= ',"w1_chloride":' . $row['w1_chloride']; 698 $brew .= ',"w1_chloride":' . floatval($row['w1_chloride']);
699 $brew .= ',"w1_sodium":' . $row['w1_sodium']; 699 $brew .= ',"w1_sodium":' . floatval($row['w1_sodium']);
700 $brew .= ',"w1_magnesium":' . $row['w1_magnesium']; 700 $brew .= ',"w1_magnesium":' . floatval($row['w1_magnesium']);
701 $brew .= ',"w1_total_alkalinity":' . $row['w1_total_alkalinity']; 701 $brew .= ',"w1_total_alkalinity":' . floatval($row['w1_total_alkalinity']);
702 $brew .= ',"w1_ph":' . $row['w1_ph']; 702 $brew .= ',"w1_ph":' . floatval($row['w1_ph']);
703 $brew .= ',"w1_cost":' . $row['w1_cost']; 703 $brew .= ',"w1_cost":' . floatval($row['w1_cost']);
704 $brew .= ',"w2_name":"' . str_replace($escapers, $replacements, $row['w2_name']); 704 $brew .= ',"w2_name":"' . str_replace($escapers, $replacements, $row['w2_name']);
705 $brew .= '","w2_amount":' . $row['w2_amount']; 705 $brew .= '","w2_amount":' . floatval($row['w2_amount']);
706 $brew .= ',"w2_calcium":' . $row['w2_calcium']; 706 $brew .= ',"w2_calcium":' . floatval($row['w2_calcium']);
707 $brew .= ',"w2_sulfate":' . $row['w2_sulfate']; 707 $brew .= ',"w2_sulfate":' . floatval($row['w2_sulfate']);
708 $brew .= ',"w2_chloride":' . $row['w2_chloride']; 708 $brew .= ',"w2_chloride":' . floatval($row['w2_chloride']);
709 $brew .= ',"w2_sodium":' . $row['w2_sodium']; 709 $brew .= ',"w2_sodium":' . floatval($row['w2_sodium']);
710 $brew .= ',"w2_magnesium":' . $row['w2_magnesium']; 710 $brew .= ',"w2_magnesium":' . floatval($row['w2_magnesium']);
711 $brew .= ',"w2_total_alkalinity":' . $row['w2_total_alkalinity']; 711 $brew .= ',"w2_total_alkalinity":' . floatval($row['w2_total_alkalinity']);
712 $brew .= ',"w2_ph":' . $row['w2_ph']; 712 $brew .= ',"w2_ph":' . floatval($row['w2_ph']);
713 $brew .= ',"w2_cost":' . $row['w2_cost']; 713 $brew .= ',"w2_cost":' . floatval($row['w2_cost']);
714 $brew .= ',"wa_acid_name":' . $row['wa_acid_name']; 714 $brew .= ',"wa_acid_name":' . $row['wa_acid_name'];
715 $brew .= ',"wa_acid_perc":' . $row['wa_acid_perc']; 715 $brew .= ',"wa_acid_perc":' . $row['wa_acid_perc'];
716 $brew .= ',"wa_base_name":' . $row['wa_base_name']; 716 $brew .= ',"wa_base_name":' . $row['wa_base_name'];
717 $brew .= ',"starter_enable":' . $row['starter_enable']; 717 $brew .= ',"starter_enable":' . $row['starter_enable'];
718 $brew .= ',"starter_type":' . $row['starter_type']; 718 $brew .= ',"starter_type":' . $row['starter_type'];
782 782
783 $yeasts = json_decode($row['json_yeasts'], true); 783 $yeasts = json_decode($row['json_yeasts'], true);
784 for ($i = 0; $i < count($yeasts); $i++) { 784 for ($i = 0; $i < count($yeasts); $i++) {
785 $yeasts[$i]['y_inventory'] = 0; // Not in stock 785 $yeasts[$i]['y_inventory'] = 0; // Not in stock
786 $yeasts[$i]['y_avail'] = 0; // Ingredient not in db 786 $yeasts[$i]['y_avail'] = 0; // Ingredient not in db
787 if (! isset($yeasts[$i]['y_tolerance']))
788 $yeasts[$i]['y_tolerance'] = 0;
787 $sql2 = "SELECT inventory,tolerance FROM inventory_yeasts "; 789 $sql2 = "SELECT inventory,tolerance FROM inventory_yeasts ";
788 $sql2 .= "WHERE name='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_name'])."' AND"; 790 $sql2 .= "WHERE name='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_name'])."' AND";
789 $sql2 .= " form='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_form'])."' AND"; 791 $sql2 .= " form='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_form'])."' AND";
790 $sql2 .= " laboratory='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_laboratory'])."' AND"; 792 $sql2 .= " laboratory='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_laboratory'])."' AND";
791 $sql2 .= " product_id='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_product_id'])."'"; 793 $sql2 .= " product_id='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_product_id'])."'";

mercurial