From 726aaac56a0d9958b7ebd70479fd38738ac86eac Mon Sep 17 00:00:00 2001 From: wrongecho Date: Thu, 5 Sep 2024 15:44:06 +0100 Subject: [PATCH] Portal - allow editing client contacts, few tweaks to header incl session notifications --- portal/contact_edit.php | 17 +++++++++++++++++ portal/portal_post.php | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/portal/contact_edit.php b/portal/contact_edit.php index 66646f8c..777337f7 100644 --- a/portal/contact_edit.php +++ b/portal/contact_edit.php @@ -32,6 +32,7 @@ if ($row) { $contact_primary = intval($row['contact_primary']); $contact_technical = intval($row['contact_technical']); $contact_billing = intval($row['contact_billing']); + $contact_auth_method = nullable_htmlentities($row['contact_auth_method']); } else { header("Location: portal_post.php?logout"); exit(); @@ -96,6 +97,22 @@ if ($row) { +
+ +
+
+ +
+ +
+
+ Cannot edit the primary contact"; } else { ?> diff --git a/portal/portal_post.php b/portal/portal_post.php index feb4e437..eff15096 100644 --- a/portal/portal_post.php +++ b/portal/portal_post.php @@ -294,8 +294,9 @@ if (isset($_POST['edit_contact'])) { $contact_email = sanitizeInput($_POST['contact_email']); $contact_technical = intval($_POST['contact_technical']); $contact_billing = intval($_POST['contact_billing']); + $contact_auth_method = sanitizeInput($_POST['contact_auth_method']); - mysqli_query($mysqli, "UPDATE contacts SET contact_name = '$contact_name', contact_email = '$contact_email', contact_billing = $contact_billing, contact_technical = $contact_technical WHERE contact_id = $contact_id AND contact_client_id = $session_client_id AND contact_archived_at IS NULL AND contact_primary = 0"); + mysqli_query($mysqli, "UPDATE contacts SET contact_name = '$contact_name', contact_email = '$contact_email', contact_billing = $contact_billing, contact_technical = $contact_technical, contact_auth_method = '$contact_auth_method' WHERE contact_id = $contact_id AND contact_client_id = $session_client_id AND contact_archived_at IS NULL AND contact_primary = 0"); // Logging mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = 'Client $session_contact_name modified contact $contact_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $session_client_id, log_entity_id = $contact_id");