diff --git a/client_software.php b/client_software.php
index 83b4207c..1e09be4a 100644
--- a/client_software.php
+++ b/client_software.php
@@ -93,8 +93,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$software_version"; ?>
|
|
- |
+ |
0){
@@ -155,6 +176,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
diff --git a/client_software_add_modal.php b/client_software_add_modal.php
index f90e7042..590e9a26 100644
--- a/client_software_add_modal.php
+++ b/client_software_add_modal.php
@@ -15,6 +15,12 @@
Details
+
+ Device Licenses
+
+
+ User Licenses
+
Notes
@@ -63,14 +69,19 @@
-
+
@@ -116,6 +127,69 @@
+
+
+
+ Select Assets that are licensed for this software
+
+
+
+
+
+
+
+
+
+ Select Users that are licensed for this software
+
+
+
+
+
+
diff --git a/client_software_edit_modal.php b/client_software_edit_modal.php
index 63942c77..e93f6695 100644
--- a/client_software_edit_modal.php
+++ b/client_software_edit_modal.php
@@ -16,6 +16,12 @@
Details
+
+ Device Licenses
+
+
+ User Licenses
+
Notes
@@ -70,7 +76,12 @@
-
+
@@ -116,6 +127,69 @@
+
+
+
+ Select Assets that are licensed for this software
+
+
+
+
+
+
+
+
+
+ Select Users that are licensed for this software
+
+
+
+
+
+
diff --git a/get_settings.php b/get_settings.php
index 95587a9c..2f5bf8d8 100644
--- a/get_settings.php
+++ b/get_settings.php
@@ -887,4 +887,9 @@ $software_types_array = array(
'Other'
);
+$license_types_array = array(
+ 'Device',
+ 'User'
+);
+
?>
\ No newline at end of file
diff --git a/post.php b/post.php
index ba83bea8..07cc2031 100644
--- a/post.php
+++ b/post.php
@@ -4665,6 +4665,22 @@ if(isset($_POST['add_software'])){
mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_type = '$type', software_key = '$key', software_license_type = '$license_type', software_seats = '$seats', software_purchase = '$purchase', software_expire = '$expire', software_notes = '$notes', software_created_at = NOW(), software_client_id = $client_id, company_id = $session_company_id");
+ // Add Asset Licenses
+ if(!empty($_POST['assets'])){
+ foreach($_POST['assets'] as $asset){
+ intval($asset);
+ mysqli_query($mysqli,"INSERT INTO software_assets SET software_id = $software_id, asset_id = $asset");
+ }
+ }
+
+ // Add Contact Licenses
+ if(!empty($_POST['contacts'])){
+ foreach($_POST['contacts'] as $contact){
+ intval($contact);
+ mysqli_query($mysqli,"INSERT INTO software_contacts SET software_id = $software_id, contact_id = $contact");
+ }
+ }
+
if(!empty($_POST['username'])) {
$software_id = mysqli_insert_id($mysqli);
$username = strip_tags(mysqli_real_escape_string($mysqli,$_POST['username']));
@@ -4707,6 +4723,25 @@ if(isset($_POST['edit_software'])){
mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_version = '$version', software_type = '$type', software_key = '$key', software_license_type = '$license_type', software_seats = $seats, software_purchase = '$purchase', software_expire = '$expire', software_notes = '$notes', software_updated_at = NOW() WHERE software_id = $software_id AND company_id = $session_company_id");
+
+ // Update Asset Licenses
+ mysqli_query($mysqli,"DELETE FROM software_assets WHERE software_id = $software_id");
+ if(!empty($_POST['assets'])){
+ foreach($_POST['assets'] as $asset){
+ intval($asset);
+ mysqli_query($mysqli,"INSERT INTO software_assets SET software_id = $software_id, asset_id = $asset");
+ }
+ }
+
+ // Update Contact Licenses
+ mysqli_query($mysqli,"DELETE FROM software_contacts WHERE software_id = $software_id");
+ if(!empty($_POST['contacts'])){
+ foreach($_POST['contacts'] as $contact){
+ intval($contact);
+ mysqli_query($mysqli,"INSERT INTO software_contacts SET software_id = $software_id, contact_id = $contact");
+ }
+ }
+
//If login exists then update the login
if($login_id > 0){
mysqli_query($mysqli,"UPDATE logins SET login_name = '$name', login_username = '$username', login_password = '$password', login_updated_at = NOW() WHERE login_id = $login_id AND company_id = $session_company_id");
|