From 536b21595d86aa3dac45e692d013b8cb272faa24 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sat, 27 Feb 2016 22:44:18 +0200 Subject: [PATCH 01/12] Updated build branch --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 1addcb2fd9d1..9edb27210fc8 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ # Invoice Ninja ### [https://www.invoiceninja.com](https://www.invoiceninja.com) -[![Build Status](https://travis-ci.org/invoiceninja/invoiceninja.svg?branch=develop)](https://travis-ci.org/invoiceninja/invoiceninja) +[![Build Status](https://travis-ci.org/invoiceninja/invoiceninja.svg?branch=master)](https://travis-ci.org/invoiceninja/invoiceninja) [![Join the chat at https://gitter.im/hillelcoren/invoice-ninja](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hillelcoren/invoice-ninja?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ### Affiliates Programs From dade97fbfae32fc478764f77c31e4affdda77266 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 29 Feb 2016 13:25:32 +0200 Subject: [PATCH 02/12] Merged minor fixes --- app/Ninja/Repositories/AccountRepository.php | 12 +++++------- app/Services/ImportService.php | 2 +- resources/views/accounts/bank_account.blade.php | 1 + resources/views/header.blade.php | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index 2b469bf0fcf7..62c924d545da 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -124,25 +124,23 @@ class AccountRepository return false; } - $client = $this->getNinjaClient(Auth::user()->account); - $invitation = $this->createNinjaInvoice($client); - + $account = Auth::user()->account; + $client = $this->getNinjaClient($account); + $invitation = $this->createNinjaInvoice($client, $account); return $invitation; } - - public function createNinjaInvoice($client) + public function createNinjaInvoice($client, $clientAccount) { $account = $this->getNinjaAccount(); $lastInvoice = Invoice::withTrashed()->whereAccountId($account->id)->orderBy('public_id', 'DESC')->first(); $publicId = $lastInvoice ? ($lastInvoice->public_id + 1) : 1; - $invoice = new Invoice(); $invoice->account_id = $account->id; $invoice->user_id = $account->users()->first()->id; $invoice->public_id = $publicId; $invoice->client_id = $client->id; $invoice->invoice_number = $account->getNextInvoiceNumber($invoice); - $invoice->invoice_date = Auth::user()->account->getRenewalDate(); + $invoice->invoice_date = $clientAccount->getRenewalDate(); $invoice->amount = PRO_PLAN_PRICE; $invoice->balance = PRO_PLAN_PRICE; $invoice->save(); diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index b557e067b2bf..c17a8e359a80 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -1,4 +1,4 @@ - Date: Tue, 1 Mar 2016 18:15:43 +1100 Subject: [PATCH 03/12] Update readme.md --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 9edb27210fc8..c5d3a5ce69f1 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,7 @@ * [Softaculous](https://www.softaculous.com/apps/ecommerce/Invoice_Ninja) - $30 ### Requirements -* PHP >= 5.4.0 +* PHP >= 5.5.9 * MCrypt PHP Extension * MySQL @@ -28,7 +28,7 @@ * [Postmark](https://postmarkapp.com/) ### Features -* Built using Laravel 5 +* Built using Laravel 5.1 * Live PDF generation using [pdfmake](http://pdfmake.org/) * Integrates with 50+ payment providers with [OmniPay](https://github.com/thephpleague/omnipay) * Recurring invoices with auto-billing @@ -96,4 +96,4 @@ We're using the [Git-Flow](http://nvie.com/posts/a-successful-git-branching-mode * [ezyang/htmlpurifier](https://github.com/ezyang/htmlpurifier) - Standards compliant HTML filter written in PHP * [cerdic/css-tidy](https://github.com/Cerdic/CSSTidy) - CSSTidy is a CSS minifier * [asgrim/ofxparser](https://github.com/asgrim/ofxparser) - OFX File Parser -* [stacktracejs/stacktrace.js](https://github.com/stacktracejs/stacktrace.js) - Framework-agnostic, micro-library for getting stack traces in all web browsers \ No newline at end of file +* [stacktracejs/stacktrace.js](https://github.com/stacktracejs/stacktrace.js) - Framework-agnostic, micro-library for getting stack traces in all web browsers From 66fca98fa13203a6d65fe3b8555423be3d2f1fff Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 1 Mar 2016 18:18:13 +1100 Subject: [PATCH 04/12] Update readme.md --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index c5d3a5ce69f1..da8709109d65 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,7 @@ * [Softaculous](https://www.softaculous.com/apps/ecommerce/Invoice_Ninja) - $30 ### Requirements -* PHP >= 5.5.9 +* PHP >= 5.4 * MCrypt PHP Extension * MySQL @@ -28,7 +28,7 @@ * [Postmark](https://postmarkapp.com/) ### Features -* Built using Laravel 5.1 +* Built using Laravel 5 * Live PDF generation using [pdfmake](http://pdfmake.org/) * Integrates with 50+ payment providers with [OmniPay](https://github.com/thephpleague/omnipay) * Recurring invoices with auto-billing From aa4aae4797146d86c4b99bd94dec99c4c3fb9fa7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 1 Mar 2016 21:31:23 +1100 Subject: [PATCH 05/12] Working on API --- app/Http/Controllers/AccountApiController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/AccountApiController.php b/app/Http/Controllers/AccountApiController.php index 6d4ef0ccf1e7..5f34f267db7c 100644 --- a/app/Http/Controllers/AccountApiController.php +++ b/app/Http/Controllers/AccountApiController.php @@ -152,7 +152,7 @@ class AccountApiController extends BaseAPIController $account->devices = json_encode($devices); $account->save(); - return $this->response($account); + return $this->response($newDevice); } @@ -185,7 +185,7 @@ class AccountApiController extends BaseAPIController $account->devices = json_encode($devices); $account->save(); - return $this->response($account); + return $this->response($newDevice); } } From c1b9d6febc8e1c92418fde26d6f5c232bf3268d7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Mar 2016 12:13:57 +1100 Subject: [PATCH 06/12] Bug Fix --- app/Listeners/NotificationListener.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Listeners/NotificationListener.php b/app/Listeners/NotificationListener.php index c7b58fe30ba5..29a190eeb712 100644 --- a/app/Listeners/NotificationListener.php +++ b/app/Listeners/NotificationListener.php @@ -10,6 +10,7 @@ use App\Events\QuoteInvitationWasViewed; use App\Events\QuoteInvitationWasApproved; use App\Events\PaymentWasCreated; use App\Ninja\Notifications; +use App\Services\PushService; class NotificationListener { @@ -17,7 +18,7 @@ class NotificationListener protected $contactMailer; 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->contactMailer = $contactMailer; From 922849409c4e13d4b4e9f624dbd074a49479c24d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Mar 2016 12:17:59 +1100 Subject: [PATCH 07/12] Bug Fix --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 7e2b04ec71fd..d164ce19ab68 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ # Invoice Ninja ### [https://www.invoiceninja.com](https://www.invoiceninja.com) -[![Build Status](https://travis-ci.org/invoiceninja/invoiceninja.svg?branch=master)](https://travis-ci.org/invoiceninja/invoiceninja) +[![Build Status](https://travis-ci.org/invoiceninja/invoiceninja.svg?branch=develop)](https://travis-ci.org/invoiceninja/invoiceninja) [![Join the chat at https://gitter.im/hillelcoren/invoice-ninja](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hillelcoren/invoice-ninja?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ### Affiliates Programs From b14f8e2dfefb8c86d4a5be485a4e9f07c076fd38 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Mar 2016 21:08:12 +1100 Subject: [PATCH 08/12] Bug fixes --- app/Services/PushService.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Services/PushService.php b/app/Services/PushService.php index 00591e263323..2e50fd586c2c 100644 --- a/app/Services/PushService.php +++ b/app/Services/PushService.php @@ -129,9 +129,9 @@ class PushService private function entitySentMessage($invoice) { if($invoice->is_quote) - return 'Quote #{$invoice->invoice_number} sent!'; + return "Quote #{$invoice->invoice_number} sent!"; else - return 'Invoice #{$invoice->invoice_number} sent!'; + return "Invoice #{$invoice->invoice_number} sent"; } @@ -141,7 +141,7 @@ class PushService */ 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) { - return 'Quote #{$invoice->invoice_number} approved!'; + return "Quote #{$invoice->invoice_number} approved!"; } /** @@ -160,9 +160,9 @@ class PushService private function entityViewedMessage($invoice) { if($invoice->is_quote) - return 'Quote #{$invoice->invoice_number} viewed!'; + return "Quote #{$invoice->invoice_number} viewed!"; else - return 'Invoice #{$invoice->invoice_number} viewed!'; + return "Invoice #{$invoice->invoice_number} viewed!"; } From 50c5d52e08ebf0de6d2ddde43a7a5ed41e33ae48 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Mar 2016 21:52:59 +1100 Subject: [PATCH 09/12] Bug Fixes --- app/Http/Controllers/AccountApiController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/AccountApiController.php b/app/Http/Controllers/AccountApiController.php index 5f34f267db7c..c42cfdeeec50 100644 --- a/app/Http/Controllers/AccountApiController.php +++ b/app/Http/Controllers/AccountApiController.php @@ -120,7 +120,8 @@ class AccountApiController extends BaseAPIController public function addDeviceToken(Request $request) { - $account = Auth::user()->account; + //$account = Auth::user()->account; + $account = Account::where('account_key', $request->account_key)->first(); //scan if this user has a token already registered (tokens can change, so we need to use the users email as key) $devices = json_decode($account->devices,TRUE); @@ -132,7 +133,7 @@ class AccountApiController extends BaseAPIController $devices[$x]['token'] = $request->token; //update $account->devices = json_encode($devices); $account->save(); - return $this->response($account); + return $this->response($devices[$x]); } } @@ -158,7 +159,8 @@ class AccountApiController extends BaseAPIController public function updatePushNotifications(Request $request) { - $account = Auth::user()->account; + //$account = Auth::user()->account; + $account = Account::where('account_key', $request->account_key)->first(); $devices = json_decode($account->devices, TRUE); From 8a33f6fec664c406c60087b7424f79b92572b838 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Mar 2016 22:00:08 +1100 Subject: [PATCH 10/12] Bug Fixes --- app/Services/PushService.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Services/PushService.php b/app/Services/PushService.php index 2e50fd586c2c..e8d1176aebf8 100644 --- a/app/Services/PushService.php +++ b/app/Services/PushService.php @@ -51,7 +51,7 @@ class PushService foreach($devices as $device) { 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) { - case 'notify_sent': + case 'sent': return $this->entitySentMessage($invoice); break; - case 'notify_paid': + case 'paid': return $this->invoicePaidMessage($invoice); break; - case 'notify_approved': + case 'approved': return $this->quoteApprovedMessage($invoice); break; - case 'notify_viewed': + case 'viewed': return $this->entityViewedMessage($invoice); break; } From 1d0c35ec76a59ff3e69b822cb7483fdb193b0295 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Mar 2016 22:14:42 +1100 Subject: [PATCH 11/12] Bug Fixes --- app/Http/Controllers/AccountApiController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/AccountApiController.php b/app/Http/Controllers/AccountApiController.php index c42cfdeeec50..f0046d42e293 100644 --- a/app/Http/Controllers/AccountApiController.php +++ b/app/Http/Controllers/AccountApiController.php @@ -120,8 +120,8 @@ class AccountApiController extends BaseAPIController public function addDeviceToken(Request $request) { - //$account = Auth::user()->account; - $account = Account::where('account_key', $request->account_key)->first(); + $account = Auth::user()->account; + //$account = Account::where('account_key', $request->account_key)->first(); //scan if this user has a token already registered (tokens can change, so we need to use the users email as key) $devices = json_decode($account->devices,TRUE); @@ -159,8 +159,8 @@ class AccountApiController extends BaseAPIController public function updatePushNotifications(Request $request) { - //$account = Auth::user()->account; - $account = Account::where('account_key', $request->account_key)->first(); + $account = Auth::user()->account; + // $account = Account::where('account_key', $request->account_key)->first(); $devices = json_decode($account->devices, TRUE); From 6ff569a5a3d0997406dcb8c4245cb542c241f195 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Mar 2016 22:16:06 +1100 Subject: [PATCH 12/12] Bug Fixes --- app/Http/Controllers/AccountApiController.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/Http/Controllers/AccountApiController.php b/app/Http/Controllers/AccountApiController.php index f0046d42e293..5154370651f1 100644 --- a/app/Http/Controllers/AccountApiController.php +++ b/app/Http/Controllers/AccountApiController.php @@ -121,7 +121,6 @@ class AccountApiController extends BaseAPIController public function addDeviceToken(Request $request) { $account = Auth::user()->account; - //$account = Account::where('account_key', $request->account_key)->first(); //scan if this user has a token already registered (tokens can change, so we need to use the users email as key) $devices = json_decode($account->devices,TRUE); @@ -160,7 +159,6 @@ class AccountApiController extends BaseAPIController public function updatePushNotifications(Request $request) { $account = Auth::user()->account; - // $account = Account::where('account_key', $request->account_key)->first(); $devices = json_decode($account->devices, TRUE);