mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 10:17:33 -04:00 
			
		
		
		
	
						commit
						41c84356f9
					
				
							
								
								
									
										2
									
								
								.github/workflows/phpunit.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/phpunit.yml
									
									
									
									
										vendored
									
									
								
							| @ -13,7 +13,7 @@ jobs: | |||||||
|     strategy: |     strategy: | ||||||
|       matrix: |       matrix: | ||||||
|         operating-system: ['ubuntu-18.04', 'ubuntu-20.04'] |         operating-system: ['ubuntu-18.04', 'ubuntu-20.04'] | ||||||
|         php-versions: ['7.3', '7.4'] |         php-versions: ['7.4'] | ||||||
|         phpunit-versions: ['latest'] |         phpunit-versions: ['latest'] | ||||||
| 
 | 
 | ||||||
|     env: |     env: | ||||||
|  | |||||||
| @ -101,6 +101,8 @@ class Import implements ShouldQueue | |||||||
|      */ |      */ | ||||||
|     private $company; |     private $company; | ||||||
| 
 | 
 | ||||||
|  |     private $token; | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * @var array |      * @var array | ||||||
|      */ |      */ | ||||||
| @ -229,6 +231,11 @@ class Import implements ShouldQueue | |||||||
| 
 | 
 | ||||||
|     private function processAccount(array $data) :void |     private function processAccount(array $data) :void | ||||||
|     { |     { | ||||||
|  |         if(array_key_exists('token', $data)){ | ||||||
|  |             $this->token = $data['token']; | ||||||
|  |             unset($data['token']); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         $account = $this->company->account; |         $account = $this->company->account; | ||||||
|         $account->fill($data); |         $account->fill($data); | ||||||
|         $account->save(); |         $account->save(); | ||||||
| @ -966,20 +973,13 @@ class Import implements ShouldQueue | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             $file_url = $resource['url']; |             $file_url = $resource['url']; | ||||||
| $file_name = basename($file_url); |             $file_name = $resource['name']; | ||||||
|             $file_path = sys_get_temp_dir().'/'.$file_name; |             $file_path = sys_get_temp_dir().'/'.$file_name; | ||||||
| 
 | 
 | ||||||
| file_put_contents($file_path, file_get_contents($file_url), LOCK_EX); |             file_put_contents($file_path, $this->curlGet($file_url)); | ||||||
|             $finfo = new \finfo(FILEINFO_MIME_TYPE); |             $finfo = new \finfo(FILEINFO_MIME_TYPE); | ||||||
|             $file_info = $finfo->file($file_path); |             $file_info = $finfo->file($file_path); | ||||||
| 
 | 
 | ||||||
| nlog($resource['url']); |  | ||||||
| nlog($file_url); |  | ||||||
| nlog($file_name); |  | ||||||
| nlog($file_path); |  | ||||||
| nlog($file_info); |  | ||||||
| nlog(filesize($file_path)); |  | ||||||
| 
 |  | ||||||
|             $uploaded_file = new UploadedFile( |             $uploaded_file = new UploadedFile( | ||||||
|                             $file_path, |                             $file_path, | ||||||
|                             $file_name, |                             $file_name, | ||||||
| @ -991,15 +991,8 @@ $uploaded_file = new UploadedFile( | |||||||
| 
 | 
 | ||||||
|             $this->saveDocument($uploaded_file, $entity, $is_public = true); |             $this->saveDocument($uploaded_file, $entity, $is_public = true); | ||||||
| 
 | 
 | ||||||
|             $uploaded_file = null; |  | ||||||
|             $finfo = null; |  | ||||||
|             $file_url = null; |  | ||||||
|             $file_name = null; |  | ||||||
|             $file_path = null; |  | ||||||
|             $file_info = null; |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private function processPaymentTerms(array $data) :void |     private function processPaymentTerms(array $data) :void | ||||||
| @ -1380,4 +1373,27 @@ $uploaded_file = new UploadedFile( | |||||||
| 
 | 
 | ||||||
|         info(print_r($exception->getMessage(), 1)); |         info(print_r($exception->getMessage(), 1)); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public function curlGet($url, $headers = false) | ||||||
|  |     { | ||||||
|  | 
 | ||||||
|  |         return $this->exec('GET', $url, null); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public function exec($method, $url, $data) | ||||||
|  |     { | ||||||
|  |         nlog($this->token); | ||||||
|  | 
 | ||||||
|  |         $client =  new \GuzzleHttp\Client(['headers' =>  | ||||||
|  |             [  | ||||||
|  |             'X-Ninja-Token' => $this->token,         | ||||||
|  |             ] | ||||||
|  |         ]); | ||||||
|  | 
 | ||||||
|  |         $response = $client->request('GET', $url); | ||||||
|  | 
 | ||||||
|  |         return $response->getBody(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user