Add custom event handler to be triggered by some actions affecting tickets/quotes/invoices/contacts

This commit is contained in:
wrongecho
2024-10-02 11:26:13 +01:00
parent c352f6e3cb
commit 1c404b9cf1
12 changed files with 161 additions and 17 deletions

View File

@@ -10,7 +10,6 @@ if (isset($_POST['add_contact'])) {
require_once 'post/user/contact_model.php';
// Set password
if (!empty($_POST['contact_password'])) {
$password_hash = password_hash(trim($_POST['contact_password']), PASSWORD_DEFAULT);
@@ -58,6 +57,8 @@ if (isset($_POST['add_contact'])) {
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Contact', log_action = 'Create', log_description = '$session_name created contact $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $contact_id");
customAction('contact_create', $contact_id);
$_SESSION['alert_message'] = "Contact <strong>$name</strong> created";
header("Location: " . $_SERVER["HTTP_REFERER"]);
@@ -173,6 +174,8 @@ if (isset($_POST['edit_contact'])) {
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = '$session_name modified contact $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $contact_id");
customAction('contact_update', $contact_id);
$_SESSION['alert_message'] = "Contact <strong>$name</strong> updated";
header("Location: " . $_SERVER["HTTP_REFERER"]);
@@ -313,6 +316,8 @@ if (isset($_POST['bulk_edit_contact_role'])) {
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = '$session_name updated $contact_name role', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $contact_id");
customAction('contact_update', $contact_id);
} // End Assign Location Loop
$_SESSION['alert_message'] = "You updated roles for <b>$contact_count</b> contacts";