|
|
@@ -19,7 +19,7 @@ $csrf = $_SESSION['csrf'];
|
|
|
$accessToken = getenv('HUBSPOT_TOKEN') ?: '';
|
|
|
|
|
|
#$enquiry_date = date("l dS M \'y");
|
|
|
-$drg = isset($_GET['drg']) ? $_GET['drg'] : '';
|
|
|
+$drg = isset($_GET['drg']) ? (int)$_GET['drg'] : 0;
|
|
|
|
|
|
if (!empty($_GET['drg'])) {
|
|
|
include "table.php";
|
|
|
@@ -629,12 +629,12 @@ if (!empty($drg) and !empty($_POST['add_client_to_crm']) and empty($contactId))
|
|
|
|
|
|
if ($createdContact['id'] > 0) {
|
|
|
$crm_id = intval($createdContact['id']);
|
|
|
- $result = mysqli_query($con, "UPDATE details SET crm_id = '{$crm_id}' WHERE drg = '{$drg}'");
|
|
|
+ $result = mysqli_query($con, "UPDATE details SET crm_id = " . (int)$crm_id . " WHERE drg = " . (int)$drg);
|
|
|
if (!$result) {
|
|
|
printf("Error: %s\n", mysqli_error($con));
|
|
|
exit();
|
|
|
} else {
|
|
|
- echo "<div class='container alert alert-success alert-dismissible d-print-none' role='alert'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><h4 style=\"text-align: center;\">Customer: {$_POST['firstname']} {$_POST['lastname']} added to crm, with id: {$crm_id}</h4></div>";
|
|
|
+ echo "<div class='container alert alert-success alert-dismissible d-print-none' role='alert'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><h4 style=\"text-align: center;\">Customer: " . htmlspecialchars($_POST['firstname'], ENT_QUOTES, 'UTF-8') . " " . htmlspecialchars($_POST['lastname'], ENT_QUOTES, 'UTF-8') . " added to crm, with id: " . (int)$crm_id . "</h4></div>";
|
|
|
$isHideDismissableAlert = 1;
|
|
|
}
|
|
|
}
|
|
|
@@ -695,13 +695,13 @@ if (!empty($drg) and !empty($_POST['add_client_to_crm']) and empty($contactId))
|
|
|
|
|
|
if ($response['total'] > 0) {
|
|
|
$response = updateContact($contactId, $data);
|
|
|
- $result = mysqli_query($con, "UPDATE details SET crm_id = '{$response['id']}' WHERE drg = '{$drg}'");
|
|
|
+ $result = mysqli_query($con, "UPDATE details SET crm_id = " . (int)$response['id'] . " WHERE drg = " . (int)$drg);
|
|
|
file_put_contents("crmupdate.log", $response);
|
|
|
|
|
|
$response = json_decode($response, true);
|
|
|
|
|
|
if ($response['id'] > 0) {
|
|
|
- echo "<div class='container alert alert-success alert-dismissible d-print-none' role='alert'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><h4 style=\"text-align: center;\">Customer: {$_POST['firstname']} {$_POST['lastname']} updated in crm</h4></div>";
|
|
|
+ echo "<div class='container alert alert-success alert-dismissible d-print-none' role='alert'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><h4 style=\"text-align: center;\">Customer: " . htmlspecialchars($_POST['firstname'], ENT_QUOTES, 'UTF-8') . " " . htmlspecialchars($_POST['lastname'], ENT_QUOTES, 'UTF-8') . " updated in crm</h4></div>";
|
|
|
$isHideDismissableAlert = 1;
|
|
|
}
|
|
|
} else {
|
|
|
@@ -712,7 +712,7 @@ if (!empty($drg) and !empty($_POST['add_client_to_crm']) and empty($contactId))
|
|
|
if ($createdContact['id'] > 0) {
|
|
|
$crm_id = intval($createdContact['id']);
|
|
|
|
|
|
- echo "<div class='container alert alert-success alert-dismissible d-print-none' role='alert'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><h4 style=\"text-align: center;\">Customer: {$_POST['firstname']} {$_POST['lastname']} added to crm, with id: {$crm_id}</h4></div>";
|
|
|
+ echo "<div class='container alert alert-success alert-dismissible d-print-none' role='alert'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><h4 style=\"text-align: center;\">Customer: " . htmlspecialchars($_POST['firstname'], ENT_QUOTES, 'UTF-8') . " " . htmlspecialchars($_POST['lastname'], ENT_QUOTES, 'UTF-8') . " added to crm, with id: " . (int)$crm_id . "</h4></div>";
|
|
|
$isHideDismissableAlert = 1;
|
|
|
}
|
|
|
}
|
|
|
@@ -770,8 +770,8 @@ if (!empty($quid) and !empty($_POST['add_deal_to_hubspot']) and empty($dealId))
|
|
|
|
|
|
if ($createdDeal['id'] > 0) {
|
|
|
$dealId = intval($createdDeal['id']);
|
|
|
- $result = mysqli_query($con, "UPDATE details SET dealId = '{$dealId}' WHERE drg = '{$drg}'");
|
|
|
- echo "<div class='container alert alert-success alert-dismissible d-print-none' role='alert'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><h4 style=\"text-align: center;\">Deal: {$quid} - {$client} added to hubspot</h4></div>";
|
|
|
+ $result = mysqli_query($con, "UPDATE details SET dealId = " . (int)$dealId . " WHERE drg = " . (int)$drg);
|
|
|
+ echo "<div class='container alert alert-success alert-dismissible d-print-none' role='alert'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><h4 style=\"text-align: center;\">Deal: " . htmlspecialchars((string)$quid, ENT_QUOTES, 'UTF-8') . " - " . htmlspecialchars((string)$client, ENT_QUOTES, 'UTF-8') . " added to hubspot</h4></div>";
|
|
|
$isHideDismissableAlert = 1;
|
|
|
|
|
|
}
|
|
|
@@ -809,7 +809,7 @@ if (!empty($quid) and !empty($_POST['add_deal_to_hubspot']) and empty($dealId))
|
|
|
|
|
|
if ($updatedDeal['id'] > 0) {
|
|
|
$dealId = intval($updatedDeal['id']);
|
|
|
- echo "<div class='container alert alert-success alert-dismissible d-print-none' role='alert'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><h4 style=\"text-align: center;\">Deal: {$quid} - {$client} added to hubspot</h4></div>";
|
|
|
+ echo "<div class='container alert alert-success alert-dismissible d-print-none' role='alert'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><h4 style=\"text-align: center;\">Deal: " . htmlspecialchars((string)$quid, ENT_QUOTES, 'UTF-8') . " - " . htmlspecialchars((string)$client, ENT_QUOTES, 'UTF-8') . " added to hubspot</h4></div>";
|
|
|
$isHideDismissableAlert = 1;
|
|
|
|
|
|
}
|