mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Refactor for imports
This commit is contained in:
parent
a4a31f35b1
commit
97507871c5
@ -103,7 +103,7 @@ class ImportController extends Controller {
|
||||
|
||||
public function import( ImportRequest $request ) {
|
||||
$data = $request->all();
|
||||
nlog($data);
|
||||
|
||||
if ( empty( $data['hash'] ) ) {
|
||||
// Create a reference
|
||||
$data['hash'] = $hash = Str::random( 32 );
|
||||
|
@ -80,6 +80,8 @@ class BaseImport
|
||||
|
||||
public function getCsvData($entity_type)
|
||||
{
|
||||
nlog("get csv data = entity name = " . $entity_type);
|
||||
|
||||
$base64_encoded_csv = Cache::pull($this->hash . '-' . $entity_type);
|
||||
if (empty($base64_encoded_csv)) {
|
||||
return null;
|
||||
|
@ -71,7 +71,8 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->entity_count['clients'] = 0;
|
||||
@ -98,7 +99,8 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->entity_count['products'] = 0;
|
||||
@ -125,7 +127,8 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->entity_count['invoices'] = 0;
|
||||
@ -152,7 +155,8 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->entity_count['payments'] = 0;
|
||||
@ -179,7 +183,8 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->entity_count['vendors'] = 0;
|
||||
@ -206,7 +211,8 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->entity_count['expenses'] = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user