mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 03:57:32 -05:00 
			
		
		
		
	Fixes for auto billing
This commit is contained in:
		
							parent
							
								
									f473dbd0e2
								
							
						
					
					
						commit
						64d0d34a27
					
				@ -69,6 +69,7 @@ class AutoBillCron
 | 
			
		||||
        } else {
 | 
			
		||||
            //multiDB environment, need to
 | 
			
		||||
            foreach (MultiDB::$dbs as $db) {
 | 
			
		||||
        
 | 
			
		||||
                MultiDB::setDB($db);
 | 
			
		||||
 | 
			
		||||
                $auto_bill_partial_invoices = Invoice::whereDate('partial_due_date', '<=', now())
 | 
			
		||||
@ -96,6 +97,12 @@ class AutoBillCron
 | 
			
		||||
    private function runAutoBiller(Invoice $invoice)
 | 
			
		||||
    {
 | 
			
		||||
        info("Firing autobill for {$invoice->company_id} - {$invoice->number}");
 | 
			
		||||
 | 
			
		||||
        try{
 | 
			
		||||
            $invoice->service()->autoBill()->save();
 | 
			
		||||
        }
 | 
			
		||||
        catch(\Exception $e) {
 | 
			
		||||
            nlog("Failed to capture payment for {$invoice->company_id} - {$invoice->number} ->" . $e->getMessage());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -129,7 +129,7 @@ class SendRecurring implements ShouldQueue
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    
 | 
			
		||||
        if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $this->recurring_invoice->auto_bill_enabled) {
 | 
			
		||||
        if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $invoice->auto_bill_enabled) {
 | 
			
		||||
            nlog("attempting to autobill {$invoice->number}");
 | 
			
		||||
            $invoice->service()->autoBill()->save();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user