mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:57:33 -05:00 
			
		
		
		
	Merge pull request #5620 from turbo124/v5-develop
Fixes for migration timestamps
This commit is contained in:
		
						commit
						7ef942ad34
					
				@ -488,6 +488,14 @@ class Import implements ShouldQueue
 | 
				
			|||||||
                )
 | 
					                )
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(array_key_exists('created_at', $modified))
 | 
				
			||||||
 | 
					                $client->created_at = $modified['created_at'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(array_key_exists('updated_at', $modified))
 | 
				
			||||||
 | 
					                $client->updated_at = $modified['updated_at'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $client->save(['timestamps' => false]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $client->contacts()->forceDelete();
 | 
					            $client->contacts()->forceDelete();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (array_key_exists('contacts', $resource)) { // need to remove after importing new migration.json
 | 
					            if (array_key_exists('contacts', $resource)) { // need to remove after importing new migration.json
 | 
				
			||||||
@ -891,6 +899,14 @@ class Import implements ShouldQueue
 | 
				
			|||||||
                QuoteFactory::create($this->company->id, $modified['user_id'])
 | 
					                QuoteFactory::create($this->company->id, $modified['user_id'])
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(array_key_exists('created_at', $modified))
 | 
				
			||||||
 | 
					                $quote->created_at = $modified['created_at'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(array_key_exists('updated_at', $modified))
 | 
				
			||||||
 | 
					                $quote->updated_at = $modified['updated_at'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $quote->save(['timestamps' => false]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
 | 
					            $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $key = "quotes_{$resource['id']}";
 | 
					            $key = "quotes_{$resource['id']}";
 | 
				
			||||||
@ -957,6 +973,14 @@ class Import implements ShouldQueue
 | 
				
			|||||||
                PaymentFactory::create($this->company->id, $modified['user_id'])
 | 
					                PaymentFactory::create($this->company->id, $modified['user_id'])
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(array_key_exists('created_at', $modified))
 | 
				
			||||||
 | 
					                $payment->created_at = $modified['created_at'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(array_key_exists('updated_at', $modified))
 | 
				
			||||||
 | 
					                $payment->updated_at = $modified['updated_at'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $payment->save(['timestamps' => false]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (array_key_exists('company_gateway_id', $resource) && isset($resource['company_gateway_id']) && $resource['company_gateway_id'] != 'NULL') {
 | 
					            if (array_key_exists('company_gateway_id', $resource) && isset($resource['company_gateway_id']) && $resource['company_gateway_id'] != 'NULL') {
 | 
				
			||||||
                $payment->company_gateway_id = $this->transformId('company_gateways', $resource['company_gateway_id']);
 | 
					                $payment->company_gateway_id = $this->transformId('company_gateways', $resource['company_gateway_id']);
 | 
				
			||||||
                $payment->save();
 | 
					                $payment->save();
 | 
				
			||||||
@ -1319,6 +1343,14 @@ class Import implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $task = Task::Create($modified);
 | 
					            $task = Task::Create($modified);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(array_key_exists('created_at', $modified))
 | 
				
			||||||
 | 
					                $task->created_at = $modified['created_at'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(array_key_exists('updated_at', $modified))
 | 
				
			||||||
 | 
					                $task->updated_at = $modified['updated_at'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $task->save(['timestamps' => false]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
 | 
					            $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $this->ids['tasks'] = [
 | 
					            $this->ids['tasks'] = [
 | 
				
			||||||
@ -1399,6 +1431,14 @@ class Import implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $expense = Expense::Create($modified);
 | 
					            $expense = Expense::Create($modified);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(array_key_exists('created_at', $modified))
 | 
				
			||||||
 | 
					                $expense->created_at = $modified['created_at'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(array_key_exists('updated_at', $modified))
 | 
				
			||||||
 | 
					                $expense->updated_at = $modified['updated_at'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $expense->save(['timestamps' => false]);
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
            $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
 | 
					            $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $key = "expenses_{$resource['id']}";
 | 
					            $key = "expenses_{$resource['id']}";
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user