mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 14:57:32 -04:00 
			
		
		
		
	Support recurring invoices in Zapier
This commit is contained in:
		
							parent
							
								
									2843265ce5
								
							
						
					
					
						commit
						a657e84838
					
				| @ -59,6 +59,10 @@ class ContactMailer extends Mailer | ||||
|      */ | ||||
|     public function sendInvoice(Invoice $invoice, $reminder = false, $pdfString = false) | ||||
|     { | ||||
|         if ($invoice->is_recurring) { | ||||
|             return false; | ||||
|         } | ||||
| 
 | ||||
|         $invoice->load('invitations', 'client.language', 'account'); | ||||
|         $entityType = $invoice->getEntityType(); | ||||
| 
 | ||||
|  | ||||
| @ -366,15 +366,15 @@ class InvoiceRepository extends BaseRepository | ||||
|         } | ||||
| 
 | ||||
|         if ($invoice->is_recurring) { | ||||
|             if ($invoice->start_date && $invoice->start_date != Utils::toSqlDate($data['start_date'])) { | ||||
|             if (isset($data['start_date']) && $invoice->start_date && $invoice->start_date != Utils::toSqlDate($data['start_date'])) { | ||||
|                 $invoice->last_sent_date = null; | ||||
|             } | ||||
| 
 | ||||
|             $invoice->frequency_id = $data['frequency_id'] ? $data['frequency_id'] : 0; | ||||
|             $invoice->start_date = Utils::toSqlDate($data['start_date']); | ||||
|             $invoice->end_date = Utils::toSqlDate($data['end_date']); | ||||
|             $invoice->frequency_id = array_get($data, 'frequency_id', 0); | ||||
|             $invoice->start_date = Utils::toSqlDate(array_get($data, 'start_date')); | ||||
|             $invoice->end_date = Utils::toSqlDate(array_get($data, 'end_date')); | ||||
|             $invoice->client_enable_auto_bill = isset($data['client_enable_auto_bill']) && $data['client_enable_auto_bill'] ? true : false; | ||||
|             $invoice->auto_bill = isset($data['auto_bill']) ? intval($data['auto_bill']) : AUTO_BILL_OFF; | ||||
|             $invoice->auto_bill = array_get($data, 'auto_bill_id') ?: array_get($data, 'auto_bill', AUTO_BILL_OFF); | ||||
| 
 | ||||
|             if ($invoice->auto_bill < AUTO_BILL_OFF || $invoice->auto_bill > AUTO_BILL_ALWAYS ) { | ||||
|                 $invoice->auto_bill = AUTO_BILL_OFF; | ||||
|  | ||||
| @ -45,6 +45,10 @@ class PaymentService extends BaseService | ||||
|      */ | ||||
|     public function autoBillInvoice(Invoice $invoice) | ||||
|     { | ||||
|         if ( ! $invoice->canBePaid()) { | ||||
|             return false; | ||||
|         } | ||||
| 
 | ||||
|         /** @var \App\Models\Client $client */ | ||||
|         $client = $invoice->client; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user