www/includes/db_product.php

changeset 768
ae1195153fa2
parent 763
12a795e8b568
child 773
f4161330ed01
--- a/www/includes/db_product.php	Sun Jul 04 14:25:52 2021 +0200
+++ b/www/includes/db_product.php	Sun Jul 04 20:01:13 2021 +0200
@@ -280,7 +280,6 @@
 	$sql .= "', divide_factor='" . floatval($_POST['divide_factor']);
 	$sql .= "', divide_parts='" . $_POST['divide_parts'];
 	$sql .= "', divide_part='" . $_POST['divide_part'];
-	//syslog(LOG_NOTICE, $sql);
 
 	$fermentables = '[';
 	$comma = FALSE;
@@ -331,7 +330,6 @@
 		}
 	}
 	$fermentables .= ']';
-	//syslog(LOG_NOTICE, $fermentables);
 	$sql .= "', json_fermentables='" . $fermentables;
 
 	$hops = '[';
@@ -377,7 +375,6 @@
 		}
 	}
 	$hops .= ']';
-	//syslog(LOG_NOTICE, 'hops: ' . $hops);
 	$sql .= "', json_hops='" . $hops;
 
 	$miscs = '[';
@@ -414,7 +411,6 @@
 		}
 	}
 	$miscs .= ']';
-	//syslog(LOG_NOTICE, 'miscs: ' . $miscs);
 	$sql .= "', json_miscs='" . $miscs;
 
 	$yeasts = '[';
@@ -467,7 +463,6 @@
 		}
 	}
 	$yeasts .= ']';
-	//syslog(LOG_NOTICE, $yeasts);
 	$sql .= "', json_yeasts='" . $yeasts;
 
 	$mashs = '[';
@@ -515,7 +510,6 @@
 		}
 	}
 	$mashs .= ']';
-	//syslog(LOG_NOTICE, $mashs);
 	$sql .= "', json_mashs='" . $mashs;
 
 	if (isset($_POST['insert'])) {
@@ -529,14 +523,13 @@
 	if (! $result) {
 		syslog(LOG_NOTICE, "db_product: result: ".mysqli_error($connect));
 		$response['error'] = true;
-		$response['msg'] = "SQL fout: ".mysqli_error($link);
+		$response['msg'] = "SQL fout: ".mysqli_error($connect);
 	} else {
 		if (isset($_POST['update'])) {
 			//syslog(LOG_NOTICE, "db_product: updated record ".$_POST['record']);
 			inventory_reduce();
 		} else {
 			$lastid = mysqli_insert_id($connect);
-			//syslog(LOG_NOTICE, "db_product: inserted record ".$lastid);
 		}
 	}
 	echo json_encode($response);
@@ -556,7 +549,7 @@
         if (! $result) {
 		syslog(LOG_NOTICE, "db_product: result: ".mysqli_error($connect));
 		$response['error'] = true;
-                $response['msg'] = "SQL update fout: ".mysqli_error($link);
+                $response['msg'] = "SQL update fout: ".mysqli_error($connect);
         } else {
                 syslog(LOG_NOTICE, "db_product: updated (divide) record ".$_POST['record']);
 	}
@@ -571,7 +564,7 @@
 	if (! $result) {
 		syslog(LOG_NOTICE, "db_product: ".$sql." result: ".mysqli_error($connect));
 		$response['error'] = true;
-                $response['msg'] = "SQL delete fout: ".mysqli_error($link);
+                $response['msg'] = "SQL delete fout: ".mysqli_error($connect);
 	} else {
 		syslog(LOG_NOTICE, "db_product: deleted product uuid ".$_POST['uuid']);
 	}
@@ -596,8 +589,7 @@
 			);
 		}
 		header("Content-type: application/json");
-		echo json_encode($brews, JSON_UNESCAPED_UNICODE);
-		return;
+		exit(json_encode($brews, JSON_UNESCAPED_UNICODE));
 	}
 
 	if (isset($_GET['select']) && ($_GET['select'] == "archname")) {
@@ -616,8 +608,7 @@
 			);
 		}
 		header("Content-type: application/json");
-	        echo json_encode($brews, JSON_UNESCAPED_UNICODE);
-	        return;
+	        exit(json_encode($brews, JSON_UNESCAPED_UNICODE));
 	}
 
 	if (isset($_GET['select']) && ($_GET['select'] == "archcode")) {
@@ -636,8 +627,7 @@
 			);
 		}
 		header("Content-type: application/json");
-		echo json_encode($brews, JSON_UNESCAPED_UNICODE);
-		return;
+		exit(json_encode($brews, JSON_UNESCAPED_UNICODE));
 	}
 
 	if (isset($_GET['select']) && ($_GET['select'] == "archdate")) {
@@ -657,8 +647,7 @@
 			);
 		}
 		header("Content-type: application/json");
-		echo json_encode($brews, JSON_UNESCAPED_UNICODE);
-		return;
+		exit(json_encode($brews, JSON_UNESCAPED_UNICODE));
 	}
 
 	/*
@@ -690,8 +679,7 @@
 			);
 		}
 		header("Content-type: application/json");
-		echo json_encode($brews, JSON_UNESCAPED_UNICODE);
-		return;
+		exit(json_encode($brews, JSON_UNESCAPED_UNICODE));
 	}
 
 	/*
@@ -1083,12 +1071,11 @@
 		}
 
 		$brew .= '}';
-//		syslog(LOG_NOTICE, $brew);
 		$brews .= $brew;
 	}
 	$brews .= ']';
 	header("Content-type: application/json");
-	echo $brews;
+	exit($brews);
 }
 
 

mercurial