mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-02 15:44:35 -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 ) {
|
public function import( ImportRequest $request ) {
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
nlog($data);
|
|
||||||
if ( empty( $data['hash'] ) ) {
|
if ( empty( $data['hash'] ) ) {
|
||||||
// Create a reference
|
// Create a reference
|
||||||
$data['hash'] = $hash = Str::random( 32 );
|
$data['hash'] = $hash = Str::random( 32 );
|
||||||
|
@ -80,6 +80,8 @@ class BaseImport
|
|||||||
|
|
||||||
public function getCsvData($entity_type)
|
public function getCsvData($entity_type)
|
||||||
{
|
{
|
||||||
|
nlog("get csv data = entity name = " . $entity_type);
|
||||||
|
|
||||||
$base64_encoded_csv = Cache::pull($this->hash . '-' . $entity_type);
|
$base64_encoded_csv = Cache::pull($this->hash . '-' . $entity_type);
|
||||||
if (empty($base64_encoded_csv)) {
|
if (empty($base64_encoded_csv)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -71,6 +71,7 @@ class Csv extends BaseImport implements ImportInterface
|
|||||||
|
|
||||||
$data = $this->getCsvData($entity_type);
|
$data = $this->getCsvData($entity_type);
|
||||||
|
|
||||||
|
if(is_array($data))
|
||||||
$data = $this->preTransformCsv($data, $entity_type);
|
$data = $this->preTransformCsv($data, $entity_type);
|
||||||
|
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
@ -98,6 +99,7 @@ class Csv extends BaseImport implements ImportInterface
|
|||||||
|
|
||||||
$data = $this->getCsvData($entity_type);
|
$data = $this->getCsvData($entity_type);
|
||||||
|
|
||||||
|
if(is_array($data))
|
||||||
$data = $this->preTransformCsv($data, $entity_type);
|
$data = $this->preTransformCsv($data, $entity_type);
|
||||||
|
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
@ -125,6 +127,7 @@ class Csv extends BaseImport implements ImportInterface
|
|||||||
|
|
||||||
$data = $this->getCsvData($entity_type);
|
$data = $this->getCsvData($entity_type);
|
||||||
|
|
||||||
|
if(is_array($data))
|
||||||
$data = $this->preTransformCsv($data, $entity_type);
|
$data = $this->preTransformCsv($data, $entity_type);
|
||||||
|
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
@ -152,6 +155,7 @@ class Csv extends BaseImport implements ImportInterface
|
|||||||
|
|
||||||
$data = $this->getCsvData($entity_type);
|
$data = $this->getCsvData($entity_type);
|
||||||
|
|
||||||
|
if(is_array($data))
|
||||||
$data = $this->preTransformCsv($data, $entity_type);
|
$data = $this->preTransformCsv($data, $entity_type);
|
||||||
|
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
@ -179,6 +183,7 @@ class Csv extends BaseImport implements ImportInterface
|
|||||||
|
|
||||||
$data = $this->getCsvData($entity_type);
|
$data = $this->getCsvData($entity_type);
|
||||||
|
|
||||||
|
if(is_array($data))
|
||||||
$data = $this->preTransformCsv($data, $entity_type);
|
$data = $this->preTransformCsv($data, $entity_type);
|
||||||
|
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
@ -206,6 +211,7 @@ class Csv extends BaseImport implements ImportInterface
|
|||||||
|
|
||||||
$data = $this->getCsvData($entity_type);
|
$data = $this->getCsvData($entity_type);
|
||||||
|
|
||||||
|
if(is_array($data))
|
||||||
$data = $this->preTransformCsv($data, $entity_type);
|
$data = $this->preTransformCsv($data, $entity_type);
|
||||||
|
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user