mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01: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,6 +71,7 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
@ -98,6 +99,7 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
@ -125,6 +127,7 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
@ -152,6 +155,7 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
@ -179,6 +183,7 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
@ -206,6 +211,7 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$data = $this->getCsvData($entity_type);
|
||||
|
||||
if(is_array($data))
|
||||
$data = $this->preTransformCsv($data, $entity_type);
|
||||
|
||||
if (empty($data)) {
|
||||
|
Loading…
Reference in New Issue
Block a user