mirror of https://github.com/itflow-org/itflow
Merge pull request #615 from wrongecho/api-assets-status
Allow setting asset status via API
This commit is contained in:
commit
e35e23427b
|
|
@ -64,6 +64,14 @@ if (isset($_POST['asset_mac'])) {
|
|||
$mac = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_status'])) {
|
||||
$status = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_status'])));
|
||||
} elseif ($asset_row) {
|
||||
$status = $asset_row['asset_status'];
|
||||
} else {
|
||||
$status = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['asset_purchase_date']) && !empty($_POST['asset_purchase_date'])) {
|
||||
$purchase_date = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['asset_purchase_date'])));
|
||||
} elseif ($asset_row) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ $insert_id = false;
|
|||
|
||||
if (!empty($name) && !empty($client_id)) {
|
||||
// Insert into Database
|
||||
$insert_sql = mysqli_query($mysqli, "INSERT INTO assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$aip', asset_mac = '$mac', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_created_at = NOW(), asset_network_id = $network, asset_client_id = $client_id, company_id = '$company_id'");
|
||||
$insert_sql = mysqli_query($mysqli, "INSERT INTO assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$aip', asset_mac = '$mac', asset_status = '$status', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_created_at = NOW(), asset_network_id = $network, asset_client_id = $client_id, company_id = '$company_id'");
|
||||
|
||||
if ($insert_sql) {
|
||||
$insert_id = mysqli_insert_id($mysqli);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ if (!empty($asset_id)) {
|
|||
// Variable assignment from POST - assigning the current database value if a value is not provided
|
||||
require_once('asset_model.php');
|
||||
|
||||
$update_sql = mysqli_query($mysqli, "UPDATE assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$aip', asset_mac = '$mac', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_updated_at = NOW(), asset_network_id = $network WHERE asset_id = $asset_id AND asset_client_id = $client_id AND company_id = '$company_id' LIMIT 1");
|
||||
$update_sql = mysqli_query($mysqli, "UPDATE assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$aip', asset_mac = '$mac', asset_status = '$status', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_updated_at = NOW(), asset_network_id = $network WHERE asset_id = $asset_id AND asset_client_id = $client_id AND company_id = '$company_id' LIMIT 1");
|
||||
|
||||
// Check insert & get insert ID
|
||||
if ($update_sql) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue