diff --git a/client_software.php b/client_software.php
index 9fa941b3..8035bd30 100644
--- a/client_software.php
+++ b/client_software.php
@@ -13,7 +13,8 @@ $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM software
LEFT JOIN logins ON login_software_id = software_id
- WHERE software_client_id = $client_id
+ WHERE software_client_id = $client_id
+ AND software_template = 0
AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%')
ORDER BY $sb $o LIMIT $record_from, $record_to");
@@ -24,8 +25,20 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
@@ -184,5 +197,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
+
\ No newline at end of file
diff --git a/client_software_add_from_template_modal.php b/client_software_add_from_template_modal.php
new file mode 100644
index 00000000..3b144df8
--- /dev/null
+++ b/client_software_add_from_template_modal.php
@@ -0,0 +1,49 @@
+
\ No newline at end of file
diff --git a/client_software_template_add_modal.php b/client_software_template_add_modal.php
new file mode 100644
index 00000000..97c27f25
--- /dev/null
+++ b/client_software_template_add_modal.php
@@ -0,0 +1,74 @@
+
\ No newline at end of file
diff --git a/client_software_template_edit_modal.php b/client_software_template_edit_modal.php
new file mode 100644
index 00000000..b7482019
--- /dev/null
+++ b/client_software_template_edit_modal.php
@@ -0,0 +1,73 @@
+
\ No newline at end of file
diff --git a/client_software_templates.php b/client_software_templates.php
new file mode 100644
index 00000000..b99e6150
--- /dev/null
+++ b/client_software_templates.php
@@ -0,0 +1,119 @@
+
+
+ $sb, 'o' => $o)));
+
+$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM software
+ LEFT JOIN logins ON login_software_id = software_id
+ WHERE software_template = 1
+ AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%')
+ ORDER BY $sb $o LIMIT $record_from, $record_to");
+
+$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
+
+?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/post.php b/post.php
index 753c33ec..a06b094c 100644
--- a/post.php
+++ b/post.php
@@ -5091,6 +5091,82 @@ if(isset($_GET['export_client_assets_csv'])){
}
+// Client Software/License
+
+// Templatee
+
+if(isset($_POST['add_software_template'])){
+
+ validateTechRole();
+
+ $name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
+ $version = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['version'])));
+ $type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['type'])));
+ $license_type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['license_type'])));
+ $notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['notes'])));
+
+ mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_type = '$type', software_license_type = '$license_type', software_notes = '$notes', software_template = 1, software_client_id = 0, company_id = $session_company_id");
+
+ //Logging
+ mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Software Template', log_action = 'Create', log_description = '$session_user_name created software template $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, company_id = $session_company_id");
+
+ $_SESSION['alert_message'] = "Software template created";
+
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
+
+}
+
+if(isset($_POST['edit_software_template'])){
+
+ validateTechRole();
+
+ $software_id = intval($_POST['software_id']);
+ $name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
+ $version = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['version'])));
+ $type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['type'])));
+ $license_type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['license_type'])));
+ $notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['notes'])));
+
+ mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_version = '$version', software_type = '$type', software_license_type = '$license_type', software_notes = '$notes' WHERE software_id = $software_id AND company_id = $session_company_id");
+
+ //Logging
+ mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Software Teplate', log_action = 'Modify', log_description = '$session_name updated software template $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, company_id = $session_company_id");
+
+ $_SESSION['alert_message'] = "Software template updated";
+
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
+
+}
+
+if(isset($_POST['add_software_from_template'])){
+
+ // GET POST Data
+ $client_id = intval($_POST['client_id']);
+ $software_template_id = intval($_POST['software_template_id']);
+
+ // GET Software Info
+ $sql_software = mysqli_query($mysqli,"SELECT * FROM software WHERE software_id = $software_template_id AND company_id = $session_company_id");
+
+ $row = mysqli_fetch_array($sql_software);
+
+ $name = trim(strip_tags(mysqli_real_escape_string($mysqli,$row['software_name'])));
+ $version = trim(strip_tags(mysqli_real_escape_string($mysqli,$row['software_version'])));
+ $type = trim(strip_tags(mysqli_real_escape_string($mysqli,$row['software_type'])));
+ $license_type = trim(strip_tags(mysqli_real_escape_string($mysqli,$row['software_license_type'])));
+ $notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$row['software_notes'])));
+
+ // Software add query
+ mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_type = '$type', software_license_type = '$license_type', software_notes = '$notes', software_client_id = $client_id, company_id = $session_company_id");
+
+ // Logging
+ mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Software', log_action = 'Create', log_description = 'Software created from template $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, company_id = $session_company_id, log_user_id = $session_user_id");
+
+ $_SESSION['alert_message'] = "Software created from template";
+
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
+
+}
+
if(isset($_POST['add_software'])){
validateTechRole();