mirror of
https://github.com/itflow-org/itflow
synced 2026-03-10 07:44:50 +00:00
Added Purchase Reference to Software Licneses
This commit is contained in:
@@ -14,6 +14,7 @@ $software_type = nullable_htmlentities($row['software_type']);
|
|||||||
$software_license_type = nullable_htmlentities($row['software_license_type']);
|
$software_license_type = nullable_htmlentities($row['software_license_type']);
|
||||||
$software_key = nullable_htmlentities($row['software_key']);
|
$software_key = nullable_htmlentities($row['software_key']);
|
||||||
$software_seats = nullable_htmlentities($row['software_seats']);
|
$software_seats = nullable_htmlentities($row['software_seats']);
|
||||||
|
$software_purchase_reference = nullable_htmlentities($row['software_purchase_reference']);
|
||||||
$software_purchase = nullable_htmlentities($row['software_purchase']);
|
$software_purchase = nullable_htmlentities($row['software_purchase']);
|
||||||
$software_expire = nullable_htmlentities($row['software_expire']);
|
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||||
$software_notes = nullable_htmlentities($row['software_notes']);
|
$software_notes = nullable_htmlentities($row['software_notes']);
|
||||||
@@ -183,6 +184,16 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Purchase Reference</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="purchase_reference" placeholder="eg. Invoice, PO Number" value="<?php echo $software_purchase_reference; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Purchase Date</label>
|
<label>Purchase Date</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
|||||||
14
contacts.php
14
contacts.php
@@ -53,9 +53,6 @@ if ($client_url && isset($_GET['location']) && !empty($_GET['location'])) {
|
|||||||
$location_filter = '';
|
$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
|
$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 clients ON client_id = contact_client_id
|
||||||
LEFT JOIN locations ON location_id = contact_location_id
|
LEFT JOIN locations ON location_id = contact_location_id
|
||||||
@@ -295,12 +292,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
} else {
|
} else {
|
||||||
$contact_title_display = "<small class='text-secondary'>$contact_title</small>";
|
$contact_title_display = "<small class='text-secondary'>$contact_title</small>";
|
||||||
}
|
}
|
||||||
$contact_department = nullable_htmlentities($row['contact_department']);
|
$contact_department = getFallBack(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']);
|
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
||||||
if (empty($contact_extension)) {
|
if (empty($contact_extension)) {
|
||||||
$contact_extension_display = "";
|
$contact_extension_display = "";
|
||||||
@@ -348,7 +340,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$contact_location_id = intval($row['contact_location_id']);
|
$contact_location_id = intval($row['contact_location_id']);
|
||||||
$location_name = nullable_htmlentities($row['location_name']);
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
if (empty($location_name)) {
|
if (empty($location_name)) {
|
||||||
$location_name = "-";
|
$location_name = "<span class='text-muted'>N/A</span>";
|
||||||
}
|
}
|
||||||
$location_archived_at = nullable_htmlentities($row['location_archived_at']);
|
$location_archived_at = nullable_htmlentities($row['location_archived_at']);
|
||||||
if ($location_archived_at) {
|
if ($location_archived_at) {
|
||||||
@@ -437,7 +429,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $contact_department_display; ?></td>
|
<td><?php echo $contact_department; ?></td>
|
||||||
<td><?php echo $contact_info_display; ?></td>
|
<td><?php echo $contact_info_display; ?></td>
|
||||||
<td><?php echo $location_name_display; ?></td>
|
<td><?php echo $location_name_display; ?></td>
|
||||||
<?php if (!$client_url) { ?>
|
<?php if (!$client_url) { ?>
|
||||||
|
|||||||
@@ -2511,16 +2511,19 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
mysqli_query($mysqli, "ALTER TABLE `software` DROP `software_login_id`");
|
mysqli_query($mysqli, "ALTER TABLE `software` DROP `software_login_id`");
|
||||||
mysqli_query($mysqli, "ALTER TABLE `software` ADD `software_vendor_id` INT(11) DEFAULT 0 AFTER `software_accessed_at`");
|
mysqli_query($mysqli, "ALTER TABLE `software` ADD `software_vendor_id` INT(11) DEFAULT 0 AFTER `software_accessed_at`");
|
||||||
|
|
||||||
|
|
||||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.5'");
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.5'");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (CURRENT_DATABASE_VERSION == '1.8.5') {
|
if (CURRENT_DATABASE_VERSION == '1.8.5') {
|
||||||
// // Insert queries here required to update to DB version 1.8.6
|
mysqli_query($mysqli, "ALTER TABLE `software` ADD `software_purchase_reference` VARCHAR(200) DEFAULT NULL AFTER `software_seats`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.6'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (CURRENT_DATABASE_VERSION == '1.8.6') {
|
||||||
|
// // Insert queries here required to update to DB version 1.8.7
|
||||||
// // Then, update the database to the next sequential version
|
// // Then, update the database to the next sequential version
|
||||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.6'");
|
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.7'");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
3
db.sql
3
db.sql
@@ -1803,6 +1803,7 @@ CREATE TABLE `software` (
|
|||||||
`software_license_type` varchar(200) DEFAULT NULL,
|
`software_license_type` varchar(200) DEFAULT NULL,
|
||||||
`software_key` varchar(200) DEFAULT NULL,
|
`software_key` varchar(200) DEFAULT NULL,
|
||||||
`software_seats` int(11) DEFAULT NULL,
|
`software_seats` int(11) DEFAULT NULL,
|
||||||
|
`software_purchase_reference` varchar(200) DEFAULT NULL,
|
||||||
`software_purchase` date DEFAULT NULL,
|
`software_purchase` date DEFAULT NULL,
|
||||||
`software_expire` date DEFAULT NULL,
|
`software_expire` date DEFAULT NULL,
|
||||||
`software_notes` text DEFAULT NULL,
|
`software_notes` text DEFAULT NULL,
|
||||||
@@ -2361,4 +2362,4 @@ CREATE TABLE `vendors` (
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2025-02-24 21:23:33
|
-- Dump completed on 2025-02-26 12:58:39
|
||||||
|
|||||||
@@ -5,4 +5,4 @@
|
|||||||
* It is used in conjunction with database_updates.php
|
* It is used in conjunction with database_updates.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEFINE("LATEST_DATABASE_VERSION", "1.8.5");
|
DEFINE("LATEST_DATABASE_VERSION", "1.8.6");
|
||||||
|
|||||||
@@ -170,6 +170,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Purchase Reference</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="purchase_reference" placeholder="eg. Invoice, PO Number">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Purchase Date</label>
|
<label>Purchase Date</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ if (isset($_POST['add_software'])) {
|
|||||||
$notes = sanitizeInput($_POST['notes']);
|
$notes = sanitizeInput($_POST['notes']);
|
||||||
$key = sanitizeInput($_POST['key']);
|
$key = sanitizeInput($_POST['key']);
|
||||||
$seats = intval($_POST['seats']);
|
$seats = intval($_POST['seats']);
|
||||||
|
$purchase_reference = sanitizeInput($_POST['purchase_reference']);
|
||||||
$purchase = sanitizeInput($_POST['purchase']);
|
$purchase = sanitizeInput($_POST['purchase']);
|
||||||
if (empty($purchase)) {
|
if (empty($purchase)) {
|
||||||
$purchase = "NULL";
|
$purchase = "NULL";
|
||||||
@@ -67,7 +68,7 @@ if (isset($_POST['add_software'])) {
|
|||||||
$notes = sanitizeInput($_POST['notes']);
|
$notes = sanitizeInput($_POST['notes']);
|
||||||
$vendor = sanitizeInput($_POST['vendor'] ?? 0);
|
$vendor = sanitizeInput($_POST['vendor'] ?? 0);
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_description = '$description', software_type = '$type', software_key = '$key', software_license_type = '$license_type', software_seats = $seats, software_purchase = $purchase, software_expire = $expire, software_notes = '$notes', software_vendor_id = $vendor, software_client_id = $client_id");
|
mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_description = '$description', software_type = '$type', software_key = '$key', software_license_type = '$license_type', software_seats = $seats, software_purchase_reference = '$purchase_reference', software_purchase = $purchase, software_expire = $expire, software_notes = '$notes', software_vendor_id = $vendor, software_client_id = $client_id");
|
||||||
|
|
||||||
$software_id = mysqli_insert_id($mysqli);
|
$software_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
@@ -112,6 +113,7 @@ if (isset($_POST['edit_software'])) {
|
|||||||
$notes = sanitizeInput($_POST['notes']);
|
$notes = sanitizeInput($_POST['notes']);
|
||||||
$key = sanitizeInput($_POST['key']);
|
$key = sanitizeInput($_POST['key']);
|
||||||
$seats = intval($_POST['seats']);
|
$seats = intval($_POST['seats']);
|
||||||
|
$purchase_reference = sanitizeInput($_POST['purchase_reference']);
|
||||||
$purchase = sanitizeInput($_POST['purchase']);
|
$purchase = sanitizeInput($_POST['purchase']);
|
||||||
if (empty($purchase)) {
|
if (empty($purchase)) {
|
||||||
$purchase = "NULL";
|
$purchase = "NULL";
|
||||||
@@ -127,7 +129,7 @@ if (isset($_POST['edit_software'])) {
|
|||||||
$notes = sanitizeInput($_POST['notes']);
|
$notes = sanitizeInput($_POST['notes']);
|
||||||
$vendor = sanitizeInput($_POST['vendor'] ?? 0);
|
$vendor = sanitizeInput($_POST['vendor'] ?? 0);
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_version = '$version', software_description = '$description', software_type = '$type', software_key = '$key', software_license_type = '$license_type', software_seats = $seats, software_purchase = $purchase, software_expire = $expire, software_notes = '$notes', software_vendor_id = $vendor WHERE software_id = $software_id");
|
mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_version = '$version', software_description = '$description', software_type = '$type', software_key = '$key', software_license_type = '$license_type', software_seats = $seats, software_purchase_reference = '$purchase_reference', software_purchase = $purchase, software_expire = $expire, software_notes = '$notes', software_vendor_id = $vendor WHERE software_id = $software_id");
|
||||||
|
|
||||||
|
|
||||||
// Update Asset Licenses
|
// Update Asset Licenses
|
||||||
|
|||||||
25
software.php
25
software.php
@@ -22,6 +22,7 @@ $sql = mysqli_query(
|
|||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM software
|
"SELECT SQL_CALC_FOUND_ROWS * FROM software
|
||||||
LEFT JOIN clients ON client_id = software_client_id
|
LEFT JOIN clients ON client_id = software_client_id
|
||||||
|
LEFT JOIN vendors ON vendor_id = software_vendor_id
|
||||||
WHERE software_template = 0
|
WHERE software_template = 0
|
||||||
AND software_$archive_query
|
AND software_$archive_query
|
||||||
AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%' OR client_name LIKE '%$q%')
|
AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%' OR client_name LIKE '%$q%')
|
||||||
@@ -114,6 +115,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
Expire <?php if ($sort == 'software_expire') { echo $order_icon; } ?>
|
Expire <?php if ($sort == 'software_expire') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=vendor_name&order=<?php echo $disp; ?>">
|
||||||
|
Vendor <?php if ($sort == 'vendor_name') { echo $order_icon; } ?>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
<?php if (!$client_url) { ?>
|
<?php if (!$client_url) { ?>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
|
||||||
@@ -135,11 +141,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$software_description = nullable_htmlentities($row['software_description']);
|
$software_description = nullable_htmlentities($row['software_description']);
|
||||||
$software_version = nullable_htmlentities($row['software_version']);
|
$software_version = nullable_htmlentities($row['software_version']);
|
||||||
$software_type = nullable_htmlentities($row['software_type']);
|
$software_type = nullable_htmlentities($row['software_type']);
|
||||||
$software_license_type = nullable_htmlentities($row['software_license_type']);
|
$software_license_type = getFallBack(nullable_htmlentities($row['software_license_type']));
|
||||||
$software_key = nullable_htmlentities($row['software_key']);
|
|
||||||
$software_seats = nullable_htmlentities($row['software_seats']);
|
$software_seats = nullable_htmlentities($row['software_seats']);
|
||||||
$software_purchase = nullable_htmlentities($row['software_purchase']);
|
|
||||||
$software_expire = nullable_htmlentities($row['software_expire']);
|
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||||
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
$vendor_id = intval($row['vendor_id']);
|
||||||
|
if ($vendor_name) {
|
||||||
|
$vendor_display = "<a href='#' data-toggle='ajax-modal' data-ajax-url='ajax/ajax_vendor_details.php' data-ajax-id='$vendor_id'>$vendor_name</a>";
|
||||||
|
} else {
|
||||||
|
$vendor_display = "<span class='text-muted'>N/A</span>";
|
||||||
|
}
|
||||||
if ($software_expire) {
|
if ($software_expire) {
|
||||||
$software_expire_ago = timeAgo($software_expire);
|
$software_expire_ago = timeAgo($software_expire);
|
||||||
$software_expire_display = "<div>$software_expire</div><div><small>$software_expire_ago</small></div>";
|
$software_expire_display = "<div>$software_expire</div><div><small>$software_expire_ago</small></div>";
|
||||||
@@ -154,19 +165,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
// Determine the class based on the number of days until expiry
|
// Determine the class based on the number of days until expiry
|
||||||
if ($days_until_expiry <= 0) {
|
if ($days_until_expiry <= 0) {
|
||||||
$tr_class = "table-secondary";
|
$tr_class = "table-secondary";
|
||||||
} elseif ($days_until_expiry <= 14) {
|
} elseif ($days_until_expiry <= 7) {
|
||||||
$tr_class = "table-danger";
|
$tr_class = "table-danger";
|
||||||
} elseif ($days_until_expiry <= 90) {
|
} elseif ($days_until_expiry <= 45) {
|
||||||
$tr_class = "table-warning";
|
$tr_class = "table-warning";
|
||||||
} else {
|
} else {
|
||||||
$tr_class = '';
|
$tr_class = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$software_expire_display = "-";
|
$software_expire_display = "<span class='text-muted'>N/A</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$software_notes = nullable_htmlentities($row['software_notes']);
|
|
||||||
$software_created_at = nullable_htmlentities($row['software_created_at']);
|
$software_created_at = nullable_htmlentities($row['software_created_at']);
|
||||||
|
|
||||||
$seat_count = 0;
|
$seat_count = 0;
|
||||||
@@ -212,6 +222,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<td><?php echo $software_license_type; ?></td>
|
<td><?php echo $software_license_type; ?></td>
|
||||||
<td><?php echo "$seat_count / $software_seats"; ?></td>
|
<td><?php echo "$seat_count / $software_seats"; ?></td>
|
||||||
<td><?php echo $software_expire_display; ?></td>
|
<td><?php echo $software_expire_display; ?></td>
|
||||||
|
<td><?php echo $vendor_display; ?></td>
|
||||||
<?php if (!$client_url) { ?>
|
<?php if (!$client_url) { ?>
|
||||||
<td><a href="software.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
<td><a href="software.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user