mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 16:57:33 -04:00 
			
		
		
		
	Fixes for contact API
This commit is contained in:
		
							parent
							
								
									89be0df8a3
								
							
						
					
					
						commit
						ddc9df6650
					
				| @ -144,7 +144,7 @@ class ContactApiController extends BaseAPIController | |||||||
| 
 | 
 | ||||||
|         $data = $request->input(); |         $data = $request->input(); | ||||||
|         $data['public_id'] = $publicId; |         $data['public_id'] = $publicId; | ||||||
|         $expense = $this->contactService->save($data, $request->entity()); |         $contact = $this->contactService->save($data, $request->entity()); | ||||||
| 
 | 
 | ||||||
|         return $this->itemResponse($contact); |         return $this->itemResponse($contact); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -6,11 +6,13 @@ use App\Models\Contact; | |||||||
| 
 | 
 | ||||||
| class ContactRepository extends BaseRepository | class ContactRepository extends BaseRepository | ||||||
| { | { | ||||||
|     public function save($data) |     public function save($data, $contact = false) | ||||||
|     { |     { | ||||||
|         $publicId = isset($data['public_id']) ? $data['public_id'] : false; |         $publicId = isset($data['public_id']) ? $data['public_id'] : false; | ||||||
| 
 | 
 | ||||||
|         if (! $publicId || $publicId == '-1') { |         if ($contact) { | ||||||
|  |             // do nothing
 | ||||||
|  |         } elseif (! $publicId || $publicId == '-1') { | ||||||
|             $contact = Contact::createNew(); |             $contact = Contact::createNew(); | ||||||
|             $contact->send_invoice = true; |             $contact->send_invoice = true; | ||||||
|             $contact->client_id = $data['client_id']; |             $contact->client_id = $data['client_id']; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user