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

This commit is contained in:
Hillel Coren 2016-03-02 15:36:48 +02:00
commit 9efaada9f5
5 changed files with 18 additions and 17 deletions

View File

@ -132,7 +132,7 @@ class AccountApiController extends BaseAPIController
$devices[$x]['token'] = $request->token; //update $devices[$x]['token'] = $request->token; //update
$account->devices = json_encode($devices); $account->devices = json_encode($devices);
$account->save(); $account->save();
return $this->response($account); return $this->response($devices[$x]);
} }
} }
@ -152,7 +152,7 @@ class AccountApiController extends BaseAPIController
$account->devices = json_encode($devices); $account->devices = json_encode($devices);
$account->save(); $account->save();
return $this->response($account); return $this->response($newDevice);
} }
@ -185,7 +185,7 @@ class AccountApiController extends BaseAPIController
$account->devices = json_encode($devices); $account->devices = json_encode($devices);
$account->save(); $account->save();
return $this->response($account); return $this->response($newDevice);
} }
} }

View File

@ -10,6 +10,7 @@ use App\Events\QuoteInvitationWasViewed;
use App\Events\QuoteInvitationWasApproved; use App\Events\QuoteInvitationWasApproved;
use App\Events\PaymentWasCreated; use App\Events\PaymentWasCreated;
use App\Ninja\Notifications; use App\Ninja\Notifications;
use App\Services\PushService;
class NotificationListener class NotificationListener
{ {
@ -17,7 +18,7 @@ class NotificationListener
protected $contactMailer; protected $contactMailer;
protected $pushService; protected $pushService;
public function __construct(UserMailer $userMailer, ContactMailer $contactMailer, Notifications\PushService $pushService) public function __construct(UserMailer $userMailer, ContactMailer $contactMailer, PushService $pushService)
{ {
$this->userMailer = $userMailer; $this->userMailer = $userMailer;
$this->contactMailer = $contactMailer; $this->contactMailer = $contactMailer;

View File

@ -194,7 +194,6 @@ class AccountRepository
$account = $this->getNinjaAccount(); $account = $this->getNinjaAccount();
$lastInvoice = Invoice::withTrashed()->whereAccountId($account->id)->orderBy('public_id', 'DESC')->first(); $lastInvoice = Invoice::withTrashed()->whereAccountId($account->id)->orderBy('public_id', 'DESC')->first();
$publicId = $lastInvoice ? ($lastInvoice->public_id + 1) : 1; $publicId = $lastInvoice ? ($lastInvoice->public_id + 1) : 1;
$invoice = new Invoice(); $invoice = new Invoice();
$invoice->account_id = $account->id; $invoice->account_id = $account->id;
$invoice->user_id = $account->users()->first()->id; $invoice->user_id = $account->users()->first()->id;

View File

@ -51,7 +51,7 @@ class PushService
foreach($devices as $device) foreach($devices as $device)
{ {
if(($device["notify_{$type}"] == TRUE) && ($device['device'] == 'ios')) if(($device["notify_{$type}"] == TRUE) && ($device['device'] == 'ios'))
$this->pushMessage($invoice, $device['token'], $device["notify_{$type}"]); $this->pushMessage($invoice, $device['token'], $type);
} }
@ -104,19 +104,19 @@ class PushService
{ {
switch($type) switch($type)
{ {
case 'notify_sent': case 'sent':
return $this->entitySentMessage($invoice); return $this->entitySentMessage($invoice);
break; break;
case 'notify_paid': case 'paid':
return $this->invoicePaidMessage($invoice); return $this->invoicePaidMessage($invoice);
break; break;
case 'notify_approved': case 'approved':
return $this->quoteApprovedMessage($invoice); return $this->quoteApprovedMessage($invoice);
break; break;
case 'notify_viewed': case 'viewed':
return $this->entityViewedMessage($invoice); return $this->entityViewedMessage($invoice);
break; break;
} }
@ -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 "Quote #{$invoice->invoice_number} sent!";
else else
return 'Invoice #{$invoice->invoice_number} sent!'; return "Invoice #{$invoice->invoice_number} sent";
} }
@ -141,7 +141,7 @@ class PushService
*/ */
private function invoicePaidMessage($invoice) private function invoicePaidMessage($invoice)
{ {
return 'Invoice #{$invoice->invoice_number} paid!'; return "Invoice #{$invoice->invoice_number} paid!";
} }
/** /**
@ -150,7 +150,7 @@ class PushService
*/ */
private function quoteApprovedMessage($invoice) private function quoteApprovedMessage($invoice)
{ {
return 'Quote #{$invoice->invoice_number} approved!'; return "Quote #{$invoice->invoice_number} approved!";
} }
/** /**
@ -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 "Quote #{$invoice->invoice_number} viewed!";
else else
return 'Invoice #{$invoice->invoice_number} viewed!'; return "Invoice #{$invoice->invoice_number} viewed!";
} }

View File

@ -19,6 +19,7 @@
* [Softaculous](https://www.softaculous.com/apps/ecommerce/Invoice_Ninja) - $30 * [Softaculous](https://www.softaculous.com/apps/ecommerce/Invoice_Ninja) - $30
### Requirements ### Requirements
* PHP >= 5.5.9 * PHP >= 5.5.9
* MCrypt PHP Extension * MCrypt PHP Extension
* MySQL * MySQL