www/prod_torecipe.php

Thu, 05 Dec 2019 22:47:40 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 05 Dec 2019 22:47:40 +0100
changeset 563
acdd54144838
parent 305
bb55e065888a
permissions
-rw-r--r--

Added export inventory and profiles in beerxml format. Small fixes in beerxml recipe and product export.

302
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 <?php
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 require_once('config.php');
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 $link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 if (! $link) {
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 }
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 if (! mysqli_set_charset($link, "utf8" )) {
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 echo "error";
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 return 1;
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 }
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13
305
bb55e065888a Fix escape single quotes
Michiel Broek <mbroek@mbse.eu>
parents: 304
diff changeset
14 $rescapers = array("'");
bb55e065888a Fix escape single quotes
Michiel Broek <mbroek@mbse.eu>
parents: 304
diff changeset
15 $rreplacements = array("\\'");
bb55e065888a Fix escape single quotes
Michiel Broek <mbroek@mbse.eu>
parents: 304
diff changeset
16
302
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 date_default_timezone_set('Europe/Amsterdam');
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 if (isset($_GET["record"]))
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 $record = $_GET["record"];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 else
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 $record = 78;
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 $result = mysqli_query($link, "SELECT * FROM products WHERE record='".$record."'");
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 $row = mysqli_fetch_array($result);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 /*
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 * Make this duplicate a fresh product.
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 */
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 $sql = "INSERT INTO `recipes` SET ";
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 $sql .= "name='" . mysqli_real_escape_string($link, $row['name']) . ' [duplicate]';
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 $sql .= "', uuid='" . str_replace("\n", "", file_get_contents('/proc/sys/kernel/random/uuid'));
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 $sql .= "', notes='" . mysqli_real_escape_string($link, $row['notes']);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 $sql .= "', locked='0";
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 $sql .= "', st_name='" . mysqli_real_escape_string($link, $row['st_name']);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 $sql .= "', st_letter='" . mysqli_real_escape_string($link, $row['st_letter']);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 $sql .= "', st_guide='" . mysqli_real_escape_string($link, $row['st_guide']);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 $sql .= "', st_type='" . $row['st_type'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 $sql .= "', st_category='" . mysqli_real_escape_string($link, $row['st_category']);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 $sql .= "', st_category_number='" . $row['st_category_number'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 $sql .= "', st_og_min='" . $row['st_og_min'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 $sql .= "', st_og_max='" . $row['st_og_max'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 $sql .= "', st_fg_min='" . $row['st_fg_min'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 $sql .= "', st_fg_max='" . $row['st_fg_max'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 $sql .= "', st_ibu_min='" . $row['st_ibu_min'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 $sql .= "', st_ibu_max='" . $row['st_ibu_max'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 $sql .= "', st_color_min='" . $row['st_color_min'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 $sql .= "', st_color_max='" . $row['st_color_max'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 $sql .= "', st_carb_min='" . $row['st_carb_min'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 $sql .= "', st_carb_max='" . $row['st_carb_max'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 $sql .= "', st_abv_min='" . $row['st_abv_min'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 $sql .= "', st_abv_max='" . $row['st_abv_max'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 $sql .= "', type='" . $row['type'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 $sql .= "', batch_size='" . $row['batch_size'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 $sql .= "', boil_size='" . $row['boil_size'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 $sql .= "', boil_time='" . $row['boil_time'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 $sql .= "', efficiency='" . $row['efficiency'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 $sql .= "', est_og='" . $row['est_og'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 $sql .= "', est_fg='0.000";
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 $sql .= "', est_abv='" . $row['est_abv'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 $sql .= "', est_carb='0";
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 $sql .= "', est_color='" . $row['est_color'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 $sql .= "', color_method='" . $row['color_method'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 $sql .= "', est_ibu='" . $row['est_ibu'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 $sql .= "', ibu_method='" . $row['ibu_method'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 $sql .= "', sparge_temp='" . $row['sparge_temp'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 $sql .= "', sparge_ph='" . $row['sparge_ph'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 $sql .= "', sparge_volume='" . $row['sparge_volume'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 $sql .= "', sparge_source='" . $row['sparge_source'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 $sql .= "', sparge_acid_type='" . $row['sparge_acid_type'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 $sql .= "', sparge_acid_perc='" . $row['sparge_acid_perc'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 $sql .= "', sparge_acid_amount='0";
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 $sql .= "', mash_ph='" . $row['mash_ph'];
304
c0ca21cdd291 Fix for recipe to product mash and water.
Michiel Broek <mbroek@mbse.eu>
parents: 302
diff changeset
72 $sql .= "', mash_name='" . mysqli_real_escape_string($link, $row['mash_name']);
302
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 $sql .= "', calc_acid='" . $row['calc_acid'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 $sql .= "', w1_name='" . mysqli_real_escape_string($link, $row['w1_name']);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 $sql .= "', w1_amount='" . $row['w1_amount'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 $sql .= "', w1_calcium='" . $row['w1_calcium'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 $sql .= "', w1_sulfate='" . $row['w1_sulfate'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 $sql .= "', w1_chloride='" . $row['w1_chloride'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 $sql .= "', w1_sodium='" . $row['w1_sodium'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 $sql .= "', w1_magnesium='" . $row['w1_magnesium'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 $sql .= "', w1_total_alkalinity='" . $row['w1_total_alkalinity'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 $sql .= "', w1_ph='" . $row['w1_ph'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 $sql .= "', w1_cost='" . $row['w1_cost'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 $sql .= "', w2_name='" . mysqli_real_escape_string($link, $row['w2_name']);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 $sql .= "', w2_amount='" . $row['w2_amount'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 $sql .= "', w2_calcium='" . $row['w2_calcium'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 $sql .= "', w2_sulfate='" . $row['w2_sulfate'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 $sql .= "', w2_chloride='" . $row['w2_chloride'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 $sql .= "', w2_sodium='" . $row['w2_sodium'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 $sql .= "', w2_magnesium='" . $row['w2_magnesium'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 $sql .= "', w2_total_alkalinity='" . $row['w2_total_alkalinity'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 $sql .= "', w2_ph='" . $row['w2_ph'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 $sql .= "', w2_cost='" . $row['w2_cost'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 $sql .= "', wa_acid_name='" . $row['wa_acid_name'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 $sql .= "', wa_acid_perc='" . $row['wa_acid_perc'];
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 $sql .= "', wa_base_name='" . $row['wa_base_name'];
305
bb55e065888a Fix escape single quotes
Michiel Broek <mbroek@mbse.eu>
parents: 304
diff changeset
97 $sql .= "', json_fermentables='" . str_replace($rescapers,$rreplacements,$row['json_fermentables']);
bb55e065888a Fix escape single quotes
Michiel Broek <mbroek@mbse.eu>
parents: 304
diff changeset
98 $sql .= "', json_hops='" . str_replace($rescapers,$rreplacements,$row['json_hops']);
bb55e065888a Fix escape single quotes
Michiel Broek <mbroek@mbse.eu>
parents: 304
diff changeset
99 $sql .= "', json_miscs='" . str_replace($rescapers,$rreplacements,$row['json_miscs']);
bb55e065888a Fix escape single quotes
Michiel Broek <mbroek@mbse.eu>
parents: 304
diff changeset
100 $sql .= "', json_yeasts='" . str_replace($rescapers,$rreplacements,$row['json_yeasts']);
bb55e065888a Fix escape single quotes
Michiel Broek <mbroek@mbse.eu>
parents: 304
diff changeset
101 $sql .= "', json_mashs='" . str_replace($rescapers,$rreplacements,$row['json_mashs']);
302
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 $sql .= "';";
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 syslog(LOG_NOTICE, $sql);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 $result = mysqli_query($link, $sql);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 if (! $result) {
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 syslog(LOG_NOTICE, "db_recipes: result: ".mysqli_error($link));
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 } else {
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 $lastid = mysqli_insert_id($link);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 syslog(LOG_NOTICE, "db_recipes: inserted record ".$lastid);
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 }
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 echo "<script>window.close();</script>";
d0f7b4ab000f Added product export screen with choices to export to beerxml, duplicate product or copy to recipe. Products in wait state can now be deleted.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 exit;

mercurial