mirror of
https://github.com/itflow-org/itflow
synced 2026-03-19 12:14:50 +00:00
Add count to asset import via csv
This commit is contained in:
5
post.php
5
post.php
@@ -4139,6 +4139,7 @@ if (isset($_POST["import_client_assets_csv"])) {
|
|||||||
if ($_FILES["file"]["size"] > 0) {
|
if ($_FILES["file"]["size"] > 0) {
|
||||||
$file = fopen($file_name, "r");
|
$file = fopen($file_name, "r");
|
||||||
fgetcsv($file, 1000, ","); // Skip first line
|
fgetcsv($file, 1000, ","); // Skip first line
|
||||||
|
$count = 0;
|
||||||
while (($column = fgetcsv($file, 1000, ",")) !== FALSE) {
|
while (($column = fgetcsv($file, 1000, ",")) !== FALSE) {
|
||||||
if (isset($column[0])) {
|
if (isset($column[0])) {
|
||||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli, $column[0])));
|
$name = trim(strip_tags(mysqli_real_escape_string($mysqli, $column[0])));
|
||||||
@@ -4165,10 +4166,12 @@ if (isset($_POST["import_client_assets_csv"])) {
|
|||||||
|
|
||||||
//Logging
|
//Logging
|
||||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Asset', log_action = 'Created', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Asset', log_action = 'Created', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||||
|
|
||||||
|
$count = $count + 1;
|
||||||
}
|
}
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
|
||||||
$_SESSION['alert_message'] = "Asset added";
|
$_SESSION['alert_message'] = "$count Asset(s) added";
|
||||||
|
|
||||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user