www/import/from_brouwhulp.php

changeset 220
14e349ff2a10
parent 217
318aab371497
child 223
0de4455bd2a1
equal deleted inserted replaced
219:4c21eabb3c0e 220:14e349ff2a10
96 if ($fermentable->DISSOLVED_PROTEIN) 96 if ($fermentable->DISSOLVED_PROTEIN)
97 $sql .= "', dissolved_protein='" . floatval($fermentable->DISSOLVED_PROTEIN); 97 $sql .= "', dissolved_protein='" . floatval($fermentable->DISSOLVED_PROTEIN);
98 if ($fermentable->MAX_IN_BATCH) 98 if ($fermentable->MAX_IN_BATCH)
99 $sql .= "', max_in_batch='" . floatval($fermentable->MAX_IN_BATCH); 99 $sql .= "', max_in_batch='" . floatval($fermentable->MAX_IN_BATCH);
100 ($fermentable->RECOMMEND_MASH == "TRUE") ? $sql .= "', recommend_mash='1" : $sql .= "', recommend_mash='0"; 100 ($fermentable->RECOMMEND_MASH == "TRUE") ? $sql .= "', recommend_mash='1" : $sql .= "', recommend_mash='0";
101 if ($fermentable->IBU_GAL_PER_LB)
102 $sql .= "', ibu_gal_per_lb='" . floatval($fermentable->IBU_GAL_PER_LB);
103 ($fermentable->ALWAYS_ON_STOCK == "TRUE") ? $sql .= "', always_on_stock='1" : $sql .= "', always_on_stock='0"; 101 ($fermentable->ALWAYS_ON_STOCK == "TRUE") ? $sql .= "', always_on_stock='1" : $sql .= "', always_on_stock='0";
104 if ($fermentable->INVENTORY) 102 if ($fermentable->INVENTORY)
105 $sql .= "', inventory='" . floatval($fermentable->INVENTORY); 103 $sql .= "', inventory='" . floatval($fermentable->INVENTORY);
106 if ($fermentable->COST) 104 if ($fermentable->COST)
107 $sql .= "', cost='" . floatval($fermentable->COST); 105 $sql .= "', cost='" . floatval($fermentable->COST);
712 $fermentables .= ',"f_origin":"' . mysqli_real_escape_string($db, $fermentable->ORIGIN) . '"'; 710 $fermentables .= ',"f_origin":"' . mysqli_real_escape_string($db, $fermentable->ORIGIN) . '"';
713 $fermentables .= ',"f_supplier":"' . mysqli_real_escape_string($db, $fermentable->SUPPLIER) . '"'; 711 $fermentables .= ',"f_supplier":"' . mysqli_real_escape_string($db, $fermentable->SUPPLIER) . '"';
714 $famount = floatval($fermentable->AMOUNT); 712 $famount = floatval($fermentable->AMOUNT);
715 $fermentables .= ',"f_amount":' . $famount; 713 $fermentables .= ',"f_amount":' . $famount;
716 $fermentables .= ',"f_cost":' . floatval($fermentable->COST); 714 $fermentables .= ',"f_cost":' . floatval($fermentable->COST);
717 $ftype = mysqli_real_escape_string($db, $fermentable->TYPE); 715
718 $fermentables .= ',"f_type":"' . $ftype . '"'; 716 if ($fermentable->TYPE == 'Grain')
717 $fermentables .= ',"f_type":0';
718 else if ($fermentable->TYPE == 'Sugar')
719 $fermentables .= ',"f_type":1';
720 else if ($fermentable->TYPE == 'Extract')
721 $fermentables .= ',"f_type":2';
722 else if ($fermentable->TYPE == 'Dry extract')
723 $fermentables .= ',"f_type":3';
724 else if ($fermentable->TYPE == 'Adjunct')
725 $fermentables .= ',"f_type":4';
726 else
727 echo "Unknown TYPE " . $fermentable->TYPE . PHP_EOL;
728
719 $fyield = floatval($fermentable->YIELD); 729 $fyield = floatval($fermentable->YIELD);
720 $fermentables .= ',"f_yield":' . $fyield; 730 $fermentables .= ',"f_yield":' . $fyield;
721 if ($fermentable->COLOR) { 731 if ($fermentable->COLOR) {
722 $srm = floatval($fermentable->COLOR); 732 $srm = floatval($fermentable->COLOR);
723 $ebc = srm_to_ebc($srm); 733 $ebc = srm_to_ebc($srm);
746 $fermentables .= ',"f_protein":0'; 756 $fermentables .= ',"f_protein":0';
747 if ($fermentable->MAX_IN_BATCH) 757 if ($fermentable->MAX_IN_BATCH)
748 $fermentables .= ',"f_max_in_batch":' . floatval($fermentable->MAX_IN_BATCH); 758 $fermentables .= ',"f_max_in_batch":' . floatval($fermentable->MAX_IN_BATCH);
749 else 759 else
750 $fermentables .= ',"f_max_in_batch":100.0'; 760 $fermentables .= ',"f_max_in_batch":100.0';
751 $fgraintype = mysqli_real_escape_string($db, $fermentable->GRAINTYPE); 761
752 if ($fermentable->GRAINTYPE) 762 if ($fermentable->GRAINTYPE == 'Base')
753 $fgraintype = mysqli_real_escape_string($db, $fermentable->GRAINTYPE); 763 $fermentables .= ',"f_graintype":0';
754 else 764 else if ($fermentable->GRAINTYPE == 'Roast')
755 $fgraintype = "Base"; 765 $fermentables .= ',"f_graintype":1';
756 $fermentables .= ',"f_graintype":"' . $fgraintype . '"'; 766 else if ($fermentable->GRAINTYPE == 'Crystal')
757 if ($fermentable->ADDED) 767 $fermentables .= ',"f_graintype":2';
758 $fadded = mysqli_real_escape_string($db, $fermentable->ADDED); 768 else if ($fermentable->GRAINTYPE == 'Kilned')
759 else 769 $fermentables .= ',"f_graintype":3';
760 $fadded = "Mash"; 770 else if ($fermentable->GRAINTYPE == 'Sour malt')
761 $fermentables .= ',"f_added":"'.$fadded.'"'; 771 $fermentables .= ',"f_graintype":4';
772 else if ($fermentable->GRAINTYPE == 'Special')
773 $fermentables .= ',"f_graintype":5';
774 else if ($fermentable->GRAINTYPE == 'No malt')
775 $fermentables .= ',"f_graintype":6';
776 else
777 echo "Unknown GRAINTYPE " . $fermentable->GRAINTYPE . PHP_EOL;
778
779 if ($fermentable->ADDED == 'Mash')
780 $fermentables .= ',"f_added":0';
781 else if ($fermentable->ADDED == 'Boil')
782 $fermentables .= ',"f_added":1';
783 else if ($fermentable->ADDED == 'Fermentation')
784 $fermentables .= ',"f_added":2';
785 else if ($fermentable->ADDED == 'Lagering')
786 $fermentables .= ',"f_added":3';
787 else if ($fermentable->ADDED == 'Bottle')
788 $fermentables .= ',"f_added":4';
789 else
790 echo "Unknown ADDED " . $fermentable->ADDED . PHP_EOL;
791
762 ($fermentable->ADD_AFTER_BOIL== "TRUE") ? $fermentables .= ',"f_add_after_boil":1' : $fermentables .= ',"f_add_after_boil":0'; 792 ($fermentable->ADD_AFTER_BOIL== "TRUE") ? $fermentables .= ',"f_add_after_boil":1' : $fermentables .= ',"f_add_after_boil":0';
763 ($fermentable->RECOMMEND_MASH== "TRUE") ? $fermentables .= ',"f_recommend_mash":1' : $fermentables .= ',"f_recommend_mash":0'; 793 ($fermentable->RECOMMEND_MASH== "TRUE") ? $fermentables .= ',"f_recommend_mash":1' : $fermentables .= ',"f_recommend_mash":0';
764 if ($fermentable->DISSOLVED_PROTEIN) 794 if ($fermentable->DISSOLVED_PROTEIN)
765 $fermentables .= ',"f_dissolved_protein":' . floatval($fermentable->DISSOLVED_PROTEIN); 795 $fermentables .= ',"f_dissolved_protein":' . floatval($fermentable->DISSOLVED_PROTEIN);
766 else 796 else
777 else 807 else
778 $fermentables .= ',"f_acid_to_ph_57":0.0'; 808 $fermentables .= ',"f_acid_to_ph_57":0.0';
779 $fermentables .= "}"; 809 $fermentables .= "}";
780 /* Sugars */ 810 /* Sugars */
781 $d = $famount * ($fyield / 100) * (1 - $fmoisture / 100); 811 $d = $famount * ($fyield / 100) * (1 - $fmoisture / 100);
782 if ($fadded == "Mash") 812 if ($fermentable->ADDED == 'Mash')
783 $d = floatval($efficiency) / 100 * $d; 813 $d = floatval($efficiency) / 100 * $d;
784 $f_sugars += $d; 814 $f_sugars += $d;
785 if ($fgraintype == "Crystal") 815 if ($fermentable->GRAINTYPE == 'Crystal')
786 $pCara += $percent; 816 $pCara += $percent;
787 if ($ftype == "Sugar") 817 if ($fermentable->TYPE == 'Sugar')
788 $pSugar += $percent; 818 $pSugar += $percent;
789 } 819 }
790 $fermentables .= ']'; 820 $fermentables .= ']';
791 return $fermentables; 821 return $fermentables;
792 } 822 }
802 $hops .= ','; 832 $hops .= ',';
803 $comma = TRUE; 833 $comma = TRUE;
804 $hops .= '{"h_name":"' . mysqli_real_escape_string($db, $hop->NAME) . '"'; 834 $hops .= '{"h_name":"' . mysqli_real_escape_string($db, $hop->NAME) . '"';
805 $hops .= ',"h_amount":' . floatval($hop->AMOUNT); 835 $hops .= ',"h_amount":' . floatval($hop->AMOUNT);
806 $hops .= ',"h_cost":' . floatval($hop->COST); 836 $hops .= ',"h_cost":' . floatval($hop->COST);
807 $hops .= ',"h_type":"' . mysqli_real_escape_string($db, $hop->TYPE) . '"'; 837
808 $hops .= ',"h_form":"' . mysqli_real_escape_string($db, $hop->FORM) . '"'; 838 if ($hop->TYPE == 'Bittering')
809 $hops .= ',"h_useat":"' . mysqli_real_escape_string($db, $hop->USE) . '"'; 839 $hops .= ',"h_type":0';
840 else if ($hop->TYPE == 'Aroma')
841 $hops .= ',"h_type":1';
842 else if ($hop->TYPE == 'Both')
843 $hops .= ',"h_type":2';
844 else
845 echo "Unknown TYPE " . $hop->TYPE . PHP_EOL;
846
847 if ($hop->FORM == 'Pellet')
848 $hops .= ',"h_form":0';
849 else if ($hop->FORM == 'Plug')
850 $hops .= ',"h_form":1';
851 else if ($hop->FORM == 'Leaf')
852 $hops .= ',"h_form":2';
853 else
854 echo "Unknown FORM " . $hop->FORM . PHP_EOL;
855
856 if ($hop->USE == 'Mash')
857 $hops .= ',"h_useat":0';
858 else if ($hop->USE == 'First wort')
859 $hops .= ',"h_useat":1';
860 else if ($hop->USE == 'Boil')
861 $hops .= ',"h_useat":2';
862 else if ($hop->USE == 'Aroma')
863 $hops .= ',"h_useat":3';
864 else if ($hop->USE == 'Whirlpool')
865 $hops .= ',"h_useat":4';
866 else if ($hop->USE == 'Dry hop')
867 $hops .= ',"h_useat":5';
868 else
869 echo "Unknown USE " . $hop->USE . PHP_EOL;
810 if ($hop->TIME) 870 if ($hop->TIME)
811 $hops .= ',"h_time":' . floatval($hop->TIME); 871 $hops .= ',"h_time":' . floatval($hop->TIME);
812 else 872 else
813 $hops .= ',"h_time":0'; 873 $hops .= ',"h_time":0';
814 $hops .= ',"h_alpha":' . floatval($hop->ALPHA); 874 $hops .= ',"h_alpha":' . floatval($hop->ALPHA);
853 $miscs .= ',"m_cost":'. get_miscs_cost($mname); 913 $miscs .= ',"m_cost":'. get_miscs_cost($mname);
854 } else { 914 } else {
855 $miscs .= ',"m_cost":0'; 915 $miscs .= ',"m_cost":0';
856 } 916 }
857 } 917 }
858 $miscs .= ',"m_type":"' . mysqli_real_escape_string($db, $misc->TYPE) . '"'; 918
859 $miscs .= ',"m_use_use":"' . mysqli_real_escape_string($db, $misc->USE) . '"'; 919 if ($misc->TYPE == 'Spice')
920 $miscs .= ',"m_type":0';
921 else if ($misc->TYPE == 'Herb')
922 $miscs .= ',"m_type":1';
923 else if ($misc->TYPE == 'Flavor')
924 $miscs .= ',"m_type":2';
925 else if ($misc->TYPE == 'Fining')
926 $miscs .= ',"m_type":3';
927 else if ($misc->TYPE == 'Water agent')
928 $miscs .= ',"m_type":4';
929 else if ($misc->TYPE == 'Yeast nutrient')
930 $miscs .= ',"m_type":5';
931 else if ($misc->TYPE == 'Other')
932 $miscs .= ',"m_type":6';
933 else
934 echo "Unknown TYPE " . $misc->TYPE . PHP_EOL;
935
936 if ($misc->USE == 'Starter')
937 $miscs .= ',"m_use_use":0';
938 else if ($misc->USE == 'Mash')
939 $miscs .= ',"m_use_use":1';
940 else if ($misc->USE == 'Boil')
941 $miscs .= ',"m_use_use":2';
942 else if ($misc->USE == 'Primary')
943 $miscs .= ',"m_use_use":3';
944 else if ($misc->USE == 'Secondary')
945 $miscs .= ',"m_use_use":4';
946 else if ($misc->USE == 'Bottling')
947 $miscs .= ',"m_use_use":5';
948 else
949 echo "Unknown USE " . $misc->USE . PHP_EOL;
950
860 ($misc->AMOUNT_IS_WEIGHT== "TRUE") ? $miscs .= ',"m_amount_is_weight":1' : $miscs.= ',"m_amount_is_weight":0'; 951 ($misc->AMOUNT_IS_WEIGHT== "TRUE") ? $miscs .= ',"m_amount_is_weight":1' : $miscs.= ',"m_amount_is_weight":0';
861 if ($misc->TIME) { 952 if ($misc->TIME) {
862 if (mysqli_real_escape_string($db, $misc->USE) == "Secondary") 953 $miscs .= ',"m_time":' . floatval($misc->TIME);
863 $miscs .= ',"m_time":' . floatval($misc->TIME) / 1440;
864 else
865 $miscs .= ',"m_time":' . floatval($misc->TIME);
866 } else 954 } else
867 $miscs .= ',"m_time":0'; 955 $miscs .= ',"m_time":0';
868 $miscs .= "}"; 956 $miscs .= "}";
869 } 957 }
870 $miscs .= ']'; 958 $miscs .= ']';
892 } 980 }
893 } else 981 } else
894 $yeasts .= ',"y_cost":0'; 982 $yeasts .= ',"y_cost":0';
895 $yeasts .= ',"y_laboratory":"' . mysqli_real_escape_string($db, $yeast->LABORATORY) . '"'; 983 $yeasts .= ',"y_laboratory":"' . mysqli_real_escape_string($db, $yeast->LABORATORY) . '"';
896 $yeasts .= ',"y_product_id":"' . mysqli_real_escape_string($db, $yeast->PRODUCT_ID) . '"'; 984 $yeasts .= ',"y_product_id":"' . mysqli_real_escape_string($db, $yeast->PRODUCT_ID) . '"';
897 $yeasts .= ',"y_type":"' . mysqli_real_escape_string($db, $yeast->TYPE) . '"'; 985
898 $yeasts .= ',"y_form":"' . mysqli_real_escape_string($db, $yeast->FORM) . '"'; 986 if ($yeast->TYPE == 'Lager')
987 $yeasts .= ',"y_type":0';
988 else if ($yeast->TYPE == 'Ale')
989 $yeasts .= ',"y_type":1';
990 else if ($yeast->TYPE == 'Wheat')
991 $yeasts .= ',"y_type":2';
992 else if ($yeast->TYPE == 'Wine')
993 $yeasts .= ',"y_type":3';
994 else if ($yeast->TYPE == 'Champagne')
995 $yeasts .= ',"y_type":4';
996 else
997 echo "Unknown TYPE " . $yeast->TYPE . PHP_EOL;
998
999 if ($yeast->FORM == 'Liquid') {
1000 if ($yeast->LABORATORY == 'Imperial Yeast')
1001 $yeasts .= ',"y_form":0,"y_cells":200000000000';
1002 else
1003 $yeasts .= ',"y_form":0,"y_cells":100000000000';
1004 } else if ($yeast->FORM == 'Dry')
1005 $yeasts .= ',"y_form":1,"y_cells":15000000000';
1006 else if ($yeast->FORM == 'Slant')
1007 $yeasts .= ',"y_form":2,"y_cells":1700000000';
1008 else if ($yeast->FORM == 'Culture')
1009 $yeasts .= ',"y_form":3,"y_cells":1700000000';
1010 else if ($yeast->FORM == 'Frozen')
1011 $yeasts .= ',"y_form":4,"y_cells":1700000000';
1012 else if ($yeast->FORM == 'Bottle')
1013 $yeasts .= ',"y_form":5,"y_cells":1700000000';
1014 else
1015 echo "Unknown FORM " . $yeast->FORM . PHP_EOL;
1016
899 ($yeast->AMOUNT_IS_WEIGHT== "TRUE") ? $yeasts .= ',"y_amount_is_weight":1' : $yeasts.= ',"y_amount_is_weight":0'; 1017 ($yeast->AMOUNT_IS_WEIGHT== "TRUE") ? $yeasts .= ',"y_amount_is_weight":1' : $yeasts.= ',"y_amount_is_weight":0';
900 if ($yeast->ADD_TO_SECONDARY=="FALSE") { 1018 if ($yeast->ADD_TO_SECONDARY=="FALSE") {
901 $yeasts .= ',"y_use":"Primary"'; 1019 $yeasts .= ',"y_use":0'; // Primary
902 $svg = floatval($yeast->ATTENUATION); 1020 $svg = floatval($yeast->ATTENUATION);
903 } else if ($yeast->PRODUCT_ID=="F2") { 1021 } else if ($yeast->PRODUCT_ID=="F2") {
904 $yeasts .= ',"y_use":"Bottle"'; 1022 $yeasts .= ',"y_use":3'; // Bottle
905 } else { 1023 } else {
906 $yeasts .= ',"y_use":"Secondary"'; 1024 $yeasts .= ',"y_use":1'; // Secondary
907 } 1025 }
908 $yeasts .= ',"y_min_temperature":' . floatval($yeast->MIN_TEMPERATURE); 1026 $yeasts .= ',"y_min_temperature":' . floatval($yeast->MIN_TEMPERATURE);
909 $yeasts .= ',"y_max_temperature":' . floatval($yeast->MAX_TEMPERATURE); 1027 $yeasts .= ',"y_max_temperature":' . floatval($yeast->MAX_TEMPERATURE);
910 $yeasts .= ',"y_attenuation":' . floatval($yeast->ATTENUATION); 1028 $yeasts .= ',"y_attenuation":' . floatval($yeast->ATTENUATION);
911 $yeasts .= "}"; 1029 $yeasts .= "}";
942 $waters .= "', w" . $index . "_cost='0"; 1060 $waters .= "', w" . $index . "_cost='0";
943 } 1061 }
944 return $waters; 1062 return $waters;
945 } 1063 }
946 1064
1065
1066
947 function recipe_mash_steps($recipe) 1067 function recipe_mash_steps($recipe)
948 { 1068 {
949 global $db; 1069 global $db;
950 1070
951 $steps = '['; 1071 $steps = '[';
953 foreach ($recipe->MASH->MASH_STEPS->MASH_STEP as $step) { 1073 foreach ($recipe->MASH->MASH_STEPS->MASH_STEP as $step) {
954 if ($comma) 1074 if ($comma)
955 $steps .= ','; 1075 $steps .= ',';
956 $comma = TRUE; 1076 $comma = TRUE;
957 $steps .= '{"step_name":"' . mysqli_real_escape_string($db, $step->NAME) . '"'; 1077 $steps .= '{"step_name":"' . mysqli_real_escape_string($db, $step->NAME) . '"';
958 if ($step->TYPE) 1078
959 $steps .= ',"step_type":"' . $step->TYPE . '"'; 1079 if ($step->TYPE == 'Infusion')
1080 $steps .= ',"step_type":0';
1081 else if ($step->TYPE == 'Temperature')
1082 $steps .= ',"step_type":1';
1083 else if ($step->TYPE == 'Decoction')
1084 $steps .= ',"step_type":2';
1085 else
1086 echo "Unknown step TYPE " . $step->TYPE . PHP_EOL;
1087
960 if ($step->INFUSE_AMOUNT) 1088 if ($step->INFUSE_AMOUNT)
961 $steps .= ',"step_infuse_amount":"' . floatval($step->INFUSE_AMOUNT) . '"'; 1089 $steps .= ',"step_infuse_amount":"' . floatval($step->INFUSE_AMOUNT) . '"';
962 if ($step->STEP_TEMP) 1090 if ($step->STEP_TEMP)
963 $steps .= ',"step_temp":"' . floatval($step->STEP_TEMP) . '"'; 1091 $steps .= ',"step_temp":"' . floatval($step->STEP_TEMP) . '"';
964 if ($step->STEP_TIME) 1092 if ($step->STEP_TIME)
1008 $sql .= "', locked='0"; 1136 $sql .= "', locked='0";
1009 if ($recipe->NOTES) 1137 if ($recipe->NOTES)
1010 $sql .= "', notes='" . mysqli_real_escape_string($db, $recipe->NOTES); 1138 $sql .= "', notes='" . mysqli_real_escape_string($db, $recipe->NOTES);
1011 else 1139 else
1012 $sql .= "', notes='"; 1140 $sql .= "', notes='";
1013 if ($recipe->TYPE) 1141
1014 $sql .= "', type='" . mysqli_real_escape_string($db, $recipe->TYPE); 1142 if ($recipe->TYPE == 'Extract')
1015 else 1143 $sql .= "', type='0";
1016 $sql .= "', type='"; 1144 else if ($recipe->TYPE == 'Partial Mash')
1145 $sql .= "', type='1";
1146 else if ($recipe->TYPE == 'All Grain')
1147 $sql .= "', type='2";
1148 else
1149 echo "Unknown TYPE " . $recipe->TYPE . PHP_EOL;
1150
1017 if ($recipe->BATCH_SIZE) 1151 if ($recipe->BATCH_SIZE)
1018 $batch_size = floatval($recipe->BATCH_SIZE); 1152 $batch_size = floatval($recipe->BATCH_SIZE);
1019 $sql .= "', batch_size='" . $batch_size; 1153 $sql .= "', batch_size='" . $batch_size;
1020 if ($recipe->BOIL_SIZE) 1154 if ($recipe->BOIL_SIZE)
1021 $boil_size = floatval($recipe->BOIL_SIZE); 1155 $boil_size = floatval($recipe->BOIL_SIZE);
1028 $efficiency = floatval($recipe->EFFICIENCY); 1162 $efficiency = floatval($recipe->EFFICIENCY);
1029 $sql .= "', efficiency='" . $efficiency; 1163 $sql .= "', efficiency='" . $efficiency;
1030 /* Don't use $recipe->EST_OG but recalculate it */ 1164 /* Don't use $recipe->EST_OG but recalculate it */
1031 /* Don't use $recipe->EST_FG but recalculate it */ 1165 /* Don't use $recipe->EST_FG but recalculate it */
1032 /* Don't use $recipe->EST_COLOR but recalculate it */ 1166 /* Don't use $recipe->EST_COLOR but recalculate it */
1033 if ($recipe->COLOR_METHOD) 1167 if ($recipe->COLOR_METHOD == 'Morey')
1034 $sql .= "', color_method='" . mysqli_real_escape_string($db, $recipe->COLOR_METHOD); 1168 $sql .= "', color_method='0";
1169 else if ($recipe->COLOR_METHOD == 'Mosher')
1170 $sql .= "', color_method='1";
1171 else if ($recipe->COLOR_METHOD == 'Daniels')
1172 $sql .= "', color_method='2";
1173 else
1174 echo "Unknown COLOR_METHO " . $recipe->COLOR_METHOD . PHP_EOL;
1175
1035 if ($recipe->IBU) 1176 if ($recipe->IBU)
1036 $sql .= "', est_ibu='" . floatval($recipe->IBU); 1177 $sql .= "', est_ibu='" . floatval($recipe->IBU);
1037 if ($recipe->IBU_METHOD) 1178 if ($recipe->IBU_METHOD == 'Tinseth')
1038 $sql .= "', ibu_method='" . mysqli_real_escape_string($db, $recipe->IBU_METHOD); 1179 $sql .= "', ibu_method='0";
1180 else if ($recipe->IBU_METHOD == 'Rager')
1181 $sql .= "', ibu_method='1";
1182 else if ($recipe->IBU_METHOD == 'Daniels')
1183 $sql .= "', ibu_method='2";
1184 else
1185 echo "Unknown IBU_METHOD " . $recipe->IBU_METHOD . PHP_EOL;
1186
1039 if ($recipe->CARBONATION) 1187 if ($recipe->CARBONATION)
1040 $sql .= "', est_carb='" . floatval($recipe->CARBONATION); 1188 $sql .= "', est_carb='" . floatval($recipe->CARBONATION);
1041 1189
1042 if ($recipe->STYLE) { 1190 if ($recipe->STYLE) {
1043 $sql .= recipe_style($recipe); 1191 $sql .= recipe_style($recipe);
1047 } 1195 }
1048 if ($recipe->TARGET_PH) { 1196 if ($recipe->TARGET_PH) {
1049 $sql .= "', mash_ph='" . floatval($recipe->TARGET_PH); 1197 $sql .= "', mash_ph='" . floatval($recipe->TARGET_PH);
1050 } 1198 }
1051 if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Lactic")) { 1199 if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Lactic")) {
1052 $sql .= "', sparge_acid_type='Melkzuur"; 1200 $sql .= "', sparge_acid_type='0";
1053 } else if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Hydrochloric")) { 1201 } else if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Hydrochloric")) {
1054 $sql .= "', sparge_acid_type='Zoutzuur"; 1202 $sql .= "', sparge_acid_type='1";
1055 } else if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Phosphoric")) { 1203 } else if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Phosphoric")) {
1056 $sql .= "', sparge_acid_type='Fosforzuur"; 1204 $sql .= "', sparge_acid_type='2";
1057 } else if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Sulfuric")) { 1205 } else if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Sulfuric")) {
1058 $sql .= "', sparge_acid_type='Zwavelzuur"; 1206 $sql .= "', sparge_acid_type='3";
1059 } 1207 }
1060 if ($recipe->ACID_SPARGE_PERC) { 1208 if ($recipe->ACID_SPARGE_PERC) {
1061 $sql .= "', sparge_acid_perc='" . floatval($recipe->ACID_SPARGE_PERC); 1209 $sql .= "', sparge_acid_perc='" . floatval($recipe->ACID_SPARGE_PERC);
1062 } 1210 }
1063 if ($recipe->LACTIC_SPARGE) { 1211 if ($recipe->LACTIC_SPARGE) {

mercurial