Removed Recently viewed under client overview viewed feature is not currently implemented, Primary Billing and Technical now show up under imporetant contacts under client overview tweaked some alert feed backs and logging

This commit is contained in:
johnnyq 2023-01-30 13:21:12 -05:00
parent 4cb437dc83
commit 139328ae65
4 changed files with 12 additions and 61 deletions

View File

@ -16,7 +16,7 @@
<?php echo CURRENT_DATABASE_VERSION; ?>
<br>
<?php echo randomString(); ?>
<?php echo randomString(100); ?>
<br>
<script>toastr.success('Have Fun Wozz!!')</script>

View File

@ -2,7 +2,7 @@
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL AND contacts.company_id = $session_company_id ORDER BY contact_updated_at, contact_created_at DESC LIMIT 5");
$sql_important_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_important = 1 AND contact_archived_at IS NULL AND contacts.company_id = $session_company_id ORDER BY contact_updated_at, contact_name DESC");
$sql_important_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND (contact_important = 1 OR contact_billing = 1 OR contact_technical = 1 OR contact_id = $primary_contact) AND contact_archived_at IS NULL AND contacts.company_id = $session_company_id ORDER BY contact_name DESC");
$sql_vendors = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_client_id = $client_id AND vendor_template = 0 AND vendor_archived_at IS NULL AND company_id = $session_company_id ORDER BY vendor_updated_at DESC LIMIT 5");
@ -138,55 +138,6 @@ $sql_domains_expiring = mysqli_query($mysqli, "SELECT * FROM domains
</div>
<?php } ?>
<?php if (mysqli_num_rows($sql_contacts) > 0 || mysqli_num_rows($sql_vendors) > 0) { ?>
<div class="col-md-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h5 class="card-title"><i class="fa fa-fw fa-eye mr-2"></i>Recently Viewed</h5>
</div>
<div class="card-body">
<?php
while ($row = mysqli_fetch_array($sql_contacts)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
$contact_updated_at = $row['contact_updated_at'];
?>
<p class="mb-1">
<i class="fa fa-fw fa-user text-secondary mr-1"></i>
<a href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>"><?php echo $contact_name; ?></a>
</p>
<?php
}
?>
<?php
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
$vendor_updated_at = $row['vendor_updated_at'];
?>
<p class="mb-1">
<i class="fas fa-fw fa-building text-secondary mr-1"></i>
<a href="client_vendors.php?client_id=<?php echo $client_id; ?>&q=<?php echo $vendor_name; ?>"><?php echo $vendor_name; ?></a></td>
</p>
<?php
}
?>
</div>
</div>
</div>
<?php } ?>
<?php
if (mysqli_num_rows($sql_domains_expiring) > 0
|| mysqli_num_rows($sql_asset_warranties_expiring) > 0

View File

@ -93,7 +93,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
// Get Login
$login_id = $row['login_id'];
$login_username = htmlentities($row['login_username']);
$login_username = htmlentities(decryptLoginEntry($row['login_username']));
$login_password = htmlentities(decryptLoginEntry($row['login_password']));
$seat_count = 0;

View File

@ -4299,17 +4299,17 @@ if(isset($_POST['add_contact'])){
mysqli_query($mysqli,"UPDATE contacts SET contact_photo = '$new_file_name' WHERE contact_id = $contact_id");
$_SESSION['alert_message'] = 'File successfully uploaded.';
$_SESSION['alert_message'] = 'Photo successfully uploaded. ';
}else{
$_SESSION['alert_message'] = 'There was an error moving the file to upload directory. Please make sure the upload directory is writable by web server.';
$_SESSION['alert_message'] = 'There was an error moving the photo to the upload directory. Please make sure the upload directory is writable by web server.';
}
}
//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, company_id = $session_company_id");
$_SESSION['alert_message'] .= "Contact added";
$_SESSION['alert_message'] .= "Contact <strong>$name</strong> created";
header("Location: " . $_SERVER["HTTP_REFERER"]);
@ -4416,17 +4416,17 @@ if(isset($_POST['edit_contact'])){
mysqli_query($mysqli,"UPDATE contacts SET contact_photo = '$new_file_name' WHERE contact_id = $contact_id");
$_SESSION['alert_message'] = 'File successfully uploaded.';
$_SESSION['alert_message'] = 'Photo successfully uploaded. ';
}else{
$_SESSION['alert_message'] = 'There was an error moving the file to upload directory. Please make sure the upload directory is writable by web server.';
$_SESSION['alert_message'] = 'There was an error moving the photo to the upload directory. Please make sure the upload directory is writable by web server. ';
}
}
//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, company_id = $session_company_id");
$_SESSION['alert_message'] .= "Contact updated";
$_SESSION['alert_message'] .= "Contact <strong>$name</strong> updated";
header("Location: " . $_SERVER["HTTP_REFERER"]);
@ -4450,7 +4450,7 @@ if(isset($_GET['archive_contact'])){
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Contact', log_action = 'Archive', log_description = '$session_name archived contact $contact_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, company_id = $session_company_id");
$_SESSION['alert_type'] = "error";
$_SESSION['alert_message'] = "Contact ".htmlentities($contact_name)." archived. <a href='post.php?undo_archive_location=$location_id'>Undo</a>";
$_SESSION['alert_message'] = "Contact <strong>$contact_name</strong> archived.<br><a class='text-white text-bold' href='post.php?undo_archive_contact=$contact_id'>Undo</a>";
header("Location: " . $_SERVER["HTTP_REFERER"]);
@ -4466,7 +4466,7 @@ if(isset($_GET['delete_contact'])){
$sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id FROM contacts WHERE contact_id = $contact_id AND company_id = $session_company_id");
$row = mysqli_fetch_array($sql);
$contact_name = strip_tags(mysqli_real_escape_string($mysqli, $row['contact_name']));
$client_id = $row['contact_client_id'];
$client_id = intval($row['contact_client_id']);
mysqli_query($mysqli,"DELETE FROM contacts WHERE contact_id = $contact_id AND company_id = $session_company_id");
@ -4474,7 +4474,7 @@ if(isset($_GET['delete_contact'])){
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Contact', log_action = 'Delete', log_description = '$session_name deleted contact $contact_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, company_id = $session_company_id");
$_SESSION['alert_type'] = "error";
$_SESSION['alert_message'] = "Contact deleted";
$_SESSION['alert_message'] = "Contact <strong>$contact_name</strong> deleted.";
header("Location: " . $_SERVER["HTTP_REFERER"]);