public function processImportedSheets(array $data, array $globals) : array {
		$result = [
			'success' => false,
			'error' => [],
			'data' => []
		];
		// process globals
		$globals_final = [];
		$ignore_columns = [];
		if ($this->collection_object->primary_model->tenant) {
			$globals_final[$this->collection_object->primary_model->tenant_column] = $globals[$this->collection_object->primary_model->tenant_column];
			$ignore_columns[$this->collection_object->primary_model->tenant_column] = $this->collection_object->primary_model->tenant_column;
		}
		if ($this->collection_object->primary_model->module) {
			$globals_final[$this->collection_object->primary_model->module_column] = $globals[$this->collection_object->primary_model->module_column];
			$ignore_columns[$this->collection_object->primary_model->module_column] = $this->collection_object->primary_model->module_column;
		}
		// find main sheet
		$main_sheet_data = $data[$this->collection['name']] ?? $data['Main Sheet'] ?? [];
		unset($data[$this->collection['name']], $data['Main Sheet']);
		if (empty($main_sheet_data)) {
			$result['error'][] = \Object\Content\Messages::NO_ROWS_FOUND;
			return $result;
		}
		// loop though header rows
		foreach ($main_sheet_data as $k => $v) {
			$v = array_merge_hard($v, $globals_final);
			// details
			if (!empty($this->collection['details'])) {
				foreach ($this->collection['details'] as $k2 => $v2) {
					$v[$k2] = [];
					if (empty($data[$v2['name']])) continue;
					// go through data
					foreach ($data[$v2['name']] as $k3 => $v3) {
						// map child to parent
						$found = true;
						foreach ($v2['map'] as $k4 => $v4) {
							// important to add new items to ignore columns array
							if (isset($ignore_columns[$k4])) {
								$ignore_columns[$v4] = $v4;
								continue;
							}
							// compare
							if ($v3[$v4] != $v[$k4]) $found = false;
						}
						// if found
						if ($found) {
							// todo process subdetails
							$v[$k2][] = $v3;
							unset($data[$v2['name']][$k3]);
						}
					}
				}
			}
			$result['data'][$k] = $v;
			unset($main_sheet_data[$k]);
		}
		$result['success'] = true;
		return $result;
	}
public function processImportedSheets(array $data, array $globals) : array {
		$result = [
			'success' => false,
			'error' => [],
			'data' => []
		];
		// process globals
		$globals_final = [];
		$ignore_columns = [];
		if ($this->collection_object->primary_model->tenant) {
			$globals_final[$this->collection_object->primary_model->tenant_column] = $globals[$this->collection_object->primary_model->tenant_column];
			$ignore_columns[$this->collection_object->primary_model->tenant_column] = $this->collection_object->primary_model->tenant_column;
		}
		if ($this->collection_object->primary_model->module) {
			$globals_final[$this->collection_object->primary_model->module_column] = $globals[$this->collection_object->primary_model->module_column];
			$ignore_columns[$this->collection_object->primary_model->module_column] = $this->collection_object->primary_model->module_column;
		}
		// find main sheet
		$main_sheet_data = $data[$this->collection['name']] ?? $data['Main Sheet'] ?? [];
		unset($data[$this->collection['name']], $data['Main Sheet']);
		if (empty($main_sheet_data)) {
			$result['error'][] = \Object\Content\Messages::NO_ROWS_FOUND;
			return $result;
		}
		// loop though header rows
		foreach ($main_sheet_data as $k => $v) {
			$v = array_merge_hard($v, $globals_final);
			// details
			if (!empty($this->collection['details'])) {
				foreach ($this->collection['details'] as $k2 => $v2) {
					$v[$k2] = [];
					if (empty($data[$v2['name']])) continue;
					// go through data
					foreach ($data[$v2['name']] as $k3 => $v3) {
						// map child to parent
						$found = true;
						foreach ($v2['map'] as $k4 => $v4) {
							// important to add new items to ignore columns array
							if (isset($ignore_columns[$k4])) {
								$ignore_columns[$v4] = $v4;
								continue;
							}
							// compare
							if ($v3[$v4] != $v[$k4]) $found = false;
						}
						// if found
						if ($found) {
							// todo process subdetails
							$v[$k2][] = $v3;
							unset($data[$v2['name']][$k3]);
						}
					}
				}
			}
			$result['data'][$k] = $v;
			unset($main_sheet_data[$k]);
		}
		$result['success'] = true;
		return $result;
	}
public function processImportedSheets ( array $ data , array $ globals ) : array { $ result = [ 'success' => false , 'error' => [ ] , 'data' => [ ] ] ; // process globals $ globals_final = [ ] ; $ ignore_columns = [ ] ; if ( $ this -> collection_object -> primary_model -> tenant ) { $ globals_final [ $ this -> collection_object -> primary_model -> tenant_column ] = $ globals [ $ this -> collection_object -> primary_model -> tenant_column ] ; $ ignore_columns [ $ this -> collection_object -> primary_model -> tenant_column ] = $ this -> collection_object -> primary_model -> tenant_column ; } if ( $ this -> collection_object -> primary_model -> module ) { $ globals_final [ $ this -> collection_object -> primary_model -> module_column ] = $ globals [ $ this -> collection_object -> primary_model -> module_column ] ; $ ignore_columns [ $ this -> collection_object -> primary_model -> module_column ] = $ this -> collection_object -> primary_model -> module_column ; } // find main sheet $ main_sheet_data = $ data [ $ this -> collection [ 'name' ] ] ?? $ data [ 'Main Sheet' ] ?? [ ] ; unset ( $ data [ $ this -> collection [ 'name' ] ] , $ data [ 'Main Sheet' ] ) ; if ( empty ( $ main_sheet_data ) ) { $ result [ 'error' ] [ ] = \ Object \ Content \ Messages :: NO_ROWS_FOUND ; return $ result ; } // loop though header rows foreach ( $ main_sheet_data as $ k => $ v ) { $ v = array_merge_hard ( $ v , $ globals_final ) ; // details if ( ! empty ( $ this -> collection [ 'details' ] ) ) { foreach ( $ this -> collection [ 'details' ] as $ k2 => $ v2 ) { $ v [ $ k2 ] = [ ] ; if ( empty ( $ data [ $ v2 [ 'name' ] ] ) ) continue ; // go through data foreach ( $ data [ $ v2 [ 'name' ] ] as $ k3 => $ v3 ) { // map child to parent $ found = true ; foreach ( $ v2 [ 'map' ] as $ k4 => $ v4 ) { // important to add new items to ignore columns array if ( isset ( $ ignore_columns [ $ k4 ] ) ) { $ ignore_columns [ $ v4 ] = $ v4 ; continue ; } // compare if ( $ v3 [ $ v4 ] != $ v [ $ k4 ] ) $ found = false ; } // if found if ( $ found ) { // todo process subdetails $ v [ $ k2 ] [ ] = $ v3 ; unset ( $ data [ $ v2 [ 'name' ] ] [ $ k3 ] ) ; } } } } $ result [ 'data' ] [ $ k ] = $ v ; unset ( $ main_sheet_data [ $ k ] ) ; } $ result [ 'success' ] = true ; return $ result ; }
Process imported sheets

@param array $data
@param array $globals
@return array
Process imported sheets