1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +01:00
invoiceninja/app/ninja/mailers/ContactMailer.php
Hillel Coren 2b5f42e5ac bug fixes
2013-12-30 22:17:45 +02:00

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);
}
}