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 9f79628579 bug fixes
2014-01-09 10:05:35 +00:00

45 lines
937 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';
$subject = '';
$invoice->load('invitations');
foreach ($invoice->invitations as $invitation)
{
if (!$invitation->user->email)
{
return false;
}
$invitation->sent_date = \Carbon::now()->toDateTimeString();
$invitation->save();
$data = array('link' => URL::to('view') . '/' . $invitation->invitation_key);
$this->sendTo($invitation->contact->email, $invitation->user->email, $subject, $view, $data);
//$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);
}
}