mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 04:07:32 -05:00 
			
		
		
		
	Update import process to handle new data format
This commit is contained in:
		
							parent
							
								
									e11e71514a
								
							
						
					
					
						commit
						4aae7c0b1a
					
				@ -78,7 +78,9 @@ class CSVImport implements ShouldQueue {
 | 
				
			|||||||
		$this->hash        = $request['hash'];
 | 
							$this->hash        = $request['hash'];
 | 
				
			||||||
		$this->import_type = $request['import_type'];
 | 
							$this->import_type = $request['import_type'];
 | 
				
			||||||
		$this->skip_header = $request['skip_header'] ?? null;
 | 
							$this->skip_header = $request['skip_header'] ?? null;
 | 
				
			||||||
		$this->column_map  = $request['column_map'] ?? null;
 | 
							$this->column_map  =
 | 
				
			||||||
 | 
								! empty( $request['column_map'] ) ?
 | 
				
			||||||
 | 
									array_combine( array_keys( $request['column_map'] ), array_column( $request['column_map'], 'mapping' ) ) : null;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
 | 
				
			|||||||
@ -74,7 +74,7 @@ class ImportCsvTest extends TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		$data = [
 | 
							$data = [
 | 
				
			||||||
			'hash'        => $hash,
 | 
								'hash'        => $hash,
 | 
				
			||||||
			'column_map'  => [ 'client' => $column_map ],
 | 
								'column_map'  => [ 'client' => [ 'mapping' => $column_map ] ],
 | 
				
			||||||
			'skip_header' => true,
 | 
								'skip_header' => true,
 | 
				
			||||||
			'import_type' => 'csv',
 | 
								'import_type' => 'csv',
 | 
				
			||||||
		];
 | 
							];
 | 
				
			||||||
@ -113,7 +113,7 @@ class ImportCsvTest extends TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		$data = [
 | 
							$data = [
 | 
				
			||||||
			'hash'        => $hash,
 | 
								'hash'        => $hash,
 | 
				
			||||||
			'column_map'  => [ 'invoice' => $column_map ],
 | 
								'column_map'  => [ 'invoice' => [ 'mapping' => $column_map ] ],
 | 
				
			||||||
			'skip_header' => true,
 | 
								'skip_header' => true,
 | 
				
			||||||
			'import_type' => 'csv',
 | 
								'import_type' => 'csv',
 | 
				
			||||||
		];
 | 
							];
 | 
				
			||||||
@ -141,7 +141,7 @@ class ImportCsvTest extends TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		$data = [
 | 
							$data = [
 | 
				
			||||||
			'hash'        => $hash,
 | 
								'hash'        => $hash,
 | 
				
			||||||
			'column_map'  => [ 'vendor' => $column_map ],
 | 
								'column_map'  => [ 'vendor' => [ 'mapping' => $column_map ] ],
 | 
				
			||||||
			'skip_header' => true,
 | 
								'skip_header' => true,
 | 
				
			||||||
			'import_type' => 'csv',
 | 
								'import_type' => 'csv',
 | 
				
			||||||
		];
 | 
							];
 | 
				
			||||||
@ -166,7 +166,7 @@ class ImportCsvTest extends TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		$data = [
 | 
							$data = [
 | 
				
			||||||
			'hash'        => $hash,
 | 
								'hash'        => $hash,
 | 
				
			||||||
			'column_map'  => [ 'product' => $column_map ],
 | 
								'column_map'  => [ 'product' => [ 'mapping' => $column_map ] ],
 | 
				
			||||||
			'skip_header' => true,
 | 
								'skip_header' => true,
 | 
				
			||||||
			'import_type' => 'csv',
 | 
								'import_type' => 'csv',
 | 
				
			||||||
		];
 | 
							];
 | 
				
			||||||
@ -191,7 +191,7 @@ class ImportCsvTest extends TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		$data = [
 | 
							$data = [
 | 
				
			||||||
			'hash'        => $hash,
 | 
								'hash'        => $hash,
 | 
				
			||||||
			'column_map'  => [ 'expense' => $column_map ],
 | 
								'column_map'  => [ 'expense' => [ 'mapping' => $column_map ] ],
 | 
				
			||||||
			'skip_header' => true,
 | 
								'skip_header' => true,
 | 
				
			||||||
			'import_type' => 'csv',
 | 
								'import_type' => 'csv',
 | 
				
			||||||
		];
 | 
							];
 | 
				
			||||||
@ -218,7 +218,7 @@ class ImportCsvTest extends TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		$data = [
 | 
							$data = [
 | 
				
			||||||
			'hash'        => $hash,
 | 
								'hash'        => $hash,
 | 
				
			||||||
			'column_map'  => [ 'payment' => $column_map ],
 | 
								'column_map'  => [ 'payment' => [ 'mapping' => $column_map ] ],
 | 
				
			||||||
			'skip_header' => true,
 | 
								'skip_header' => true,
 | 
				
			||||||
			'import_type' => 'csv',
 | 
								'import_type' => 'csv',
 | 
				
			||||||
		];
 | 
							];
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user