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

36 lines
696 B
PHP
Raw Normal View History

2013-12-25 22:34:42 +01:00
<?php namespace ninja\mailers;
2013-12-10 18:18:35 +01:00
use Invoice;
use Contact;
use Invitation;
use URL;
use Auth;
2013-12-30 21:17:45 +01:00
use Activity;
2013-12-10 18:18:35 +01:00
class ContactMailer extends Mailer {
public function sendInvoice(Invoice $invoice)
2013-12-10 18:18:35 +01:00
{
$view = 'invoice';
$data = array('link' => URL::to('view') . '/' . $invoice->invoice_key);
$subject = '';
foreach ($invoice->invitations as $invitation)
{
//$invitation->date_sent =
$invitation->save();
2013-12-10 18:18:35 +01:00
$this->sendTo($invitation->contact->email, $subject, $view, $data);
2013-12-10 18:18:35 +01:00
2013-12-30 21:17:45 +01:00
Activity::emailInvoice($invitation);
}
2013-12-11 12:11:59 +01:00
if (!$invoice->isSent())
{
$invoice->invoice_status_id = INVOICE_STATUS_SENT;
$invoice->save();
}
2013-12-25 22:34:42 +01:00
\Event::fire('invoice.sent', $invoice);
2013-12-10 18:18:35 +01:00
}
}