mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Support recurring invoices in Zapier
This commit is contained in:
parent
10573d0f30
commit
18c8dfefb1
@ -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…
Reference in New Issue
Block a user