mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support setting file import path
This commit is contained in:
parent
3d95f6b8b0
commit
81d9e4994c
@ -148,7 +148,7 @@ class ImportService
|
|||||||
public function importJSON($file, $includeData, $includeSettings)
|
public function importJSON($file, $includeData, $includeSettings)
|
||||||
{
|
{
|
||||||
$this->initMaps();
|
$this->initMaps();
|
||||||
$fileName = storage_path() . '/import/' . $file;
|
$fileName = $this->getFullPath($file);
|
||||||
$this->checkForFile($fileName);
|
$this->checkForFile($fileName);
|
||||||
$file = file_get_contents($fileName);
|
$file = file_get_contents($fileName);
|
||||||
$json = json_decode($file, true);
|
$json = json_decode($file, true);
|
||||||
@ -287,7 +287,7 @@ class ImportService
|
|||||||
|
|
||||||
// Convert the data
|
// Convert the data
|
||||||
$row_list = [];
|
$row_list = [];
|
||||||
$fileName = storage_path() . '/import/' . $file;
|
$fileName = $this->getFullPath($file);
|
||||||
$this->checkForFile($fileName);
|
$this->checkForFile($fileName);
|
||||||
|
|
||||||
Excel::load($fileName, function ($reader) use ($source, $entityType, &$row_list, &$results) {
|
Excel::load($fileName, function ($reader) use ($source, $entityType, &$row_list, &$results) {
|
||||||
@ -590,7 +590,7 @@ class ImportService
|
|||||||
{
|
{
|
||||||
require_once app_path().'/Includes/parsecsv.lib.php';
|
require_once app_path().'/Includes/parsecsv.lib.php';
|
||||||
|
|
||||||
$fileName = storage_path() . '/import/' . $fileName;
|
$fileName = $this->getFullPath($fileName);
|
||||||
$this->checkForFile($fileName);
|
$this->checkForFile($fileName);
|
||||||
|
|
||||||
$csv = new parseCSV();
|
$csv = new parseCSV();
|
||||||
@ -726,7 +726,7 @@ class ImportService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@unlink(storage_path() . '/import/' . $fileName);
|
@unlink($this->getFullPath($fileName));
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
@ -956,4 +956,9 @@ class ImportService
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFullPath($fileName)
|
||||||
|
{
|
||||||
|
return (env('FILE_IMPORT_PATH') ?: storage_path() . '/import') . '/' . $fileName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user