1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00

Merge branch 'develop' of github.com:hillelcoren/invoice-ninja into develop

This commit is contained in:
Hillel Coren 2016-03-03 10:44:55 +02:00
commit ee8a01ff3a
2 changed files with 13 additions and 12 deletions

View File

@ -162,25 +162,26 @@ class AccountApiController extends BaseAPIController
$devices = json_decode($account->devices, TRUE); $devices = json_decode($account->devices, TRUE);
if(count($devices)<1) if(count($devices) < 1)
return $this->errorResponse(['message'=>'no devices exist'], 400); return $this->errorResponse(['message'=>'No registered devices.'], 400);
for($x=0; $x<count($devices); $x++) for($x=0; $x<count($devices); $x++)
{ {
if($devices[$x]['email'] == Auth::user()->username) if($devices[$x]['email'] == Auth::user()->username)
{ {
unset($devices[$x]);
$newDevice = [ $newDevice = [
'token' => $request->token, 'token' => $devices[$x]['token'],
'email' => $request->email, 'email' => $devices[$x]['email'],
'device' => $request->device, 'device' => $devices[$x]['device'],
'notify_sent' => $request->notify_sent, 'notify_sent' => $request->notify_sent,
'notify_viewed' => $request->notify_viewed, 'notify_viewed' => $request->notify_viewed,
'notify_approved' => $request->notify_approved, 'notify_approved' => $request->notify_approved,
'notify_paid' => $request->notify_paid, 'notify_paid' => $request->notify_paid,
]; ];
unset($devices[$x]);
$devices[] = $newDevice; $devices[] = $newDevice;
$account->devices = json_encode($devices); $account->devices = json_encode($devices);
$account->save(); $account->save();

View File

@ -129,9 +129,9 @@ class PushService
private function entitySentMessage($invoice) private function entitySentMessage($invoice)
{ {
if($invoice->is_quote) if($invoice->is_quote)
return "Quote #{$invoice->invoice_number} sent!"; return trans("texts.notification_quote_sent_subject", ['invoice' => $invoice->invoice_number, 'client' => $invoice->client->name]);
else else
return "Invoice #{$invoice->invoice_number} sent"; return trans("texts.notification_invoice_sent_subject", ['invoice' => $invoice->invoice_number, 'client' => $invoice->client->name]);
} }
@ -141,7 +141,7 @@ class PushService
*/ */
private function invoicePaidMessage($invoice) private function invoicePaidMessage($invoice)
{ {
return "Invoice #{$invoice->invoice_number} paid!"; return trans("texts.notification_invoice_paid_subject", ['invoice' => $invoice->invoice_number, 'client' => $invoice->client->name]);
} }
/** /**
@ -150,7 +150,7 @@ class PushService
*/ */
private function quoteApprovedMessage($invoice) private function quoteApprovedMessage($invoice)
{ {
return "Quote #{$invoice->invoice_number} approved!"; return trans("texts.notification_quote_approved_subject", ['invoice' => $invoice->invoice_number, 'client' => $invoice->client->name]);
} }
/** /**
@ -160,9 +160,9 @@ class PushService
private function entityViewedMessage($invoice) private function entityViewedMessage($invoice)
{ {
if($invoice->is_quote) if($invoice->is_quote)
return "Quote #{$invoice->invoice_number} viewed!"; return trans("texts.notification_quote_viewed_subject", ['invoice' => $invoice->invoice_number, 'client' => $invoice->client->name]);
else else
return "Invoice #{$invoice->invoice_number} viewed!"; return trans("texts.notification_invoice_viewed_subject", ['invoice' => $invoice->invoice_number, 'client' => $invoice->client->name]);
} }