mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Merge branch 'master' into asset-csv
This commit is contained in:
19
post.php
19
post.php
@@ -3773,7 +3773,7 @@ if(isset($_POST['edit_contact'])){
|
||||
$dest_path = $upload_file_dir . $new_file_name;
|
||||
|
||||
move_uploaded_file($file_tmp_path, $dest_path);
|
||||
|
||||
asset
|
||||
//Delete old file
|
||||
unlink("uploads/clients/$session_company_id/$client_id/$existing_file_name");
|
||||
|
||||
@@ -4136,7 +4136,7 @@ if (isset($_POST["import_client_assets_csv"])) {
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$file_name = $_FILES["file"]["tmp_name"];
|
||||
|
||||
if ($_FILES["file"]["size"] > 0) {
|
||||
if($_FILES["file"]["size"] > 0){
|
||||
$file = fopen($file_name, "r");
|
||||
fgetcsv($file, 1000, ","); // Skip first line
|
||||
$count = 0;
|
||||
@@ -4144,24 +4144,24 @@ if (isset($_POST["import_client_assets_csv"])) {
|
||||
if (isset($column[0])) {
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli, $column[0])));
|
||||
}
|
||||
if (isset($column[1])) {
|
||||
if(isset($column[1])){
|
||||
$type = trim(strip_tags(mysqli_real_escape_string($mysqli, $column[1])));
|
||||
}
|
||||
if (isset($column[2])) {
|
||||
if(isset($column[2])){
|
||||
$make = trim(strip_tags(mysqli_real_escape_string($mysqli, $column[2])));
|
||||
}
|
||||
if (isset($column[3])) {
|
||||
if(isset($column[3])){
|
||||
$model = trim(strip_tags(mysqli_real_escape_string($mysqli, $column[3])));
|
||||
}
|
||||
if (isset($column[4])) {
|
||||
if(isset($column[4])){
|
||||
$serial = trim(strip_tags(mysqli_real_escape_string($mysqli, $column[4])));
|
||||
}
|
||||
if (isset($column[5])) {
|
||||
if(isset($column[5])){
|
||||
$os = trim(strip_tags(mysqli_real_escape_string($mysqli, $column[5])));
|
||||
}
|
||||
// Potentially import the rest in the future?
|
||||
|
||||
// Add
|
||||
//Add
|
||||
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_created_at = NOW(), asset_client_id = $client_id, company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
@@ -4179,11 +4179,10 @@ if (isset($_POST["import_client_assets_csv"])) {
|
||||
// The file was empty
|
||||
$_SESSION['alert_type'] = "warning";
|
||||
$_SESSION['alert_message'] = "Something went wrong";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['edit_asset'])){
|
||||
|
||||
$asset_id = intval($_POST['asset_id']);
|
||||
|
||||
Reference in New Issue
Block a user