mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support importing exported files
This commit is contained in:
parent
86af13f924
commit
4596ce4095
@ -360,6 +360,7 @@ Route::get('/comments/feed', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!defined('CONTACT_EMAIL')) {
|
if (!defined('CONTACT_EMAIL')) {
|
||||||
|
define('APP_NAME', env('APP_NAME', 'Invoice Ninja'));
|
||||||
define('CONTACT_EMAIL', config('mail.from.address'));
|
define('CONTACT_EMAIL', config('mail.from.address'));
|
||||||
define('CONTACT_NAME', config('mail.from.name'));
|
define('CONTACT_NAME', config('mail.from.name'));
|
||||||
define('SITE_URL', config('app.url'));
|
define('SITE_URL', config('app.url'));
|
||||||
|
@ -485,14 +485,24 @@ class ImportService
|
|||||||
$csv->heading = false;
|
$csv->heading = false;
|
||||||
$csv->auto($filename);
|
$csv->auto($filename);
|
||||||
|
|
||||||
Session::put("{$entityType}-data", $csv->data);
|
|
||||||
|
|
||||||
$headers = false;
|
$headers = false;
|
||||||
$hasHeaders = false;
|
$hasHeaders = false;
|
||||||
$mapped = [];
|
$mapped = [];
|
||||||
|
|
||||||
if (count($csv->data) > 0) {
|
if (count($csv->data) > 0) {
|
||||||
$headers = $csv->data[0];
|
$headers = $csv->data[0];
|
||||||
|
|
||||||
|
// Remove Invoice Ninja headers
|
||||||
|
if (count($headers) && count($csv->data) > 4) {
|
||||||
|
$firstCell = $headers[0];
|
||||||
|
if (strstr($firstCell, APP_NAME)) {
|
||||||
|
array_shift($csv->data); // Invoice Ninja...
|
||||||
|
array_shift($csv->data); // <blank line>
|
||||||
|
array_shift($csv->data); // Enitty Type Header
|
||||||
|
}
|
||||||
|
$headers = $csv->data[0];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($headers as $title) {
|
foreach ($headers as $title) {
|
||||||
if (strpos(strtolower($title), 'name') > 0) {
|
if (strpos(strtolower($title), 'name') > 0) {
|
||||||
$hasHeaders = true;
|
$hasHeaders = true;
|
||||||
@ -514,6 +524,8 @@ class ImportService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Session::put("{$entityType}-data", $csv->data);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'entityType' => $entityType,
|
'entityType' => $entityType,
|
||||||
'data' => $csv->data,
|
'data' => $csv->data,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user