Added Seats Expire and Purchase dates to Software

This commit is contained in:
johnnyq
2022-02-18 01:09:16 -05:00
parent 0aec371ccd
commit ab973457b9
5 changed files with 101 additions and 20 deletions

View File

@@ -4601,11 +4601,20 @@ if(isset($_POST['add_software'])){
$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 = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['license'])));
$key = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['key'])));
$license_type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['license_type'])));
$seats = intval($_POST['seats']);
$purchase = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['purchase'])));
if(empty($purchase)){
$purchase = "0000-00-00";
}
$expire = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['expire'])));
if(empty($expire)){
$expire = "0000-00-00";
}
$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 = '$license', software_license_type = '$license_type', software_notes = '$notes', software_created_at = NOW(), software_client_id = $client_id, company_id = $session_company_id");
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");
if(!empty($_POST['username'])) {
$software_id = mysqli_insert_id($mysqli);
@@ -4632,13 +4641,22 @@ if(isset($_POST['edit_software'])){
$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 = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['license'])));
$key = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['key'])));
$license_type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['license_type'])));
$seats = intval($_POST['seats']);
$purchase = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['purchase'])));
if(empty($purchase)){
$purchase = "0000-00-00";
}
$expire = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['expire'])));
if(empty($expire)){
$expire = "0000-00-00";
}
$notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['notes'])));
$username = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['username'])));
$password = trim(mysqli_real_escape_string($mysqli,encryptLoginEntry($_POST['password'])));
mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_version = '$version', software_type = '$type', software_license = '$license', software_license_type = '$license_type', software_notes = '$notes', software_updated_at = NOW() WHERE software_id = $software_id AND company_id = $session_company_id");
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");
//If login exists then update the login
if($login_id > 0){