mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 21:52:35 +01:00
36 lines
696 B
PHP
Executable File
36 lines
696 B
PHP
Executable File
<?php namespace ninja\mailers;
|
|
|
|
use Invoice;
|
|
use Contact;
|
|
use Invitation;
|
|
use URL;
|
|
use Auth;
|
|
use Activity;
|
|
|
|
class ContactMailer extends Mailer {
|
|
|
|
public function sendInvoice(Invoice $invoice)
|
|
{
|
|
$view = 'invoice';
|
|
$data = array('link' => URL::to('view') . '/' . $invoice->invoice_key);
|
|
$subject = '';
|
|
|
|
foreach ($invoice->invitations as $invitation)
|
|
{
|
|
//$invitation->date_sent =
|
|
$invitation->save();
|
|
|
|
$this->sendTo($invitation->contact->email, $subject, $view, $data);
|
|
|
|
Activity::emailInvoice($invitation);
|
|
}
|
|
|
|
if (!$invoice->isSent())
|
|
{
|
|
$invoice->invoice_status_id = INVOICE_STATUS_SENT;
|
|
$invoice->save();
|
|
}
|
|
|
|
\Event::fire('invoice.sent', $invoice);
|
|
}
|
|
} |