From 04e624cc143ca94fde658aaa59aeb2b7dabaff6f Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 26 Feb 2025 12:59:03 -0500 Subject: [PATCH] Added Purchase Reference to Software Licneses --- ajax/ajax_software_edit.php | 11 + contacts.php | 836 +++++++++++++++++----------------- database_updates.php | 15 +- db.sql | 3 +- includes/database_version.php | 2 +- modals/software_add_modal.php | 10 + post/user/software.php | 6 +- software.php | 25 +- 8 files changed, 469 insertions(+), 439 deletions(-) diff --git a/ajax/ajax_software_edit.php b/ajax/ajax_software_edit.php index 6ff86d04..7aa7d523 100644 --- a/ajax/ajax_software_edit.php +++ b/ajax/ajax_software_edit.php @@ -14,6 +14,7 @@ $software_type = nullable_htmlentities($row['software_type']); $software_license_type = nullable_htmlentities($row['software_license_type']); $software_key = nullable_htmlentities($row['software_key']); $software_seats = nullable_htmlentities($row['software_seats']); +$software_purchase_reference = nullable_htmlentities($row['software_purchase_reference']); $software_purchase = nullable_htmlentities($row['software_purchase']); $software_expire = nullable_htmlentities($row['software_expire']); $software_notes = nullable_htmlentities($row['software_notes']); @@ -183,6 +184,16 @@ ob_start(); +
+ +
+
+ +
+ +
+
+
diff --git a/contacts.php b/contacts.php index 5c3eb349..be1c7b1a 100644 --- a/contacts.php +++ b/contacts.php @@ -53,9 +53,6 @@ if ($client_url && isset($_GET['location']) && !empty($_GET['location'])) { $location_filter = ''; } -//Rebuild URL -//$url_query_strings_sort = http_build_query($get_copy); - $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS contacts.*, clients.*, locations.*, users.*, GROUP_CONCAT(tags.tag_name) FROM contacts LEFT JOIN clients ON client_id = contact_client_id LEFT JOIN locations ON location_id = contact_location_id @@ -76,442 +73,437 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); ?> -
-
-

Contacts

-
-
- - - +
+
+

Contacts

+
+
+ + +
-
-
- - - - -
+
+
+ + + + + +
-
-
- -
- -
+
+
+ +
+
- -
-
- -
- -
-
-
- - -
-
- -
-
- -
-
- -
-
- - -
-
- "> - Archived - - -
-
-
- -
-
- -
- - "> - - - - - - - - +
+
+
- - - - +
+ +
+ + - while ($row = mysqli_fetch_array($sql)) { - $client_id = intval($row['client_id']); - $client_name = nullable_htmlentities($row['client_name']); - $contact_id = intval($row['contact_id']); - $contact_name = nullable_htmlentities($row['contact_name']); - $contact_title = nullable_htmlentities($row['contact_title']); - if (empty($contact_title)) { - $contact_title_display = ""; - } else { - $contact_title_display = "$contact_title"; - } - $contact_department = nullable_htmlentities($row['contact_department']); - if (empty($contact_department)) { - $contact_department_display = "-"; - } else { - $contact_department_display = $contact_department; - } - $contact_extension = nullable_htmlentities($row['contact_extension']); - if (empty($contact_extension)) { - $contact_extension_display = ""; - } else { - $contact_extension_display = "x$contact_extension"; - } - $contact_phone = formatPhoneNumber($row['contact_phone']); - if (empty($contact_phone)) { - $contact_phone_display = ""; - } else { - $contact_phone_display = ""; - } - - $contact_mobile = formatPhoneNumber($row['contact_mobile']); - if (empty($contact_mobile)) { - $contact_mobile_display = ""; - } else { - $contact_mobile_display = ""; - } - $contact_email = nullable_htmlentities($row['contact_email']); - if (empty($contact_email)) { - $contact_email_display = ""; - } else { - $contact_email_display = ""; - } - $contact_info_display = "$contact_phone_display $contact_mobile_display $contact_email_display"; - if (empty($contact_info_display)) { - $contact_info_display = "-"; - } - $contact_pin = nullable_htmlentities($row['contact_pin']); - $contact_photo = nullable_htmlentities($row['contact_photo']); - $contact_initials = initials($contact_name); - $contact_notes = nullable_htmlentities($row['contact_notes']); - $contact_primary = intval($row['contact_primary']); - $contact_important = intval($row['contact_important']); - $contact_billing = intval($row['contact_billing']); - $contact_technical = intval($row['contact_technical']); - $contact_created_at = nullable_htmlentities($row['contact_created_at']); - $contact_archived_at = nullable_htmlentities($row['contact_archived_at']); - if ($contact_primary == 1) { - $contact_primary_display = "Primary Contact"; - } else { - $contact_primary_display = false; - } - $contact_location_id = intval($row['contact_location_id']); - $location_name = nullable_htmlentities($row['location_name']); - if (empty($location_name)) { - $location_name = "-"; - } - $location_archived_at = nullable_htmlentities($row['location_archived_at']); - if ($location_archived_at) { - $location_name_display = "
$location_name
"; - } else { - $location_name_display = $location_name; - } - $auth_method = nullable_htmlentities($row['user_auth_method']); - $contact_user_id = intval($row['contact_user_id']); - - // Related Assets Query - $sql_related_assets = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_contact_id = $contact_id ORDER BY asset_id DESC"); - $asset_count = mysqli_num_rows($sql_related_assets); - - // Related Logins Query - $sql_related_logins = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_contact_id = $contact_id ORDER BY login_id DESC"); - $login_count = mysqli_num_rows($sql_related_logins); - - // Related Software Query - $sql_related_software = mysqli_query($mysqli, "SELECT * FROM software, software_contacts WHERE software.software_id = software_contacts.software_id AND software_contacts.contact_id = $contact_id ORDER BY software.software_id DESC"); - $software_count = mysqli_num_rows($sql_related_software); - - // Related Tickets Query - $sql_related_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_contact_id = $contact_id ORDER BY ticket_id DESC"); - $ticket_count = mysqli_num_rows($sql_related_tickets); - - // Tags - $contact_tag_name_display_array = array(); - $contact_tag_id_array = array(); - $sql_contact_tags = mysqli_query($mysqli, "SELECT * FROM contact_tags LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id WHERE contact_id = $contact_id ORDER BY tag_name ASC"); - while ($row = mysqli_fetch_array($sql_contact_tags)) { - - $contact_tag_id = intval($row['tag_id']); - $contact_tag_name = nullable_htmlentities($row['tag_name']); - $contact_tag_color = nullable_htmlentities($row['tag_color']); - if (empty($contact_tag_color)) { - $contact_tag_color = "dark"; - } - $contact_tag_icon = nullable_htmlentities($row['tag_icon']); - if (empty($contact_tag_icon)) { - $contact_tag_icon = "tag"; - } - - $contact_tag_id_array[] = $contact_tag_id; - $contact_tag_name_display_array[] = "$contact_tag_name"; - } - $contact_tags_display = implode('', $contact_tag_name_display_array); - - ?> - - - - - - - - - - - + +
+
+ +
+
+ +
+
+ +
+
+ + +
+
+ "> + Archived + + +
+
+ + + +
+ + + +
+
-
- -
-
- - Name - - - - Department - - Contact - - Location - - - - Client - - Action
-
- -
-
- -
- - - "> - - - - - - - - -
-
">
- -
- -
- -
- -
-
-
- -
- -
+ "> + + + + + + + + + + + + + + $contact_title"; + } + $contact_department = getFallBack(nullable_htmlentities($row['contact_department'])); + $contact_extension = nullable_htmlentities($row['contact_extension']); + if (empty($contact_extension)) { + $contact_extension_display = ""; + } else { + $contact_extension_display = "x$contact_extension"; + } + $contact_phone = formatPhoneNumber($row['contact_phone']); + if (empty($contact_phone)) { + $contact_phone_display = ""; + } else { + $contact_phone_display = ""; } - ?> + $contact_mobile = formatPhoneNumber($row['contact_mobile']); + if (empty($contact_mobile)) { + $contact_mobile_display = ""; + } else { + $contact_mobile_display = ""; + } + $contact_email = nullable_htmlentities($row['contact_email']); + if (empty($contact_email)) { + $contact_email_display = ""; + } else { + $contact_email_display = ""; + } + $contact_info_display = "$contact_phone_display $contact_mobile_display $contact_email_display"; + if (empty($contact_info_display)) { + $contact_info_display = "-"; + } + $contact_pin = nullable_htmlentities($row['contact_pin']); + $contact_photo = nullable_htmlentities($row['contact_photo']); + $contact_initials = initials($contact_name); + $contact_notes = nullable_htmlentities($row['contact_notes']); + $contact_primary = intval($row['contact_primary']); + $contact_important = intval($row['contact_important']); + $contact_billing = intval($row['contact_billing']); + $contact_technical = intval($row['contact_technical']); + $contact_created_at = nullable_htmlentities($row['contact_created_at']); + $contact_archived_at = nullable_htmlentities($row['contact_archived_at']); + if ($contact_primary == 1) { + $contact_primary_display = "Primary Contact"; + } else { + $contact_primary_display = false; + } + $contact_location_id = intval($row['contact_location_id']); + $location_name = nullable_htmlentities($row['location_name']); + if (empty($location_name)) { + $location_name = "N/A"; + } + $location_archived_at = nullable_htmlentities($row['location_archived_at']); + if ($location_archived_at) { + $location_name_display = "
$location_name
"; + } else { + $location_name_display = $location_name; + } + $auth_method = nullable_htmlentities($row['user_auth_method']); + $contact_user_id = intval($row['contact_user_id']); - -
+
+ +
+
+ + Name + + + + Department + + Contact + + Location + + + + Client + + Action
-
- - - - - - - - $contact_tag_name"; + } + $contact_tags_display = implode('', $contact_tag_name_display_array); + + ?> + + +
+ +
+ + + +
+ + + "> + + + + + + + + +
+
">
+ +
+ +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + -
+