mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 01:17:30 -05:00 
			
		
		
		
	Fixes for repo
This commit is contained in:
		
							parent
							
								
									4dca7da070
								
							
						
					
					
						commit
						a07742a009
					
				@ -74,9 +74,13 @@ class PaymentRepository extends BaseRepository
 | 
			
		||||
 | 
			
		||||
            /*We only update the paid to date ONCE per payment*/
 | 
			
		||||
            if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) {
 | 
			
		||||
               $invoice_totals = array_sum(array_column($data['invoices'], 'amount'));
 | 
			
		||||
 | 
			
		||||
                if($data['amount'] == '')
 | 
			
		||||
                    $data['amount'] = array_sum(array_column($data['invoices'], 'amount'));
 | 
			
		||||
                
 | 
			
		||||
                $client = Client::find($data['client_id']);
 | 
			
		||||
                $client->service()->updatePaidToDate($invoice_totals)->save();
 | 
			
		||||
                $client->service()->updatePaidToDate($data['amount'])->save();
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -100,7 +104,6 @@ class PaymentRepository extends BaseRepository
 | 
			
		||||
 | 
			
		||||
            $invoices = Invoice::whereIn('id', array_column($data['invoices'], 'invoice_id'))->get();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            $payment->invoices()->saveMany($invoices);
 | 
			
		||||
 | 
			
		||||
            info("iterating through payment invoices");
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user